I’m trying to parse a bitcoin block.
I took as an example this block from 2019. I’m trying to parse the first transaction.

I don’t understand how to calculate how many bytes I have to read for the "Witnesses"?
By "Witnesses", I refer to this table

Here is my result :

magic_no (4 bytes) : d9b4bef9
block_size (4 bytes) : 1236518
version (4 bytes) : 568442880
prev_hash (32 bytes) : 0000000000000000001437c1e52bc699fb299cac6d2a61a88210b995e45d603e
hash_markle_root (32 bytes) : ed3aba45d11a87c888ffb76a6af7cc1fbddd4a299f285379640c29188110fcf3
time (4 bytes) : 1575857336
bits (4 bytes) : 387308498
nonce (4 bytes) : 2292915727
Tx count (3 bytes) : 2735
Version (4 bytes) : [0 0 0 1]
Flag (2 bytes) : [1 0]
Tx In Count (1 bytes) : 1

*----- START TX Inputs -----*

*----- TxIn 1 -----*

Previous Tx Hash (32 bytes) : 0000000000000000000000000000000000000000000000000000000000000000
Previous Txout Index (4 bytes) : 4294967295
Tx In Script Len (1 bytes) : 85
Tx In Script (85 bytes) : 0348440941d77b6b2f7e726e41d77b6b2e3f8d4a2f4254432e544f502ffabe6d6d19437c0ebcb8916cb51c14eccc000373c8c56bac89feca39a132755acf337f158000000000000000e300518d901a000000000000
Sequence no (4 bytes) : ffffffff
*----- END TX Inputs -----*

Tx Out counter (1 bytes) : 3

*----- START TX Outputs -----*

*----- TxOut 1 -----*
Amount (8 bytes) : 1262724620
Tx Out Script Len (1 bytes) : 25
Tx In Script (25 bytes) : 76a914ba507bae8f1643d2556000ca26b9301b9069dc6b88ac

*----- TxOut 2 -----*
Amount (8 bytes) : 0
Tx Out Script Len (1 bytes) : 38
Tx In Script (38 bytes) : 6a24aa21a9ed36e74c1ca41a78209321759be06054f3ae9b3cd9feaa0f3979f5d9b5d02f286c

*----- TxOut 3 -----*
Amount (8 bytes) : 0
Tx Out Script Len (1 bytes) : 38
Tx In Script (38 bytes) : 6a24b9e11b6d04079a724511b5eac6db73004c5326521f1cc7f0104294285aec8a0dd3c59881

*----- END TX Outputs -----*

Here are the 128 next bytes :

[1 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 1 82 246 143 178 43 131 54 243 136 69 149 88 83 79 230 217 254 150 64 45 100 31 124 170 90 141 101 98 30 236 144 89 1 0 0 0 106 71 48 68 2 32 3 14 228 13 162 14 179 94 25 153 151 242 101 101 181 13 61 83 105 57 168 195 125 68 13 39 247 201 82 62 126 228 2 32 118 168 227 118 230 74 50 52 141]

source

By pplny

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다