segregated witness – Error broadcasting SegWit transaction

0
65


I’ve this testnet transaction that I created:

Model: 01000000
Marker: 00
Flag: 01
Enter Rely: 01
    Enter #1 TXID: 42a752fe4ebd0bdc69cb1b3724de6ccc364661028ab9c043526f3f7cb0571147
    Enter #1 VOUT: 00000000
    Enter #1 ScriptSize: 00
    Enter #1 ScriptSig:
    Enter #1 Sequence: ffffffff
Output Rely: 01
    Output Worth: e8fd000000000000
    Output Script Size:16
    Output Script: 00143778e5361fdad0d209de8a16c2ec4ca64618993e
Witness:
    Witness Stack Measurement: 02
    Witness Signature Size: 47
    Witness Signature: 304402204af85395dd8c758ac379c343bc278351f73cdf9d8548d933aada5fa4e13194a80220126c0614f75520709e63ac41 9308344c00a4a22c021e1b9d8b42115aa73e37b01
    Witness PubKey Size: 21
    Witness PubKey: 02ad2a42eed9fecc022093e8682b62b034690b06587be18f01bb8e60df1afeaaf8
Locktime: 00000000

When I attempt to broadcast it, it offers me this error:

Mempool settle for check failed: 64: non-mandatory-script-verify-flag (Signature have to be zero for failed CHECK(MULTI)SIG operation)

I imagine this error happens as a result of the signature is wrong, however I’m having a tough time figuring out how I created the improper signature.

Listed below are the steps I took to signal the transaction:

Signal the hash of the next with the signing key:
1. Transaction model (4 bytes little endian)
2. The hash of all enter outpoints (32 bytes)
3. The hash of all enter sequences (32 bytes)
4. The outpoint (32 + 4 bytes)
5. The script code (26 bytes consisting of 0x1976a914<20 byte pub key hash>88ac)
6. The worth of the enter being signed (8 bytes little endian)
7. The sequence of the enter being signed (4 byte little endian)
8. The hash of all of the outputs (32 byte)
9. The locktime of the transaction (4 bytes little endian)
10. Sighash kind (4 bytes little endian)

this signature was then used at the side of the Public key of the signing key to create the Witness script as seen above.

Right here is the information I used to create the transaction:

Enter #1:
    txid: 471157b07c3f6f5243c0b98a02614636cc6cde24371bcb69dc0bbd4efe52a742
    out: 0
    signing key wif: 3a8c0c731cba400917f66bc3435a405387a9a5b20cdbfdedb19e37d0c6cad8b9

Output #1
    worth: 65000
    recipient: tb1qxauw2dslmtgdyzw73gtv9mzv5erp3xf7mt83vq

LEAVE A REPLY

Please enter your comment!
Please enter your name here