<p>The signature is 72 bytes long, but the signature witness item is prepended with the byte <code>0x47</code> (71), not <code>0x48</code> (72). The decoder then interprets the last byte of the signature (the sighash flag, <code>0x01</code>) as the length of the second witness item, and parses it as <code>0x21</code>. The next 4 bytes (<code>0x02c430ac</code>, converted to decimal as 2888877058) are interpreted as the locktime, and that's where the transaction is supposed to end. Apparently BlockCypher silently ignores any remaining bytes.</p>
<p>If you replace the <code>0x47</code> byte with <code>0x48</code>, the transaction will decode correctly.</p>

CC BY-SA 4.0
2024-02-09T17:19:14.220Z
2024-02-09T17:24:53.653Z
2024-02-09T17:24:53.653Z
Vojtěch Strnad
<p>Type of transaction:
p2wpkh transaction creating a multisig (p2wsh) on signet.</p>
<p>Error:TX must have atleast one inputs.</p>
<p>Output on online decoder</p>
<pre><code>{
    &quot;addresses&quot;: [
        &quot;tb1q94nuuw96ye4x3u8hc3nga8g02kzvdknug49ucgmgh70l7yqn29ts56cl57&quot;,
        &quot;tb1q6ajhfx4xvscts4m9hhk7ujy0tl3us25wu97pkv&quot;
    ],
    &quot;block_height&quot;: -1,
    &quot;block_index&quot;: -1,
    &quot;confirmations&quot;: 0,
    &quot;double_spend&quot;: false,
    &quot;fees&quot;: 0,
    &quot;hash&quot;: &quot;0fa2e7ac35739d727d1298922906127cdfe04040b98051f06314dc137d319a41&quot;,
    &quot;inputs&quot;: [
        {
            &quot;age&quot;: 0,
            &quot;output_index&quot;: 365,
            &quot;prev_hash&quot;: &quot;e748d035309c2f7312176789f6fbe77a20582733817ed66b19fc675bfc1c4208&quot;,
            &quot;script_type&quot;: &quot;empty&quot;,
            &quot;sequence&quot;: 4294967295
        }
    ],
    &quot;lock_time&quot;: 2888877058,
    &quot;outputs&quot;: [
        {
            &quot;addresses&quot;: [
                &quot;tb1q94nuuw96ye4x3u8hc3nga8g02kzvdknug49ucgmgh70l7yqn29ts56cl57&quot;
            ],
            &quot;script&quot;: &quot;00202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157&quot;,
            &quot;script_type&quot;: &quot;pay-to-witness-script-hash&quot;,
            &quot;value&quot;: 1000000
        },
        {
            &quot;addresses&quot;: [
                &quot;tb1q6ajhfx4xvscts4m9hhk7ujy0tl3us25wu97pkv&quot;
            ],
            &quot;script&quot;: &quot;0014d765749aa66430b85765bdedee488f5fe3c82a8e&quot;,
            &quot;script_type&quot;: &quot;pay-to-witness-pubkey-hash&quot;,
            &quot;value&quot;: 8093449
        }
    ],
    &quot;preference&quot;: &quot;low&quot;,
    &quot;received&quot;: &quot;2024-02-09T10:13:35.159062502Z&quot;,
    &quot;relayed_by&quot;: &quot;3.235.156.159&quot;,
    &quot;size&quot;: 202,
    &quot;total&quot;: 9093449,
    &quot;ver&quot;: 2,
    &quot;vin_sz&quot;: 1,
    &quot;vout_sz&quot;: 2,
    &quot;vsize&quot;: 145
}
</code></pre>
<p>Manual decoding</p>
<pre><code>nVersion
02000000

marker
00

flag
01

txin
01
08421cfc5b67fc196bd67e81332758207ae7fbf689671712732f9c3035d048e7 // 32 bytes (txid reversed little endian)
6d010000
00
ffffffff

txout
02
40420f0000000000 
22 00202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157 // 34 bytes script  
097f7b0000000000
16 0014d765749aa66430b85765bdedee488f5fe3c82a8e // scriptpubkey for change

witness
02
473045022100a5faff9808555961e9ff213550b365ef86b993e07116fe445f27594f96f8798c022067571f9e0050f6c7e50057dd0e628613dffe1b573f48697019b6aa0fe97d658e01
2102c430ac1cb8ea090e63d171df5502ed5815ba579c6b38dd13e069e96816e4d247

