Regtest
錯誤:帶有 OP_CHECKSEQUENCEVERIFY (OP_CSV) 的非強制腳本驗證標誌(未知錯誤)(程式碼 64)
我正在嘗試使用 OP_CSV 在 regtest 網路上實現相對時間鎖定,並在嘗試使用鎖定的 BTC 時不斷收到此錯誤。
我正在使用 scriptPubKey 創建一個 UTXO,因為
10 OP_CHECKSEQUENCEVERIFY OP_DROP
它允許任何人在自此交易以來將 10 個塊添加到鏈中後使用它。為了解鎖(消費)這個 UTXO,scriptSig 應該是
OP_TRUE
為了成功的腳本驗證。(不需要簽名,因為沒有OP_CHECKSIG
)同樣在解鎖事務中,我
nSequence = 10
為此輸入設置,其中 10 是它被鎖定的塊數。它是否正確?我哪裡錯了?
我正在使用以下步驟實現這一點:
Bitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65 Block count: 503 UTXO being locked: { "txid": "19136e437bd506d688ced7abbb1e5e17bebb7f0aeb76c179ffd1a6feedd1adf7", "vout": 1, "address": "mkdCEMwvG7tmRLrpgVyKn2gVy6keGwkpWV", "label": "", "scriptPubKey": "76a9143806c21703f0e59cff6659b05fbd9c7b18de257b88ac", "amount": 124.00000000, "confirmations": 1, "spendable": true, "solvable": true, "desc": "pkh([4f42f41a/0'/0'/1']02bc24fa178154b7db3443b6b10454d21551efde08113ff3fe42004cd78100eb74)#0etyma69", "safe": true } Locking raw transaction (Signed and sent): Hex: 0200000001f7add1edfea6d1ff79c176eb0a7fbbbe175e1ebbabd7ce88d606d57b436e1319010000006a47304402203c59eb369d8d4f1a14a1e8b3a298cf548cb83408fd8f1557169b006078fd738002206a8b1868f361644f2ff8e29c211443116e7afd62913d9c432555c555637551bd012102bc24fa178154b7db3443b6b10454d21551efde08113ff3fe42004cd78100eb74ffffffff01f0d418e30200000006030a0000b27500000000 Decoded: { "txid": "f0df2904c0f7f806e5992a72ddccfe5873f50ac7da45397f1544b8ff72c791ee", "hash": "f0df2904c0f7f806e5992a72ddccfe5873f50ac7da45397f1544b8ff72c791ee", "version": 2, "size": 172, "vsize": 172, "weight": 688, "locktime": 0, "vin": [ { "txid": "19136e437bd506d688ced7abbb1e5e17bebb7f0aeb76c179ffd1a6feedd1adf7", "vout": 1, "scriptSig": { "asm": "304402203c59eb369d8d4f1a14a1e8b3a298cf548cb83408fd8f1557169b006078fd738002206a8b1868f361644f2ff8e29c211443116e7afd62913d9c432555c555637551bd[ALL] 02bc24fa178154b7db3443b6b10454d21551efde08113ff3fe42004cd78100eb74", "hex": "47304402203c59eb369d8d4f1a14a1e8b3a298cf548cb83408fd8f1557169b006078fd738002206a8b1868f361644f2ff8e29c211443116e7afd62913d9c432555c555637551bd012102bc24fa178154b7db3443b6b10454d21551efde08113ff3fe42004cd78100eb74" }, "sequence": 4294967295 } ], "vout": [ { "value": 123.99990000, "n": 0, "scriptPubKey": { "asm": "10 OP_CHECKSEQUENCEVERIFY OP_DROP", "hex": "030a0000b275", "type": "nonstandard" } } ] } Block count: 504 Unlocking raw transaction: Hex: 0200000001ee91c772ffb844157f3945dac70af57358feccdd722a99e506f8f7c00429dff00000000001510a00000001c0b909e3020000001976a914b849d945ca598e6b3ea0a062ce41e5006cc5108588ac00000000 Decoded: { "txid": "4c41b8f007aba1b4e76f94e63017620d1ed09460a9cf18fb5f345848a48b0ead", "hash": "4c41b8f007aba1b4e76f94e63017620d1ed09460a9cf18fb5f345848a48b0ead", "version": 2, "size": 86, "vsize": 86, "weight": 344, "locktime": 0, "vin": [ { "txid": "f0df2904c0f7f806e5992a72ddccfe5873f50ac7da45397f1544b8ff72c791ee", "vout": 0, "scriptSig": { "asm": "1", "hex": "51" }, "sequence": 10 } ], "vout": [ { "value": 123.99000000, "n": 0, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 b849d945ca598e6b3ea0a062ce41e5006cc51085 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914b849d945ca598e6b3ea0a062ce41e5006cc5108588ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "mxKP6T3nHhYj7eiq1wHf7pvtJeM7WmuFiE" ] } } ] } When I try to broadcast this transaction (using sendrawtransaction) it returns the error: non-BIP68-final (code 64) Which is what I expected since 10 blocks have not been mined since the creation of the UTXO. Generation 10 blocks... Block count: 514 When I try to broadcast now it gives me: non-mandatory-script-verify-flag (unknown error) (code 64)
提前致謝。
PS我對比特幣開發很陌生,如果這是一個明顯的問題,我深表歉意。
當我使用
OP_10
而不是030a0000
將數字 10 壓入堆棧時,該錯誤得到解決。比特幣似乎優化了腳本的大小。因此,要將任何數字從 2 推到 16,應該使用 OP_2 - OP_16,對於大於 16 的數字,我們應該在腳本中給出所需的最小字節數。例如OP_10 (5a) -> Correct 01 0a -> non-mandatory-script-verify-flag (Data push larger than necessary) 02 0a00 -> non-mandatory-script-verify-flag (unknown error)
彈出該錯誤以確保您的節點中繼的事務是標準的。由於您花費的交易輸出不是標準的,您會看到 non-mandatory-script-verify-flag 錯誤。目前 P2PKH、P2SH、P2WPKH、P2WSH、P2PK、裸多重簽名和空數據是標準輸出。這避免了下游使用者在升級和未升級節點之間拆分網路,以及升級節點禁止未升級節點中繼非標準事務。您可以在此處找到彈出錯誤的程式碼。