Bitcoin Tutorials - Herong's Tutorial Examples - v1.06, by Herong Yang
Data Structure of Bitcoin Block
This section describes the Data Structure of a Bitcoin Block.
The data structure of a Bitcoin block is described in the following table:
Field Size Description Magic # 4 bytes Fixed value of 0xD9B4BEF9 Blocksize 4 bytes Number of bytes of the block minus 4 Blockheader 80 bytes 6 header fields Tx counter 1 to 9 bytes Positive integer Tx list List of transactions
The data structure of the blockheader fields:
Field Size Description Version 4 bytes The version of Bitcoin system Previous hash 32 bytes Hash of the previous block Merkle root 32 bytes The Merkle Root hash of transactions Timestamp 4 bytes Number of seconds since 1970-01-01 00:00 Bits 4 bytes A representation of the networks current difficulty Nonce 4 bytes Generated by the miner to meet the hash requirement
Table of Contents
Data Components of Bitcoin Block
Data Properties of Bitcoin Block
Calculate Double-SHA256 Hash with Python
Verify Merkle Root of 2 Transactions
Verify Merkle Root of 7 Transactions
►Data Structure of Bitcoin Block
"getblock blockhash 0" - Serialized Hex Block Data
Block Hash Calculation Algorithm
Block Hash Calculation in Python
Calculate Double-SHA256 Hash with Java