I am looking at the specific block at height 680175.
bitcoin-cli getblock 00000000000000000004dbd66fa71fdcd62658bf8c8e2e153521257ad5858c71 0 I obtained the serialized, hex-encoded block data. According to the section Serialized Blocks the
txn_count starts at Byte #81. Following the description of CompactSize Unsigned Integers I get:
In : int.from_bytes(byte_arr[80:81], "little", signed=False) Out: 253 In : tnx_count = byte_arr[81:83] ...: tnx_count = int.from_bytes(tnx_count, "little", signed=False) In : tnx_count Out: 1702
There are indeed 1702 transactions which can be verified via
./bitcoin-cli getblock 00000000000000000004dbd66fa71fdcd62658bf8c8e2e153521257ad5858c71 2 in the attribute
Now I know that the rest of the block data is the transactions' part. According to the section Raw Transaction Format the first 4 bytes are the version:
In : tnx_part = byte_arr[83:] In : version = tnx_part[:4] In : int.from_bytes(version, "little", signed=False) Out: 1
This seems to be correct, too. So, the next bytes determine the number of tx_in count, but there I get 0 which is false. And the input of the coinbase transaction does not start with a 32-byte null:
In : int.from_bytes(data[4:5], "little", signed=False) Out: 0 In : data[4:10] Out: bytearray(b'\x00\x01\x01\x00\x00\x00')
Am I missing something? The input of the coinbase transaction seems not to match the description.