kevinferron.comKevin Ferron

T2 · Blockchain · Computed in your browser

Recompute it yourself: a chain of real headers

Hash eighty bytes of a real Bitcoin block header and get the block’s own ID back; change one byte and the next block’s link breaks.

A block’s ID is the hash of its header, and the header holds the previous block’s ID, so you can check a block yourself, and changing any old byte breaks every link after it.

Bitcoin mainnet, the first block ever mined. The header is 80 bytes in six fields. Click any byte to select it, then change it below.

Hashes in the order the hash produced them; integers little-endian.

Version · 4 bytes1

Previous block hash · 32 bytes0x0000…0000

Merkle root · 32 bytes0x4a5e…a33b

Time · 4 bytes1231006505 (2009-01-03 18:15:05 UTC)

nBits · 4 bytes0x1d00ffff

Nonce · 4 bytes2083236893

Byte 0 · VersionUnchanged from Core’s data.

Press Hash it: double SHA-256 over these 80 bytes, then the reversal, then a comparison with the ID Core states.

Each block names the one before

Testnet3 blocks 2 and 3, from Core’s data. Block 3’s previous-block field is block 2’s ID. Select Testnet3 block 2 above and change any byte: its ID changes, and block 3 no longer points at it. Core’s data holds no block 1 or block 4, so those two ends are not checked.

  1. Testnet3 block 1

    not in Core’s data

    Block 2’s previous-block field is this block’s ID. It is not checked here.

  2. Testnet3 block 2

    as Core states it

    Its ID, recomputed

    0x0000…7820

    Previous-block field

    0x0000…1206

    Block 3 points at this ID.

  3. Testnet3 block 3

    as Core states it

    Its ID, recomputed

    0x0000…be10

    Previous-block field

    0x0000…7820

    ✓ Points at block 2’s ID

In the real chain every later block would break the same way. Repairing them means redoing each block’s proof of work, which is why the past is expensive to change.

A Bitcoin block’s header is 80 bytes in six fields: version (4 bytes), the previous block’s hash (32), the Merkle root of its transactions (32), the time (4), the target in compact form called nBits (4) and the nonce (4). The block’s ID is the double SHA-256 of those 80 bytes. Integers are stored little-endian; the two hashes are stored in the order the hash function produced them and printed by explorers the other way round, which is why the raw bytes and the ID look different. The byte-order switch shows both.

The mainnet genesis block is the first preset. Bitcoin Core builds it in chainparams.cpp from a handful of numbers (time 1231006505, nonce 2083236893, nBits 0x1d00ffff, version 1 and a Merkle root) and asserts that its ID is 000000000019d668…b60a8ce26f. Press Hash it and the 80 bytes above produce that ID.

The other presets are blocks from the BIP 158 test vectors in Bitcoin Core’s source. Those vectors are blocks of testnet3, a network Bitcoin uses for testing; each vector states the block’s ID, and the page checks that the 80 bytes hash to it. Two of them, blocks 2 and 3, sit next to each other, so block 3’s previous-block field is block 2’s ID. Block 1 is not in Core’s data, so the strip shows only what it holds.

Change one byte of block 2 and its ID changes completely, so block 3’s previous-block field no longer names it: the link is broken. In the real chain every later block would break the same way, and repairing them would mean redoing each one’s proof of work. A later tutorial is about why that is expensive. This strip holds only two linked blocks, so it shows one link breaking, not all of them.

Ethereum’s block ID is the same idea with different parts. The header’s fields are encoded one after another in a scheme called RLP and hashed with Keccak-256. The block here has 21 fields. The yellow paper’s section on the header lists 17 of them, including the base fee that EIP-1559 added at the end and the withdrawals root. The last four come from later upgrades: two blob-gas counters, a parent beacon block root and a requests hash. The yellow paper predates those, so their names come from the execution-API block schema (and EIP-4844 for the blob pair), and their order is the one that makes the hash come out right. Change any field and the hash changes, and the next block’s parentHash stops matching.

Three of those fields are fixed since Ethereum stopped using proof of work: the difficulty is zero, the nonce is zero and the ommers hash is a constant. They are greyed out in the table, but still part of what is hashed.

Exercise

Rebuild the genesis block’s ID from its fields.

  1. Write the six fields: version 1, previous hash all zeros, Merkle root 4a5e1e4b…afdeda33b, time 1231006505, nBits 0x1d00ffff, nonce 2083236893.
  2. Turn each integer into four little-endian bytes and each hash into 32 bytes reversed from the printed order, and join them into 80 bytes.
  3. Hash the 80 bytes with SHA-256 twice, reverse the result and compare it with 000000000019d668…b60a8ce26f.

