Related eBooks

I have this testnet transaction that I created:

Version: 01000000
Marker: 00
Flag: 01
Input Count: 01
    Input #1 TXID: 42a752fe4ebd0bdc69cb1b3724de6ccc364661028ab9c043526f3f7cb0571147
    Input #1 VOUT: 00000000
    Input #1 ScriptSize: 00
    Input #1 ScriptSig:
    Input #1 Sequence: ffffffff
Output Count: 01
    Output Value: e8fd000000000000
    Output Script Length:16
    Output Script: 00143778e5361fdad0d209de8a16c2ec4ca64618993e
Witness:
    Witness Stack Size: 02
    Witness Signature Length: 47
    Witness Signature: 304402204af85395dd8c758ac379c343bc278351f73cdf9d8548d933aada5fa4e13194a80220126c0614f75520709e63ac41 9308344c00a4a22c021e1b9d8b42115aa73e37b01
    Witness PubKey Length: 21
    Witness PubKey: 02ad2a42eed9fecc022093e8682b62b034690b06587be18f01bb8e60df1afeaaf8
Locktime: 00000000

When I try to broadcast it, it gives me this error:

Mempool accept test failed: 64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)

I believe this error occurs because the signature is incorrect, but I am having a hard time identifying how I created the wrong signature.

Here are the steps I took to sign the transaction:

Sign the hash of the following with the signing key:
1. Transaction version (4 bytes little endian)
2. The hash of all input outpoints (32 bytes)
3. The hash of all input 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 value of the input being signed (8 bytes little endian)
7. The sequence of the input being signed (4 byte little endian)
8. The hash of all the outputs (32 byte)
9. The locktime of the transaction (4 bytes little endian)
10. Sighash type (4 bytes little endian)

this signature was then used in conjunction with the Public key of the signing key to create the Witness script as seen above.

Here is the info I used to create the transaction:

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

Output #1
    value: 65000
    recipient: tb1qxauw2dslmtgdyzw73gtv9mzv5erp3xf7mt83vq

source

By pplny

답글 남기기

이메일 주소는 공개되지 않습니다.

Translate »