6

Consider Testnet transaction 7a438...de03e which has vout[0].scriptPubKey =

OP_DUP OP_DROP OP_DUP OP_HASH160 039.....6fe OP_EQUALVERIFY OP_CHECKSIG

The script is equivalent to a standard pay-to-pubkeyhash scriptPubKey. Let's try to spend it:

> bitcoind createrawtransaction '[{"txid":"7a438.....de03e","vout":0}]' '{"mfq.....oDY":1.3}'
01000000013ee0bdf5779c48f42bda36cd740ba297ae071ec7fe3eadae6418602de48d437a0000000000ffffffff0180a4bf07000000001976a914039541a738df12eed1825b866eb5bb5aba6bf6fe88ac00000000

> bitcoind signrawtransaction 01000.....00000
{
  "hex" : "01000000013ee0bdf5779c48f42bda36cd740ba297ae071ec7fe3eadae6418602de48d437a0000000000ffffffff0180a4bf07000000001976a914039541a738df12eed1825b866eb5bb5aba6bf6fe88ac00000000",
  "complete" : false
}

As you can see, bitcoind refuses to sign the transaction (same hex and obviously complete is false) I guess because it can't find a suitable address (since it's a non-standard script). I do indeed control the address and have its private key.

Is there any way to sign this transaction?

  • 1
    Still wondering about this. If Bitcoin message signing were just a plain ECDSA signature (is it?) I could just strip down the transaction (according to its sig type), hash it and RPC-signmessage the hash bytes. Then I just base68-decode the RPC result and use "<sig> <signedHash>" as my scriptSig. Could this scheme work? Will try ASAP. – kaoD Jan 8 '14 at 18:23
1

You will have to build the transaction yourself instead of relying on wallet software. You can either create it all from scratch and use pushtx or use an online API that accepts explicit input references to previous outputs. For example (check the last paragraph):

http://dev.blockcypher.com/#transaction_skeleton

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.