Hi all,
I'm trying to create a raw transaction using bitcoin-cli. First I look at the transaction:
687_2$ bitcoin-cli listunspent
[
{
"txid": "0d53507afc671e57841e3f72cee5db1324da4fa0c42a50c98872b820d2a2c768",
"vout": 0,
"address": "13m5CWgygXuCbwuMo6MFtqNsiZT8uY1o6Q",
"account": "",
"scriptPubKey": "76a9141e460f008264743caa92c9d23f944216fd29c7a788ac",
"amount": 0.00039000,
"confirmations": 21,
"spendable": true,
"solvable": true
}
]
Then I create the raw transaction:
bitcoin-cli createrawtransaction '[{"txid":"0d53507afc671e57841e3f72cee5db1324da4fa0c42a50c98872b820d2a2c768","vout":1,"scriptPubKey":"76a9141e460f008264743caa92c9d23f944216fd29c7a788ac"}]' '{"1EhPUwR9BkWWJ1K9rWjxSFbBMGKXKozCim":0.00038,"15sGXSMk99DUzwPMXqCevYB1gmS3c62CQr":0.00007}'
This gives me the hex:
010000000168c7a2d220b87288c9502ac4a04fda2413dbe5ce723f1e84571e67fc7a50530d0100000000ffffffff0270940000000000001976a914963d0a59d3b0ccfd0df3c95c972bee98e06ba19688ac581b0000000000001976a914356242ba76e9e8df980ac9d2d5399dee1233e45488ac00000000
Ok, now I want to sign the transaction. I format the command as prescribed:
687_2$ bitcoin-cli signrawtransaction '010000000168c7a2d220b87288c9502ac4a04fda2413dbe5ce723f1e84571e67fc7a50530d0100000000ffffffff0270940000000000001976a914963d0a59d3b0ccfd0df3c95c972bee98e06ba19688ac581b0000000000001976a914356242ba76e9e8df980ac9d2d5399dee1233e45488ac00000000' '[{"txid":"0d53507afc671e57841e3f72cee5db1324da4fa0c42a50c98872b820d2a2c768","vout":1,"scriptPubKey":"76a9141e460f008264743caa92c9d23f944216fd29c7a788ac"}]'
This results in the error:
error code: -22
error message:
Previous output scriptPubKey mismatch:
OP_DUP OP_HASH160 cbe0394e3f79b2f4f4e87191c638df0e8795bf92 OP_EQUALVERIFY OP_CHECKSIG
vs:
OP_DUP OP_HASH160 1e460f008264743caa92c9d23f944216fd29c7a7 OP_EQUALVERIFY OP_CHECKSIG
I've tried a few different ways of breaking this, looked here:
https://www.reddit.com/r/Bitcoin/comments/2ebaow/how_to_create_a_raw_transaction_in_bitcoin_qt/ which doesn't seem to help, and I tried Greg's example:
https://people.xiph.org/~greg/signdemo.txt as well; that one worked but I couldn't send the raw transaction (insufficient fee, or something. It made sense).
This seems like a trivial issue, maybe I've just been looking at my monitor too long. Does anyone see what I'm doing wrong? Is there something I'm missing?