<p>This <a href="https://en.bitcoin.it/wiki/Protocol_documentation#tx" rel="nofollow noreferrer">website</a> can answer your question.</p>
<p>Typically, the first question mark refers to <code>flag</code> and the second question mark refers to <code>tx_witnesses</code></p>

CC BY-SA 4.0
2021-11-05T21:53:55.693Z
2021-11-05T21:53:55.693Z
Chengzhang Yang
<p>I am trying to Decode the Raw hex data of a Coinbase Block to check my understanding of the DS but I am facing some difficulties in decoding marked by a <strong>?</strong> below:</p>
<p>Q1. Can someone please check the existing understanding/interpratation and help explain and fill the gaps (marked by <strong>?</strong>)</p>
<p>Q2. Is there a simple standalone program/library in to do the same? I have seen few parsers (though haven't used) but they require the complete blockchain .dat files that i cannot afford to download for this task.</p>
<p>The block is: <a href="https://www.blockchain.com/btc/block/485300" rel="nofollow noreferrer">https://www.blockchain.com/btc/block/485300</a></p>
<pre><code>
0000002053f7ebc735f54ac8d4ebcc1eeb3d3bdea89603bdd27431000000000000000000ff964ec70ea5a5356a04fdb044ca6c59ffda2dd6be02c63d9ea58fb6d46e01991a22bb590b310118f6df26f801010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff3103b46707244d696e656420627920416e74506f6f6c6b2f4542312f4144362f4e59412f332059bb221ab8080000615c0300ffffffff02807c814a000000001976a914660371326d3a2e064c278b20107a65dad847e8a988ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000

[PARAMETER]           [VALUE]

[Block Header]
version             - 00000020
Previous Block hash - 53f7ebc735f54ac8d4ebcc1eeb3d3bdea89603bdd27431000000000000000000
Merkel Root         - ff964ec70ea5a5356a04fdb044ca6c59ffda2dd6be02c63d9ea58fb6d46e0199
time                - 1a22bb59
bits                - 1801310B
nonce               - f6df26f8

01 - transaction count

[Tx List]
version                 - 01000000
&lt;?&gt;                     - 0001
input ct                - 01
prev tx                 - 0000000000000000000000000000000000000000000000000000000000000000
prev out n              - ffffffff
coinbase script length  - 31
coinbase script         - 03b46707244d696e656420627920416e74506f6f6c6b2f4542312f4144362f4e59412f332059bb221ab8080000615c0300
sequence                - ffffffff
Output count            - 02
value 1                 - 807c814a00000000
Script 1 length         - 19
Script 1                - 76a914660371326d3a2e064c278b20107a65dad847e8a988ac
value 2                 - 0000000000000000
Script 2 length         - 26
Script 2                - 6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9
&lt;?&gt;                     - 0120
witness transaction id  - 000000000000000000000000000000000000000000000000000000000000000000000000
</code></pre>

CC BY-SA 4.0
2021-08-25T03:50:46.347Z
Q1 [segregated witness aka segwit](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki) Also to be clear multibyte numbers are little-endian, and you've swapped `bits` to big-endian but not the others.
dave_thompson_085
CC BY-SA 4.0
2021-08-25T09:19:54.650Z
@dave_thompson_085 thank you. updated the structure above for the seg_wit transaction id. just 4 bytes above unclear. can you please clarify those also?
J.Doe
CC BY-SA 4.0
2024-07-23T09:36:22.547Z
This question is similar to: [What are the parts of a Bitcoin transaction in segwit format?](https://bitcoin.stackexchange.com/questions/113697/what-are-the-parts-of-a-bitcoin-transaction-in-segwit-format). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.
RedGrittyBrick
<block><python>
Struggling to Decode Raw Hex Data of a Block
J.Doe
# Struggling to Decode Raw Hex Data of a Block

(Asked by: username_0 on 2021-08-24)

I am trying to Decode the Raw hex data of a Coinbase Block to check my understanding of the DS but I am facing some difficulties in decoding marked by a ? below:
Q1. Can someone please check the existing understanding/interpratation and help explain and fill the gaps (marked by ?)
Q2. Is there a simple standalone program/library in to do the same? I have seen few parsers (though haven't used) but they require the complete blockchain .dat files that i cannot afford to download for this task.
The block is: https://www.blockchain.com/btc/block/485300

0000002053f7ebc735f54ac8d4ebcc1eeb3d3bdea89603bdd27431000000000000000000ff964ec70ea5a5356a04fdb044ca6c59ffda2dd6be02c63d9ea58fb6d46e01991a22bb590b310118f6df26f801010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff3103b46707244d696e656420627920416e74506f6f6c6b2f4542312f4144362f4e59412f332059bb221ab8080000615c0300ffffffff02807c814a000000001976a914660371326d3a2e064c278b20107a65dad847e8a988ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000

[PARAMETER]           [VALUE]

[Block Header]
version             - 00000020
Previous Block hash - 53f7ebc735f54ac8d4ebcc1eeb3d3bdea89603bdd27431000000000000000000
Merkel Root         - ff964ec70ea5a5356a04fdb044ca6c59ffda2dd6be02c63d9ea58fb6d46e0199
time                - 1a22bb59
bits                - 1801310B
nonce               - f6df26f8

01 - transaction count

[Tx List]
version                 - 01000000
                     - 0001
input ct                - 01
prev tx                 - 0000000000000000000000000000000000000000000000000000000000000000
prev out n              - ffffffff
coinbase script length  - 31
coinbase script         - 03b46707244d696e656420627920416e74506f6f6c6b2f4542312f4144362f4e59412f332059bb221ab8080000615c0300
sequence                - ffffffff
Output count            - 02
value 1                 - 807c814a00000000
Script 1 length         - 19
Script 1                - 76a914660371326d3a2e064c278b20107a65dad847e8a988ac
value 2                 - 0000000000000000
Script 2 length         - 26
Script 2                - 6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9
                     - 0120
witness transaction id  - 000000000000000000000000000000000000000000000000000000000000000000000000

**Tags:** block, python

> **Comments:**
> **username_1**: Q1 [segregated witness aka segwit](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki) Also to be clear multibyte numbers are little-endian, and you've swapped `bits` to big-endian but not the others.  
> **username_0**: @username_1 thank you. updated the structure above for the seg_wit transaction id. just 4 bytes above unclear. can you please clarify those also?  
> **username_2**: This question is similar to: [What are the parts of a Bitcoin transaction in segwit format?](https://bitcoin.stackexchange.com/questions/113697/what-are-the-parts-of-a-bitcoin-transaction-in-segwit-format). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.  

---

## 1 answers

### Answer by username_3 on 2021-11-05. Score: 1

This [website](https://en.bitcoin.it/wiki/Protocol_documentation#tx) can answer your question.

Typically, the first question mark refers to `flag` and the second question mark refers to `tx_witnesses`


---