Sources

  1. Bitcoin developer reference: block chain Block Chain (developer reference), bitcoin.org developer documentation. undated; contains “as of November 2017”. Structure only, never current figures.

    Read 2026-10-23: Header fields and sizes, internal byte order against display order, little-endian integers, double SHA-256 for headers, Merkle construction, the coinbase transaction (the first transaction in a block), nBits and its examples

    • Block header: field sizes, byte order of hashes and integers
    • Block header: field sizes and byte order
  2. Bitcoin whitepaper Bitcoin: A Peer-to-Peer Electronic Cash System (Satoshi Nakamoto). 2008 (no date printed).

    Read 2026-10-23: Whole paper as text: section 2 (transactions), 3 (timestamp server), 4 (proof of work: nonce, moving-average difficulty), 5 (network: the longest chain), 7 (Merkle tree and the 80-byte header), 8 (simplified payment verification), 11 (calculations)

    • Section 7: block headers are 80 bytes
    • Sections 3 and 4: the timestamp server, and proof of work as what makes changing an old block costly
  3. Bitcoin Core, chainparams.cpp src/kernel/chainparams.cpp, Bitcoin Core (MIT). tag v32.0, commit 465dde27.

    Read 2026-10-23: the mainnet CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN) call and the two asserts after it (genesis hash and Merkle root)

    • The mainnet genesis block’s parameters and the two asserts after them
    • The genesis parameters and the asserted ID
  4. Bitcoin Core, blockfilters.json src/test/data/blockfilters.json, the BIP 158 test vectors, Bitcoin Core (MIT). tag v32.0, commit 465dde27. These are testnet3 blocks.

    Read 2026-10-23: each vector’s block height, block hash and full block bytes; the first 80 bytes of each are the header used here

    • The vectors’ block heights, block hashes and full block bytes
  5. Ethereum yellow paper Ethereum: A Secure Decentralised Generalised Transaction Ledger (Gavin Wood). Shanghai version efc5f9a, 2025-02-04. Its section 4.4 lists 17 header fields; the blob, beacon-root and requests-hash fields are not in it.

    Read 2026-10-23: Section 3 (KEC is Keccak-256, not the final SHA-3), 4.4 (17 header fields, through baseFeePerGas and withdrawalsRoot), 4.4.1 (receipts and logs), Appendix B (RLP, titles)

    • Section 4.4: the header’s fields; Appendix B (RLP), title only
    • Section 4.4: the header’s difficulty, nonce and ommersHash
  6. ethereum.org: RLP Recursive-length prefix (RLP) serialization (ethereum.org). page date not recorded.

    Read 2026-10-23: The rules and examples (its long-list bullet says 0xf7; its table’s 0xf8 to 0xff range is the correct one)

    • The RLP rules and examples
  7. EIP-1559 Fee market change for ETH 1.0 chain (V. Buterin, E. Conner, R. Dudley, M. Slipper, I. Norden, A. Bakhta). created 2019-04-13; Final.

    Read 2026-10-23: the constants (denominator 8, elasticity 2), the base-fee reference code, the Backwards compatibility note that the base fee is one additional item at the end of the header, the type-2 payload and signature, the effective gas price and the burn

    • Backwards compatibility: the base fee is one additional item at the end of the header
  8. Ethereum execution APIs Ethereum execution APIs, the JSON-RPC OpenRPC specification (CC0-1.0). main branch, read 2026-10-23.

    Read 2026-10-23: The eth namespace; block and receipt schema field titles, including the blob, beacon-root and requests-hash fields

    • The block schema: withdrawalsRoot, blobGasUsed, excessBlobGas, parentBeaconBlockRoot and requestsHash
  9. EIP-4844 Shard Blob Transactions. created 2022-02-25; Final.

    Read 2026-10-23: Type 0x03 and the header fields blob_gas_used and excess_blob_gas. Blob limits are expected to rise, so none is shown

    • The header fields blob_gas_used and excess_blob_gas

Everything here is paraphrased from the sources, not quoted at length, and every claim is attributed to one. Each entry says which parts of the source were read, and whether the build or the plan read them. Anything illustrative is labelled as such. Where a source is silent or could not be read, the page leaves the fact out.