如何引發 bad-txns-vout-negative 錯誤?
我想複製這個
bad-txns-vout-negative error
場景。我嘗試了以下但僅獲得“超出範圍的金額”:這是我嘗試過的命令:
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
<https://en.bitcoin.it/wiki/Protocol_documentation#Transaction_Verification> 上面的連結幫助我實現了這個場景。
原raw_tx:020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302000000001976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000
020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41 FFFFFFFF 02 10270000億 - 10 27 00 00 00 00 00 00 - 00002710 - 六角O十進制 - 10000 * 0.00000001 = 0.0001 19 76a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac 70e4530200000000 - 70 E4 53 02 00 00 00 00 - 0253e470 - 十六進制小數 - 39052400 * 0.00000001 = 0.390524 19 76a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac 00000000
這個錯誤方案所需最終raw_tx:020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302ffffffff1976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000
正如您在上面看到的,我只是將八個零替換為八個 f。
該
createrawtransaction
命令將對參數進行完整性檢查,如果值不是andAmount out of range
則返回錯誤,這樣您就不會自責。>= 0``<= 21000000 * 10e7
您需要自己製作無效的,您可以在功能測試套件(使用 python-bitcoinlib)中查看您正在嘗試實現的精確範例。