nLocktime
00000000
</code></pre>
<p>Output of an accepted transaction</p>
<pre><code>{
    &quot;addresses&quot;: [
        &quot;tb1qzeuvnr6u39npxdaxmhhxwwn68w5rplwet350nr&quot;,
        &quot;tb1qk3qesjjnpztf2fs3r80haq9uddnw495f96w9tk5mdxyz8htuxu9qcwcurs&quot;
    ],
    &quot;block_height&quot;: -1,
    &quot;block_index&quot;: -1,
    &quot;confirmations&quot;: 0,
    &quot;double_spend&quot;: false,
    &quot;fees&quot;: 0,
    &quot;hash&quot;: &quot;33128f3a32d65c30f5bb4d4c2419f4c4e5c9c601e091c180e17592bda0ad10b3&quot;,
    &quot;inputs&quot;: [
        {
            &quot;age&quot;: 0,
            &quot;output_index&quot;: 0,
            &quot;prev_hash&quot;: &quot;71e6a41254dc239a285e5cbf5cded15e099e18989b10ee10e23daed9e5fe052f&quot;,
            &quot;script_type&quot;: &quot;empty&quot;,
            &quot;sequence&quot;: 4294967295
        }
    ],
    &quot;outputs&quot;: [
        {
            &quot;addresses&quot;: [
                &quot;tb1qk3qesjjnpztf2fs3r80haq9uddnw495f96w9tk5mdxyz8htuxu9qcwcurs&quot;
            ],
            &quot;script&quot;: &quot;0020b441984a53089695261119df7e80bc6b66ea96892e9c55da9b698823dd7c370a&quot;,
            &quot;script_type&quot;: &quot;pay-to-witness-script-hash&quot;,
            &quot;value&quot;: 1000000
        },
        {
            &quot;addresses&quot;: [
                &quot;tb1qzeuvnr6u39npxdaxmhhxwwn68w5rplwet350nr&quot;
            ],
            &quot;script&quot;: &quot;00141678c98f5c89661337a6ddee673a7a3ba830fdd9&quot;,
            &quot;script_type&quot;: &quot;pay-to-witness-pubkey-hash&quot;,
            &quot;value&quot;: 888318652
        }
    ],
    &quot;preference&quot;: &quot;low&quot;,
    &quot;received&quot;: &quot;2024-02-09T10:17:43.206930294Z&quot;,
    &quot;relayed_by&quot;: &quot;18.213.115.114&quot;,
    &quot;size&quot;: 235,
    &quot;total&quot;: 889318652,
    &quot;ver&quot;: 2,
    &quot;vin_sz&quot;: 1,
    &quot;vout_sz&quot;: 2,
    &quot;vsize&quot;: 153
}
</code></pre>
<p>Raw transaction</p>
<pre><code>0200000000010108421cfc5b67fc196bd67e81332758207ae7fbf689671712732f9c3035d048e76d01000000ffffffff0240420f00000000002200202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157097f7b0000000000160014d765749aa66430b85765bdedee488f5fe3c82a8e02473045022100a5faff9808555961e9ff213550b365ef86b993e07116fe445f27594f96f8798c022067571f9e0050f6c7e50057dd0e628613dffe1b573f48697019b6aa0fe97d658e012102c430ac1cb8ea090e63d171df5502ed5815ba579c6b38dd13e069e96816e4d24700000000
</code></pre>

<bitcoin-core><bitcoin-cli><raw-transaction><blockcypher>
Raw Transaction decoding fails on signet but decodes fine in BlockCypher decoder
Prabhat Verma
# Raw Transaction decoding fails on signet but decodes fine in BlockCypher decoder

(Asked by: username_0 on 2024-02-09)

Type of transaction:
p2wpkh transaction creating a multisig (p2wsh) on signet.

Error:TX must have atleast one inputs.

Output on online decoder

```
{
    "addresses": [
        "tb1q94nuuw96ye4x3u8hc3nga8g02kzvdknug49ucgmgh70l7yqn29ts56cl57",
        "tb1q6ajhfx4xvscts4m9hhk7ujy0tl3us25wu97pkv"
    ],
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "double_spend": false,
    "fees": 0,
    "hash": "0fa2e7ac35739d727d1298922906127cdfe04040b98051f06314dc137d319a41",
    "inputs": [
        {
            "age": 0,
            "output_index": 365,
            "prev_hash": "e748d035309c2f7312176789f6fbe77a20582733817ed66b19fc675bfc1c4208",
            "script_type": "empty",
            "sequence": 4294967295
        }
    ],
    "lock_time": 2888877058,
    "outputs": [
        {
            "addresses": [
                "tb1q94nuuw96ye4x3u8hc3nga8g02kzvdknug49ucgmgh70l7yqn29ts56cl57"
            ],
            "script": "00202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157",
            "script_type": "pay-to-witness-script-hash",
            "value": 1000000
        },
        {
            "addresses": [
                "tb1q6ajhfx4xvscts4m9hhk7ujy0tl3us25wu97pkv"
            ],
            "script": "0014d765749aa66430b85765bdedee488f5fe3c82a8e",
            "script_type": "pay-to-witness-pubkey-hash",
            "value": 8093449
        }
    ],
    "preference": "low",
    "received": "2024-02-09T10:13:35.159062502Z",
    "relayed_by": "3.235.156.159",
    "size": 202,
    "total": 9093449,
    "ver": 2,
    "vin_sz": 1,
    "vout_sz": 2,
    "vsize": 145
}

```

