How a Blockchain Works
A blockchain is a filing cabinet where every drawer is welded shut by a number nobody can guess. Thousands of payments are folded into a single 32-byte fingerprint, stamped into an 80-byte header, and then a planet-sized swarm of machines guesses quintillions of times a second until one guess produces a hash starting with nineteen zeros. That guess seals the block — and cuts the key that the next block has to fit.
Step 01 of 09
1 · A row of sealed boxes
Each of these cases is a block: a few thousand payments, batched together and shut. What holds it shut is a number — the block's hash, a 64-character fingerprint of everything inside it. Read the plate on the front and the first nineteen characters are zeros. Nobody chose those zeros; they had to be found by guessing, and finding them is the only way a block gets made. Every block also carries a copy of the hash of the block before it, which is what turns a pile of boxes into a chain.
Step 02 of 09
2 · Open one up
Lift the lid off block 964,940 and there are only three things in it. A row of transaction records — the payments this block is responsible for. A tree of hashes growing out of them, which crushes all of those records down to a single 32-byte number. And a header: a strip 80 bytes long that is the only part anyone ever actually hashes.
Step 03 of 09
3 · Where the payments come from
A payment you make does not go into a block straight away. It goes into the mempool — a waiting room every node keeps of transactions it has heard about but not yet seen confirmed. A miner picks from that pool, usually highest fee first, and packs roughly 4,700 of them into one block; the hard limit is four million weight units, not a count. The first record is different: the miner writes it themselves, and it pays them the block reward — 3.125 bitcoin since the 2024 halving — plus every fee in the block.
Step 04 of 09
4 · Four thousand payments, one number
The header has no room for 4,700 transactions, so they get folded. Hash each transaction; hash each neighbouring pair of those hashes together; hash the pairs of pairs — and keep going until one number is left. That is the merkle root, and it is 32 bytes no matter how many payments went in. (If a row has an odd number of nodes, the last one is hashed with a copy of itself.) The useful part: change any single payment down at the bottom and the root at the top comes out completely different.
Step 05 of 09
5 · Eighty bytes, drawn to scale
This strip is the whole header, and each field is drawn as wide as it really is. Version, 4 bytes. The previous block's hash, 32. The merkle root, 32. Time, 4. The target, 4. The nonce, 4. Two fingerprints take up 64 of the 80. These 80 bytes are the only thing anyone ever hashes: run them through SHA-256, twice, and out comes a 256-bit number. Feed it the same bytes and you get the same answer every time — but change one bit anywhere, and the answer has nothing to do with the last one.
Step 06 of 09
6 · Guessing until the zeros appear
A block is only valid if its header hash comes out below a target the network sets — in practice, starting with about nineteen zeros. There is no way to work backwards to a header that does that, so miners change the one field they are free to change, the 4-byte nonce, and hash again. And again. The gauge counts leading zeros: nearly every guess gets one or two. Reaching nineteen takes roughly 540 sextillion tries. The whole planet's mining hardware, running at about a thousand exahashes a second, chews through that in about nine minutes — slightly faster than the protocol wants, which is exactly why every 2,016 blocks it re-tunes the target to drag the average back to ten.
Step 07 of 09
7 · The hash becomes the key
The winning hash seals the block, and then it does a second job. The next block copies it into its own header as the "previous block hash" — so the two faces here are cut from the same number, and they only close if the number still matches. That is the whole chain: not glue, but a fingerprint recorded twice. Every block on the network is checked against the one before it, all the way back to the first block in 2009.
Step 08 of 09
8 · Try to change one payment
Edit a single record in a block that is already buried. Its leaf hash changes, so the merkle root changes, so the header changes, so the block's own hash changes — and the copy sitting in the next block's header is now wrong. The teeth do not meet. To repair it you would have to re-mine this block and every block stacked on top of it, faster than the entire network is adding new ones. That is what "immutable" actually means: not impossible, just far more expensive than it could ever be worth.
Step 09 of 09
9 · The chain keeps growing
Nobody is in charge of the end of the chain. Every ten minutes or so, somewhere, a machine stumbles onto a header that hashes below the target and shouts about it — and occasionally two of them do it at the same moment, so the chain briefly grows two tips. Nodes do not vote. They simply keep building on whichever branch has the most work behind it, and within a block or two the other tip is abandoned, its transactions dropped back into the mempool to be included in a later block.