This is the exact same Nakamoto-consensus race as the 3D block-tower version, but drawn as its native mathematical object: a random walk on the integers (a classic "gambler's ruin" process). Let D = honest chain length − attacker chain length. D starts at z. Every time the honest network finds a block, D increases by 1; every time the attacker finds a block, D decreases by 1. Both are independent Poisson/exponential arrival processes with rates (1−q)·λ and q·λ.
The top panel plots D(t) live as it random-walks up and down. When D hits 0, the attacker's branch has reached parity — the fork-choice rule flips every observer onto it (a chain reorg, a successful double-spend) and the walk resets to z. If D drifts far enough positive, the attacker is deemed to have abandoned the race.
Because D is an unbounded random walk with an up-step probability p = 1−q (honest block) and a down-step probability q (attacker block), absorbed the moment it reaches 0, its exact catch-up probability is the classical gambler's ruin result:
p = 1 − q
P(catch-up) = (q / p)^z for q < p, else 1
The bottom panel plots this closed-form P(catch-up) as a curve over q (for the current z) — a parameter/phase diagram rather than a rendering of any single race. A marker tracks the current q slider position on that curve, and a second marker tracks the running empirical reorg rate measured from the random walk above; as more trials complete, the empirical marker converges onto the theoretical curve (this was checked against an independent Monte Carlo simulation of the same race, matching to within a few standard errors across q from 10% to 45%).
- Attacker hash power q — the attacker's share of total network hash rate (real Bitcoin security assumes q < 50%).
- Confirmations z — the starting value of D, i.e. how many blocks the honest chain is ahead when the race begins.
- Mining tempo — animation speed only; it scales both Poisson rates together and does not change the outcome probability.
Real-world relevance: this is the exact model behind "wait for N confirmations" guidance on every Bitcoin-derived blockchain, and the reason 51%-attack economics (q ≥ 0.5) make the random walk driftless-or-worse — double-spending becomes a near-certainty regardless of z.