What is Nakamoto consensus, and how does the network agree on new blocks?
Nakamoto consensus combines Proof of Work with the "longest chain" rule: nodes accept whichever valid chain has the most accumulated work (the most blocks) as the true history.
* When the chain forks, the branch with the most accumulated work (the longest valid chain) wins; the shorter branch is abandoned. *
Reaching agreement needs two pieces working together:
- A Sybil-resistance mechanism — Proof of Work — that decides who gets to author the next block by making block creation costly.
- A chain-selection rule — the longest (most-work) chain — that decides which competing history is canonical.
When honest nodes see several valid chains, they follow the longest one, because every extra block represents real computational work that would be enormously expensive to fake or catch up to. Small reorganizations happen naturally when two miners find a block at nearly the same time, but the network quickly converges on the chain that keeps growing fastest. Calling Proof of Work alone "the consensus" is a common imprecision — it is only half; the longest-chain rule is the other half.
Go deeper:
Proof of work — Wikipedia — the Sybil-resistance half that decides who may author a block.
Fork (blockchain) — Wikipedia — the chain-selection half: how competing branches resolve to one history.
Bitcoin white paper (Satoshi Nakamoto) — the original description of longest-chain consensus.