// learn · episode 03

Consensus & proof of work

Episode 2 made history tamper-evident — you can always tell two histories apart. But which one is real? This episode: how millions of strangers agree, with no referee. You've done the hashing already, so today we simulate the statistics instead — that's where consensus actually lives.

01 · the problem

Two versions of history

Digital money's oldest nightmare is the double-spend: copy the coin, spend it twice. Banks solve it with a ledger they control. Remove the bank, and you get this:

Ali has 5 coins — and quietly signs two payments with them: one to Siti, one to Raju. Two versions of history now exist. Both are internally valid: correctly hashed, properly mined, chained without a flaw. Click the one you believe.

02 · the race

The accumulated-work race

Nodes select a valid chain with the most accumulated proof of work. An attacker attempting to replace part of its history must compete with continuing honest mining. Here, blocks have equal work: choose the attacker's hashpower and starting deficit to explore a simplified race.

#1#2#3⑂ fork
honest
you (atk)nothing yet…

The unlimited-time model is the probability of reaching a tie from a fixed deficit: (q/p)z when q is below p. These sample runs instead stop at a tie or a deficit of 12 blocks, so their win rate need not match that value. Hashpower is constant and every block represents equal work. This is a teaching model, not a payment-risk forecast.

Below 50% hashpower, the unlimited-time catch-up probability decreases exponentially with the starting deficit. At or above 50%, that idealised model gives eventual catch-up probability 1. A finite run can still stop behind. Real network security also depends on block validation, network conditions, and the assumptions behind the model.

03 · buried alive

Confirmations

Confirmations record how deeply a transaction sits in the accepted chain. To explore why depth matters, this model assumes an attacker is already a fixed number of blocks behind. Change that starting deficit and the hashpower share to compare catch-up probabilities.

chance of ever catching up in this model: 1 in 531,441

0 behind
100%
1 behind
11.1%
2 behind
1.23%
3 behind
0.137%
4 behind
0.0152%
5 behind
1 in 59,049
6 behind
1 in 531,441
7 behind
1 in 4,782,969
8 behind
1 in 43,046,721
9 behind
1 in 387,420,489
10 behind
1 in 3,486,784,401

This model starts with the attacker already 6 blocks behind, assumes a constant 10% share of hashpower, equal work per block, and allows unlimited attempts to catch up. Zero deficit means the chains are already tied. The bars use a log scale. This is not the probability that a real payment will be reversed: confirmation policies depend on the network, attack assumptions, and value at risk. Model reference: Bitcoin paper, section 11.

04 · the fine print

Three things worth knowing

Difficulty breathes

Every 2,016 blocks (~2 weeks), Bitcoin retunes the target so blocks keep arriving every ~10 minutes — whether a thousand miners join or quit.

Don't trust, verify

Full nodes validate blocks against their consensus rules. These browser lessons illustrate selected checks; they do not run a full node.

Not the only ballot

Proof of work is the original consensus, not the only one — Ethereum switched to proof of stake in 2022. Same goal, different way of making votes expensive.

next up

Episode 04 — Wallets, keys & signatures play now →

The network agrees on history. Next: what it actually means to own something on it.

Building something that needs this to be right? →