1

When I make a transaction spending an output on one machine (sending it to another locally owned address), and then broadcast it on the same machine, it all works fine, as below.

(NODE A)
$ createrawtransaction '[{"txid":"1aa836ed53b595c282589b062876a81873c6c57146be4fb875bf7ee2dcfa3a12", "vout":0}]' '{"mfb33SCwSxuisQnPzhthgkDyDAu89QE66u":49}'
0100000001123afadce27ebf75b84fbe4671c5c67318a87628069b5882c295b553ed36a81a0000000000ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000

(NODE A)
$ signrawtransaction 0100000001123afadce27ebf75b84fbe4671c5c67318a87628069b5882c295b553ed36a81a0000000000ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000
{
    "hex" :  "0100000001123afadce27ebf75b84fbe4671c5c67318a87628069b5882c295b553ed36a81a000000004a493046022100e8789bad3b29f69ea24fa2faf113e111eec6f8688c348be9165c6a6005a257c30221008995bd09cddd4dbbdc9e8da9c00f48ffbdfcc3d7b194fbb23bb42a9a85cac4be01ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000",
    "complete" : true
}

(NODE A)
$ sendrawtransaction 0100000001123afadce27ebf75b84fbe4671c5c67318a87628069b5882c295b553ed36a81a000000004a493046022100e8789bad3b29f69ea24fa2faf113e111eec6f8688c348be9165c6a6005a257c30221008995bd09cddd4dbbdc9e8da9c00f48ffbdfcc3d7b194fbb23bb42a9a85cac4be01ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000
45e6933a419d471b4ee18e7e3c82993f49e92289fc598454f20ef3edb7d4d4f1

However, if I do a very similar process, except doing the last part on the second machine, it fails.

(NODE A)
$ createrawtransaction '[{"txid":"043c11224a805a75d7b3342fb9be5abf5a34e146beccbc1b066b26cfb37bc714", "vout":0}]' '{"mfb33SCwSxuisQnPzhthgkDyDAu89QE66u":49}'
010000000114c77bb3cf266b061bbcccbe46e1345abf5abeb92f34b3d7755a804a22113c040000000000ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000

(NODE A)
$ signrawtransaction 010000000114c77bb3cf266b061bbcccbe46e1345abf5abeb92f34b3d7755a804a22113c040000000000ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000
{
    "hex" :  "010000000114c77bb3cf266b061bbcccbe46e1345abf5abeb92f34b3d7755a804a22113c04000000004847304402204f17daa828ab1ad36c163d5f2f8fed698f7a710af36c985fd10f65b1b310c217022015725d228ca257109881fc1b52aaf44e5fa333b5441102e9464f1e86f57a30fd01ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000",
    "complete" : true
}

(NODE B)
$ sendrawtransaction 010000000114c77bb3cf266b061bbcccbe46e1345abf5abeb92f34b3d7755a804a22113c04000000004847304402204f17daa828ab1ad36c163d5f2f8fed698f7a710af36c985fd10f65b1b310c217022015725d228ca257109881fc1b52aaf44e5fa333b5441102e9464f1e86f57a30fd01ffffffff0100111024010000001976a91400c5a092d0f915b13f3737cd2b5f7d585b42c18c88ac00000000
error: {"code":-22,"message":"TX rejected"}

Note: It seems like it will work if I do the create on NODE B as well. So the machine that does createrawtransaction has to be the same one that does the sendrawtransaction, even if it isn't the one that does the signing?

EDIT: It seems to be the case, consistently, that the node that did the createrawtransaction can do the sendrawtransaction without fail. Why is this the case?


It seems that part of the problem may have been that I didn't set allowhighfees=true. Doesn't explain why the two above cases had this problem, though, because those two transactions had the same input and output amounts.

-2

The problem is when you createrawtransaction it never gets transmitted/relayed to the network. If you look at the bitcoin wiki for the rawtransaction you can see:

createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...} Create a transaction spending given inputs (array of objects containing transaction outputs to spend), sending to given address(es). Returns the hex-encoded transaction in a string. Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.

same with signrawtransaction, it signs the create transacition that is stored in the leveldb or whatever db bitcoin uses but is not transmitted to the network.

Only when you issue the command sendrawtransaction does the signed transaction get transmitted to the peers.

Hope I answered your question!

  • 1
    I don't think this answers the question. The OP knows that sendrawtransaction is a separate step. The part that's strange is that it seems to make a difference whether sendrawtransaction is executed on the same machine as createrawtransaction or another one. – Nate Eldredge Nov 8 '14 at 15:19
  • @Nate is right, this doesn't answer my question. – morsecoder Nov 8 '14 at 15:22
  • 1
    @MaratArguinbaev, I have read your answer through multiple times now, and it was not me who down-voted your answer. If you read my question again, you will see that your response actually doesn't answer it. This was probably why someone down-voted it, because it doesn't answer the question. The problem is that the sendrawtransaction call fails when done on a node that did not also do the createrawtransaction call, previously. – morsecoder Nov 11 '14 at 16:39

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.