Maths IA · Statistics and probability · topic 52 of 97
How many confirmations are safe? The double-spend race · IB Maths IA idea: guide, sample graph and step-by-step plan
the gap is a random walkA shop sees your payment but waits for a few more blocks before handing over the goods. Wait for too few and a cheat with enough computing power can reverse it. Wait for too many and nobody buys anything. You are going to find the number that balances the two.
- ✓ you like probability that ends in a decision, such as how long to wait
- ✓ you want to prove a result and then check it by simulation
- ✓ you are comfortable with geometric series and a little Poisson probability
The big idea
Model two chains growing in a race. The honest miners find each next block with probability p, an attacker with probability q = 1 − p. If the attacker is z blocks behind, the chance that they ever catch up is (q/p)^z. Prove that with a recurrence, not just by quoting it: let h(n) be the catch-up chance from n behind, then h(n) = q·h(n−1) + p·h(n+1) with h(0) = 1. Next, the attacker also works while the merchant waits, so the deficit itself is random. Weight the catch-up chance by the probability of each deficit. Nakamoto's white paper uses a Poisson distribution for this step, and an exact version uses a negative binomial. Compare them, simulate the race, and say how many confirmations are enough for each share q.
Make it yours: pick one twist
Copying a classic won't show your choices. Pick one of these (or invent your own) and your IA becomes yours.
Swipe for more twists →
Set up the recurrence for the catch-up probability, solve it and justify which solution is the right one.
→ A proof instead of a quoted formula. You must explain why q < p matters and what happens at q = p.Run a large number of random races for a chosen q and z, and compare the success rate with your formula.
→ Your algebra is tested by data you made yourself. Give a margin of error for the simulated rate.Compute the success probability with the Poisson approximation and with the exact negative binomial, for the same q and z.
→ You measure an approximation error and find where it is largest. Explain why the Poisson version slightly understates the risk.For each q, find the smallest z that keeps the success probability below a chosen risk, such as 0.1%.
→ A table and a graph of z against q. Describe what happens as q approaches one half.Compare the cost of waiting with the loss if the payment is reversed, and choose z for a small and a large payment.
→ A decision model: expected loss against a waiting cost. Say what the numbers assume.Let blocks arrive faster, or let the attacker need to be one block ahead, and redo the race.
→ The recurrence boundary changes. Check which parts of your result survive.Your Maths IA research question: run the check
what counts as success?Write your own question first. Then make sure it ticks every box:
- Names the model: two competing block-finders with fixed shares, and what counts as a successful attack.
- Names the quantity you find: a success probability, or the waiting time for a given risk.
- Says what the result is tested against: a simulation you wrote, or a published table.
- Includes a derivation or proof, not only a formula taken from a paper.
- States what you leave out: network delay, changing hash power and the cost of the attack.
The model
Two chains grow from the same fork point. The merchant waits until the honest chain has z blocks. Draw your own race and mark the gap the attacker must close.
How your Maths IA could be laid out
The usual order for a topic like this, what each part needs to show, and roughly how much of your 12 to 20 pages it takes. The words are all yours.
What a double spend is, why waiting helps, and what you expect the success probability to do as z grows.
Each block goes to the honest side with probability p or the attacker with probability q. The gap defined and the rules of the walk stated.
The recurrence, its solution, the boundary conditions and a proof that the chance is (q/p)^n.
The distribution of the attacker's blocks, the weighted sum, and the Poisson and exact versions side by side.
Your simulation, the number of trials, and a table comparing simulated and calculated probabilities.
The smallest z for each q at a chosen risk, with a graph and a comment on the shape.
Back to your aim: how the risk falls with z, and what waiting rule your results support.
Fixed hash shares, no network delay, the cost of attacking. Say which assumption matters most and what the model cannot say.
Where every formula, table and rule came from.
What your Maths IA graph could look like
try a log axis!Made-up values to show the form of a strong graph, not the answer: the success probability against the number of confirmations on a log axis. Yours will use your own q. example only
- Theory and simulation on one set of axes, so agreement is visible.
- Axis labels give units: confirmations are counts of blocks, probability has no unit.
- A second graph on a log scale shows the constant fall per block as a straight line.
- Simulated points need a margin of error. State how many trials you ran.
- Another graph to consider: the confirmations needed for 0.1% risk against q.
The maths in action
worked through, not sketched!The graph above was a sketch with made-up numbers. This figure works the idea through from the model itself, so you can see what a finished figure looks like. The source line under it says where every number comes from.
How long must a shop wait?
For each attacker share, how many confirmations keep the success chance below 0.1%? Compute your own table and explain why the numbers grow so fast near one half.
Your game plan
Tick steps off as you go. We'll remember on this device.
0 of 10 done
- Read and predictRead the section on calculations in the original paper. Before any algebra, guess whether the success chance falls quickly or slowly with z.
- Set up the raceDefine p, q, z and what counts as success. Draw the random walk of the gap between the chains.
- Solve the recurrenceWrite h(n) = q·h(n−1) + p·h(n+1), solve it, apply the boundary conditions and explain why the other solution is rejected.
- Trial run (1 lesson)Simulate 10,000 races for one q and one z and compare with a formula. Fix any mismatch now: who needs to be ahead, ties, off-by-one in z.
- Include the waiting timeFind the distribution of the attacker's blocks while z honest blocks arrive and weight the catch-up chance by it.
- Approximate and compareCompute the Poisson version and the exact version for several q and z. Measure the difference.
- Choose a waiting ruleFor each q find the smallest z giving your chosen risk. Graph z against q and describe the shape.
- Go further, with a reasonAdd the cost of waiting against the loss from a reversed payment, or change the rules of the race. HL: prove one more claim yourself.
- Reflect as you goAfter every result, write one line on what it means and what it assumes. These lines become your evaluation.
- Cut, check, then sendCheck every graph has labelled axes, every symbol is defined once and the conclusion answers your aim. Then send your teacher one draft.
The maths you'll use
- Recurrence and boundary conditions – Solve with and show for .
- Geometric sequences – Use the ratio to see why each extra confirmation multiplies the catch-up chance by the same factor.
- Poisson and negative binomial models – Model the attacker's blocks while honest blocks arrive and sum probability times catch-up chance.
- Simulation – Simulate many races, estimate the success rate and give a margin of error by the normal approximation.
- Logarithms – Solve for the smallest with success below a target, and plot on a log axis to turn the decay into a straight line.
Key equations
Syllabus links
- 1.3Geometric sequences and series
- 1.8Infinite geometric series
- 1.15Proof by induction, contradiction and counterexampleHL
- 4.5Basic probability and expected frequency
- 4.8Binomial distribution
- 2.9Exponential and logarithmic functions
- 1.3Geometric sequences and series
- 4.5Basic probability and expected frequency
- 4.8Binomial distribution
- 4.17Poisson distributionHL
- 2.10Log scales, linearising data, log-log and semi-log graphsHL
Read up first
Data and sources to start from
Random races generated in a spreadsheet or program, compared with the formulas and with the table in the original paper.
References to cite
- Nakamoto, S. (2008). Bitcoin: A peer-to-peer electronic cash system.
- Rosenfeld, M. (2014). Analysis of hashrate-based double spending. arXiv.
- Feller, W. (1968). An introduction to probability theory and its applications (Vol. 1, 3rd ed.). Wiley.
Cite what you actually use, in your own format, and say where each number came from.
Traps to avoid in this Maths IA
prove it, then simulate it- Quoting (q/p)^z as the final answer when the attacker also finds blocks while the merchant waits.
- Forgetting the condition q < p. At q = p or above, the attacker catches up with probability one.
- Not saying what counts as success: catching up to a tie, or getting ahead by one block.
- Presenting a simulation result with no number of trials and no margin of error.
- Reading z as 'number of blocks the attacker needs' instead of 'number of honest blocks waited for'.
- Treating the Poisson formula as exact. It is an approximation, and you should measure its error.
More Maths IA ideas like this
Bitcoin's 21 million cap: a geometric series in code●●○
The birthday problem: how safe are hash codes?●●○
Goals and tries: are they random?●●○
When should you stop looking? The 37% rule●●●
This guide shows how a topic like this is usually approached. It is not an IA. Your question, choices, data, analysis and words must be your own: change something, tell your teacher where the idea came from, and follow your school's rules on outside help.