1

I wanted to replicate the bad-txns-vout-negative error scenario. I tried the following but getting 'Amount out of range' only:

Here is the command i tried:

bitcoin-cli -named createrawtransaction inputs="[{\"txid\":\"af7cc9204d0ab7d52f66a5dacb79b77c34c90013e3288a391557ee8e07c3c307\",\"vout\":"0"}]" outputs="{\"data\": \"6e636861696e20626974636f696e207361746f73686920766973696f6e\",\"myTmAe67rCuJU5X1fqKiEYohb53TEQrxP3\": 6.249996,\"mt8QSx6m6Fwqt8zMVcji16UiVYS8xYRwFi\": -0.001000}"
error code: -3
error message:
Amount out of range

2 Answers 2

1

The createrawtransaction command will do a sanity check of the arguments and return the Amount out of range error if the value is not >= 0 and <= 21000000 * 10e7, so that you don't shoot yourself in the foot.

You need to craft the invalid on your own, you can see an example of precisely what you are trying to achieve in the functional test suite (which uses python-bitcoinlib).

0

https://en.bitcoin.it/wiki/Protocol_documentation#Transaction_Verification The above link helped me in achieving the scenario.

Original raw_tx: 020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302000000001976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000

020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41 ffffffff 02 1027000000000000 - 10 27 00 00 00 00 00 00 - 00002710 - hex o decimal - 10000 * 0.00000001 = 0.0001 19 76a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac 70e4530200000000 - 70 e4 53 02 00 00 00 00 - 0253e470 - hex to decimal - 39052400 * 0.00000001 = 0.390524 19 76a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac 00000000

Final raw_tx required for this error scenario: 020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302ffffffff1976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000

As you can see above that I just replaced eight zeroes to eight f's.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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