Error message "mandatory-script-verify-flag-failed" when constructing a SigHash SINGLE | ANY transaction

One of the main possibilities that SigHash SINGLE | ANY (0x83) has, is to combine two or more transactions with this particular flag into one (Modularity).

That's the theory, but when it comes to practice, it is not working (at least for me); Let me explain:

I created this two transactions in testnet4, both spending only one input and sending it to only one output, both P2PKH:

Transaction 1:

0100000001bd20399c1f2d841f1e147ad2e03df1635f48fc5b8cdbb55ea3a86b14225e2743000000006a4730440220435c5161232d1b3215c44169f7c0328f1af1d40b4a8f2ec16795f442e9b80f7e022047fd3dd15421d2a0956a79e2141f3a72d2fe69c4e6c5bcc75047bd6d8bf019f5832102313b35fdf7af967980d29e684c508c90e11d99b10cab20ef477c9e63d9bf7bf7ffffffff0158980000000000001976a914c103e57c094061209b419e5ca559704a8a22f3f988ac00000000

Transaction 2:

0100000001d38e64afa39dd966f96e07bf56ae44bc3d402630771480f461389edff8a0051e010000006a4730440220645a7a25ebb00194a3b2f940d5618d021f513c2dd9bdc0504f623824e9845d8e0220077af01808e98b7ca97d2927243f9beb8cbd48e85d07dde26ea46c2e79d6c2ee832102e90fb489e28444cdfd85057fcce5f6d6ab1ba525acf570a7ffa355dbb7f21162ffffffff0128a00000000000001976a914d80f48340dd7ee6c7fae287342d3eeb1d4d887e288ac00000000

Then, I have combined them into one, making sure that outputs are in the correct index position:

0100000002bd20399c1f2d841f1e147ad2e03df1635f48fc5b8cdbb55ea3a86b14225e2743000000006a4730440220435c5161232d1b3215c44169f7c0328f1af1d40b4a8f2ec16795f442e9b80f7e022047fd3dd15421d2a0956a79e2141f3a72d2fe69c4e6c5bcc75047bd6d8bf019f5832102313b35fdf7af967980d29e684c508c90e11d99b10cab20ef477c9e63d9bf7bf7ffffffffd38e64afa39dd966f96e07bf56ae44bc3d402630771480f461389edff8a0051e010000006a4730440220645a7a25ebb00194a3b2f940d5618d021f513c2dd9bdc0504f623824e9845d8e0220077af01808e98b7ca97d2927243f9beb8cbd48e85d07dde26ea46c2e79d6c2ee832102e90fb489e28444cdfd85057fcce5f6d6ab1ba525acf570a7ffa355dbb7f21162ffffffff0258980000000000001976a914c103e57c094061209b419e5ca559704a8a22f3f988ac28a00000000000001976a914d80f48340dd7ee6c7fae287342d3eeb1d4d887e288ac00000000

When I verify the signatures with a code that I created (that also reconstructs the Hash-Preimage of each one; I have checked that the Hash-Preimage reconstructed for each input, is the same one as the Hash-Preimage of the transaction separately), the signatures are valid.

But when I try to broadcast it, the following error message appears: (code 26) Failed to broadcast transaction, reason: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)

What could be happening?



from Recent Questions - Bitcoin Stack Exchange https://ift.tt/RYV2egb
via IFTTT

Popular posts from this blog

Do Kwon’s Detention Prolonged Until 2024 As Montenegro Responds To Extradition Requests

Sam Bankman-Fried Trial Begins Tomorrow: 3 Reasons Ex-SEC Official Foresees Conviction

April’s Crypto Game-Changers: 7 Events Set To Drastically Impact The Course Of Digital Currencies