比特币 P2PKH 签名过程抛出 mandatory-script-verify-flag-failed(脚本失败 OP_EQUALVERIFY 操作)

Bitcoin P2PKH signing process throws mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation)

我正在尝试签署并广播 regtest P2PKH 交易。

前一个交易十六进制:

020000000001035a2fd7d9b2dfb25b03c3e602f652bd724db07acab3fd3eb1de68f7ad2f4694140000000000feffffff521441c610969652ba7cb017ce7db0731138013122b47aac1ce8caaa5e1fce190000000000feffffffa77a07589d12ceedaa27929b13654c2ca41e43ef1042d57f1f01e9efb65195d9000000006a47304402207212c1279c7e63439ec5ddc86ae6ac0faa13379af904791e1084a90d7b81638502204efae464a34cdf6125ea472540097de23930ce168b968b2850da5e3f761a9c5d012102e1ab11484eaa09e1955fe640a2e884b2900497428a895688ef586799b1f1ff1ffeffffff0200ca9a3b000000001976a91448bd61c0dcb03018ee6604f5b32edab07975e61688ac88f59505000000001976a914a8bb4f75fac6c10972b4c060a65efacead543be788ac0247304402202da78e9e1d4fec03a0b326f5b80db6446209d64d2138df1f0dc303b9454020250220216513e81182d2508aa1e0d036ddb4973170926a9f7e2237e4bb2eed621689a3012102b0dc39ccb8aea237695913d390a72d322b47eb6dda61c216a4ff1a3d06bac49402473044022039cfa24798c991e6b373772c5cadae6b898a680e78b9fd55b27225a3ed8ce7fe02205dddda9430c7d86a27a877ca77c99f563bca574565613d242f434673e662fe93012103188f0e4cc8aa6e88966b3fcb20494deaa771aeae6828241e00af852fb228f8080000000000

新交易十六进制:

0100000001beabc86499ccbefa281da4ea818be45b05dcc4df55ecbb15199b5ce4e3013409000000006a47304402201b494b019df0b380331fdb728d67e61f95657d2f411fdf105c2a47411f72cb780220753560b7f00f60ab3ad53640efa325b34b3ef991392261a13d9886492228a8960121039355776cdc3015a62d7a5d206003c5b4d754f2de3a2d9358114df3d0b1ec743bffffffff0100e1f505000000001976a914bef5a2f9a56a94aab12459f72ad9cf8cf19c7bbe88ac00000000

当我尝试 sendrawtransaction 它抛出一个:

mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation)

我不明白这个错误,但我已经研究并发现了这个:https://bitcoin.stackexchange.com/questions/84287/bitcoin-script-mandatory-script-verify-flag-failed-script-failed-an-op-equalver

按照提示,我尝试了 btcdeb:

btcdeb --txin=020000000001035a2fd7d9b2dfb25b03c3e602f652bd724db07acab3fd3eb1de68f7ad2f4694140000000000feffffff521441c610969652ba7cb017ce7db0731138013122b47aac1ce8caaa5e1fce190000000000feffffffa77a07589d12ceedaa27929b13654c2ca41e43ef1042d57f1f01e9efb65195d9000000006a47304402207212c1279c7e63439ec5ddc86ae6ac0faa13379af904791e1084a90d7b81638502204efae464a34cdf6125ea472540097de23930ce168b968b2850da5e3f761a9c5d012102e1ab11484eaa09e1955fe640a2e884b2900497428a895688ef586799b1f1ff1ffeffffff0200ca9a3b000000001976a91448bd61c0dcb03018ee6604f5b32edab07975e61688ac88f59505000000001976a914a8bb4f75fac6c10972b4c060a65efacead543be788ac0247304402202da78e9e1d4fec03a0b326f5b80db6446209d64d2138df1f0dc303b9454020250220216513e81182d2508aa1e0d036ddb4973170926a9f7e2237e4bb2eed621689a3012102b0dc39ccb8aea237695913d390a72d322b47eb6dda61c216a4ff1a3d06bac49402473044022039cfa24798c991e6b373772c5cadae6b898a680e78b9fd55b27225a3ed8ce7fe02205dddda9430c7d86a27a877ca77c99f563bca574565613d242f434673e662fe93012103188f0e4cc8aa6e88966b3fcb20494deaa771aeae6828241e00af852fb228f8080000000000 --tx=0100000001beabc86499ccbefa281da4ea818be45b05dcc4df55ecbb15199b5ce4e3013409000000006a47304402201b494b019df0b380331fdb728d67e61f95657d2f411fdf105c2a47411f72cb780220753560b7f00f60ab3ad53640efa325b34b3ef991392261a13d9886492228a8960121039355776cdc3015a62d7a5d206003c5b4d754f2de3a2d9358114df3d0b1ec743bffffffff0100e1f505000000001976a914bef5a2f9a56a94aab12459f72ad9cf8cf19c7bbe88ac00000000

输出:

script                                                             |  stack 
-------------------------------------------------------------------+--------
304402201b494b019df0b380331fdb728d67e61f95657d2f411fdf105c2a474... | 
039355776cdc3015a62d7a5d206003c5b4d754f2de3a2d9358114df3d0b1ec743b | 
<<< scriptPubKey >>>                                               | 
OP_DUP                                                             | 
OP_HASH160                                                         | 
48bd61c0dcb03018ee6604f5b32edab07975e616                           | 
OP_EQUALVERIFY                                                     | 
OP_CHECKSIG                                                        | 
#0000 304402201b494b019df0b380331fdb728d67e61f95657d2f411fdf105c2a47411f72cb780220753560b7f00f60ab3ad53640efa325b34b3ef991392261a13d9886492228a89601

我 运行 没有想法,这就是为什么我需要你的帮助。

编辑:

我的错误是使用非比特币工具将我的 dumpprivkey 从 base58 转换为十六进制。一些非比特币工具不会删除第一个字节和校验和,因此私钥被更​​改。

-> https://github.com/matja/bitcoin-tool
-> https://bitcoin.stackexchange.com/questions/52951/how-to-get-the-private-key-in-hex-from-the-output-of-dumpprivkey

您正在使用的 public 密钥 039355776cdc3015a62d7a5d206003c5b4d754f2de3a2d9358114df3d0b1ec743b 具有 b8e4fdb2bfa5a1cb796232ded6580c9ab52ffbb3.

的 HASH160 摘要

由于您在脚本中提供的 HASH160 与堆栈中评估的不同,因此无法通过相等验证操作。