Bitcoin-Core

P2SH-P2WPKH 支出的signrawtransaction 似乎被破壞了?

  • January 26, 2018

我正在嘗試使用比特幣核心的 RPC 命令在測試網上花費 SegWit 輸出。無需將私鑰導入我的錢包(即沒有添加見證地址)。我想知道是否有人有幸以這種方式使用 SegWit 輸出?也許在這種情況下, signrawtransaction被破壞了?這是命令和我的結果。奇怪的是,即使signrawtransaction本身是成功的,該交易也是無效的(被sendrawtransaction拒絕,並且在我試圖推送它時也被區塊瀏覽器拒絕)。

(請注意:每次我將密鑰導入錢包並執行“addwitnessaddress”時,一切正常)。

./bitcoin-cli -testnet createrawtransaction '[{"txid":"03a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0117","vout":0}]' '{"mwCwTceJvYV27KXBc3NJZys6CjsgsoeHmf":0.8}'

020000000117017d17e296b4cd41cd63758bff8aadf214410505ccaeddb4252579ccffa4030000000000ffffffff0100b4c404000000001976a914ac19d3fd17710e6b9a331022fe92c693fdf6659588ac00000000

./bitcoin-cli -testnet signrawtransaction 020000000117017d17e296b4cd41cd63758bff8aadf214410505ccaeddb4252579ccffa4030000000000ffffffff0100b4c404000000001976a914ac19d3fd17710e6b9a331022fe92c693fdf6659588ac00000000’[{“TxID添加”:“03a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0117”,“VOUT”:0“,scriptPubKey”:“a91421ce1507d06ed2742be0bf18a018bbcdd812a26487”,“redeemScript”:“00149835f2e0dff9d7f6a4060140696bc7e00b12edd5”}]’’[“cMahea7zqjxryy6NWaKxmhDyb1JzuNKCZAg8sxaJoXSBkRXjnib9”] '

{“十六進制”:“0200000000010117017d17e296b4cd41cd63758bff8aadf214410505ccaeddb4252579ccffa40300000000171600149835f2e0dff9d7f6a4060140696bc7e00b12edd5ffffffff0100b4c404000000001976a914ac19d3fd17710e6b9a331022fe92c693fdf6659588ac024730440220452a58cf56c45edaffb952acccd2f6f2cea523cf82e73b82f8eb5e3b3b1b17c4022011de26884cf693b12f16fdd8fa6c1d96dacb97050907353852895d9b80b3fae101210206f4bad90006f70112129815b25ba585484f1bb4f8b88f8ebaec2c76f543794300000000”,“完整”:真正}

./bitcoin-cli -testnet sendrawtransaction 0200000000010117017d17e296b4cd41cd63758bff8aadf214410505ccaeddb4252579ccffa40300000000171600149835f2e0dff9d7f6a4060140696bc7e00b12edd5ffffffff0100b4c404000000001976a914ac19d3fd17710e6b9a331022fe92c693fdf6659588ac024730440220452a58cf56c45edaffb952acccd2f6f2cea523cf82e73b82f8eb5e3b3b1b17c4022011de26884cf693b12f16fdd8fa6c1d96dacb97050907353852895d9b80b3fae101210206f4bad90006f70112129815b25ba585484f1bb4f8b88f8ebaec2c76f543794300000000

錯誤程式碼:-26 錯誤消息:64:非強制腳本驗證標誌(簽名必須為零失敗的 CHECK(MULTI)SIG 操作)

在你使用之前,錢包不知道如何簽署隔離見證的東西addwitnessaddress。這是因為它只跟踪該密鑰的 P2PKH 輸出。您必須明確告訴它使用addwitnessaddress.

amount給signrawtransaction的utxo中缺少問題。我在最後附上了欄位:

signrawtransaction  
020000000117017d17e296b4cd41cd63758bff8aadf214410505ccaeddb4252579ccffa4030000000000ffffffff0100b4c404000000001976a914ac19d3fd17710e6b9a331022fe92c693fdf6659588ac00000000  
'[{"txid":"03a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0117","vout":0,"scriptPubKey":"a91421ce1507d06ed2742be0bf18a018bbcdd812a26487","redeemScript":"00149835f2e0dff9d7f6a4060140696bc7e00b12edd5","amount":0.85}]' 
'["cMahea7zqjxryy6NWaKxmhDyb1JzuNKCZAg8sxaJoXSBkRXjnib9"]'

花在59fdf1c39236498debdab39302e57b370e0e4d94d856d52d923868cfe5ef4f1b

引用自:https://bitcoin.stackexchange.com/questions/59443