Manual decoding

```
nVersion
02000000

marker
00

flag
01

txin
01
08421cfc5b67fc196bd67e81332758207ae7fbf689671712732f9c3035d048e7 // 32 bytes (txid reversed little endian)
6d010000
00
ffffffff

txout
02
40420f0000000000 
22 00202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157 // 34 bytes script  
097f7b0000000000
16 0014d765749aa66430b85765bdedee488f5fe3c82a8e // scriptpubkey for change

witness
02
473045022100a5faff9808555961e9ff213550b365ef86b993e07116fe445f27594f96f8798c022067571f9e0050f6c7e50057dd0e628613dffe1b573f48697019b6aa0fe97d658e01
2102c430ac1cb8ea090e63d171df5502ed5815ba579c6b38dd13e069e96816e4d247

nLocktime
00000000

```

Output of an accepted transaction

```
{
    "addresses": [
        "tb1qzeuvnr6u39npxdaxmhhxwwn68w5rplwet350nr",
        "tb1qk3qesjjnpztf2fs3r80haq9uddnw495f96w9tk5mdxyz8htuxu9qcwcurs"
    ],
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "double_spend": false,
    "fees": 0,
    "hash": "33128f3a32d65c30f5bb4d4c2419f4c4e5c9c601e091c180e17592bda0ad10b3",
    "inputs": [
        {
            "age": 0,
            "output_index": 0,
            "prev_hash": "71e6a41254dc239a285e5cbf5cded15e099e18989b10ee10e23daed9e5fe052f",
            "script_type": "empty",
            "sequence": 4294967295
        }
    ],
    "outputs": [
        {
            "addresses": [
                "tb1qk3qesjjnpztf2fs3r80haq9uddnw495f96w9tk5mdxyz8htuxu9qcwcurs"
            ],
            "script": "0020b441984a53089695261119df7e80bc6b66ea96892e9c55da9b698823dd7c370a",
            "script_type": "pay-to-witness-script-hash",
            "value": 1000000
        },
        {
            "addresses": [
                "tb1qzeuvnr6u39npxdaxmhhxwwn68w5rplwet350nr"
            ],
            "script": "00141678c98f5c89661337a6ddee673a7a3ba830fdd9",
            "script_type": "pay-to-witness-pubkey-hash",
            "value": 888318652
        }
    ],
    "preference": "low",
    "received": "2024-02-09T10:17:43.206930294Z",
    "relayed_by": "18.213.115.114",
    "size": 235,
    "total": 889318652,
    "ver": 2,
    "vin_sz": 1,
    "vout_sz": 2,
    "vsize": 153
}

```

Raw transaction

```
0200000000010108421cfc5b67fc196bd67e81332758207ae7fbf689671712732f9c3035d048e76d01000000ffffffff0240420f00000000002200202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157097f7b0000000000160014d765749aa66430b85765bdedee488f5fe3c82a8e02473045022100a5faff9808555961e9ff213550b365ef86b993e07116fe445f27594f96f8798c022067571f9e0050f6c7e50057dd0e628613dffe1b573f48697019b6aa0fe97d658e012102c430ac1cb8ea090e63d171df5502ed5815ba579c6b38dd13e069e96816e4d24700000000

```

**Tags:** bitcoin-core, bitcoin-cli, raw-transaction, blockcypher


---

## 1 answers

### Answer by username_1 on 2024-02-09. Score: 2 | Accepted answer

The signature is 72 bytes long, but the signature witness item is prepended with the byte `0x47` (71), not `0x48` (72). The decoder then interprets the last byte of the signature (the sighash flag, `0x01`) as the length of the second witness item, and parses it as `0x21`. The next 4 bytes (`0x02c430ac`, converted to decimal as 2888877058) are interpreted as the locktime, and that's where the transaction is supposed to end. Apparently BlockCypher silently ignores any remaining bytes.

If you replace the `0x47` byte with `0x48`, the transaction will decode correctly.


---

