TeachMeBitcoin

Nakamoto Consensus (The Longest Chain Rule)

From TeachMeBitcoin, the free encyclopedia Reading time: 4 min

Nakamoto Consensus (The Longest Chain Rule)

In a centralized database, a single master server decides which transactions are real. But in a decentralized, global network where anyone can run a node or a miner, how does the network coordinate to agree on a single, shared ledger?

If different miners broadcast different blocks at the same time, how does the network resolve the conflict?

The answer is Nakamoto Consensus, which utilizes the Heaviest Chain Rule (commonly referred to as the Longest Chain Rule).


The Fork: When Two Truths Exist

Because Bitcoin nodes are distributed across the globe, it takes several seconds for a newly mined block to propagate to all peers. Occasionally, this latency causes a temporary conflict:

  1. Simultaneous Solution: Miner A (in Canada) and Miner B (in Germany) find a valid block at almost the exact same second.

  2. Conflicting Broadcast:

  3. Miner A broadcasts Block 100-A to their local peers.
  4. Miner B broadcasts Block 100-B to their local peers.

  5. A Split Network: The network is now split in half. Nodes in North America adopt Block 100-A as the tip of their ledger, while nodes in Europe adopt Block 100-B.

Both blocks are mathematically valid, and both contain valid transactions. The network has forked.

 ┌───► [ Block 100-A ] (North America Tip)
 │
 [ Block 99 ] ────────────────────┤
 │
 └───► [ Block 100-B ] (Europe Tip)

Without a central leader to decide, how does Bitcoin heal this split and converge back to a single truth?


The Heaviest Chain Rule (Heuristic Consensus)

Satoshi Nakamoto’s solution is beautifully simple: Trust the chain that represents the most accumulated physical work.

When a fork occurs, nodes do not panic. They keep both branches in their memory database, but they treat the branch they heard about first as the active branch. They then wait for the next block to be mined.

Miners on both sides of the ocean begin compiling Block 101:

Eventually, some miner somewhere in the world solves Block 101. Let's assume a miner in Singapore solves Block 101-A (linked to Block 100-A):

 ┌───► [ Block 100-A ] ───► [ Block 101-A ] (Winner!)
 │
 [ Block 99 ] ────────────────────┤
 │
 └───► [ Block 100-B ] (Discarded)

As Block 101-A propagates across the global network, the European nodes receive it. They see that:

Following the consensus rules programmed into the software, the European nodes immediately perform a blockchain reorganization (reorg). They discard Block 100-B, switch their active pointer to Block 100-A -> 101-A, and begin mining Block 102.

Consensus is achieved, and the split is healed trustlessly.


⚖️ "Longest" vs. "Heaviest": A Critical Technical Distinction

In casual conversation, we say "the longest chain wins." However, in the Bitcoin codebase, this is a slight misnomer. The rule is actually the chain with the most accumulated Proof of Work difficulty wins.

Why does this distinction matter?

Nakamoto Consensus ensures that the chain backed by the most physical energy is always accepted as the ultimate truth.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!