Distributed trust · 2008 · Satoshi Nakamoto

Bitcoin: A Peer-to-Peer Electronic Cash System

Compose signatures, hashes, Merkle trees, proof of work, incentives, and a heaviest-history rule to address double spending without a central mint.

How to read the original

  1. Read Transactions and identify the double-spend problem signatures alone leave open.
  2. Read Proof-of-Work and Network, distinguishing validation from chain selection.
  3. Read Calculations and separate catch-up from a known deficit from the confirmation-risk approximation.

Authorization does not choose one history

The white paper combines signatures, hash-linked records, proof of work, and a chain-selection rule to address conflicting spends without a central mint. A signature can authorize two incompatible transactions from the same owner; it does not choose which transaction belongs in the accepted history. The security argument also depends on a model of computational participation and communication. This lesson studies that model and does not make a claim about asset value or investment merit.

Original reconstruction: two valid signatures, one spendable output

Imagine an unspent output U controlled by Alice. Alice signs transaction T1 spending U to Bob and separately signs T2 spending U to Carol. Both signatures verify. A node that checks only signatures can accept both, creating value that the ledger’s spend-once rule was meant to prevent.

A validating node checks transaction conditions against a particular ledger state. After applying T1, U is spent, so T2 cannot also be applied to that same history. Another branch may contain T2 first and reject T1. The remaining question is which valid branch participants converge on. Proof of work makes extending a branch require computational effort; accumulated work, together with validation rules, guides branch selection. A chain with more work does not make an invalid transaction valid.

Consider two branches with equal difficulty per block. Branch X contains six new blocks and branch Y contains five, so X has more accumulated work under this simplifying assumption. If difficulties differ, counting blocks alone is insufficient. Keep validity, work calculation, and branch preference as separate checks in a toy implementation.

Calculate catch-up under a deliberately narrow model

Suppose an attacker controls fraction q=0.2 of the block-production rate, while honest participants control p=0.8. Assume independent discoveries, constant rates, and a known current deficit of z=3 blocks. In the biased random-walk model, the probability of ever catching up from that deficit is (q/p)^z=(0.2/0.8)^3=1/64, approximately 0.015625.

This is not the complete probability that a merchant is attacked successfully after waiting for three confirmations. During the merchant’s waiting interval, the attacker may already have produced private blocks. The paper’s later calculation accounts for uncertainty about that hidden progress using an approximation. Reporting the simple deficit formula as the complete confirmation risk would change the event being measured.

The model also idealizes network propagation, hash-power stability, attacker strategy, and what counts as catching up or succeeding. A numerical result is only as applicable as those assumptions. It is useful for understanding exponential decline in a simplified setting, not for promising certainty after a fixed number of blocks.

Test state and evidence separately

Build a local ledger with explicit output identities and deterministic validation. Test a valid spend, a repeated spend on the same branch, two competing branches, and a later branch switch. Recompute the unspent state from the selected valid history rather than merging incompatible branch states.

A Merkle inclusion proof can show that a transaction hash is committed by a particular block header. It does not independently prove that the transaction satisfies every ledger rule or that the header belongs to the ultimately selected history. Likewise, a network with many apparent identities does not gain independent security votes merely by counting those identities under a work-based model.

The paper is best read as a composition of mechanisms with separate responsibilities. Track authorization, ordering, inclusion, work, and finality claims individually. That discipline exposes both the ingenuity of the construction and the assumptions that a short description of a decentralized ledger can hide.

Reconstruction exercise

An attacker has q=0.1 and honest participants p=0.9. Compute the simplified eventual catch-up probability from a known two-block deficit. Explain why this differs from the probability of a successful attack after a merchant waits for two confirmations. Then describe the validation outcome when two correctly signed transactions spend the same output within one candidate history.

Worked solution

The known-deficit random-walk probability is (q/p)^2=(1/9)^2=1/81, approximately 0.012346, under the stated constant-rate independent-discovery assumptions. A merchant’s waiting scenario does not reveal the attacker’s exact private progress. The attacker may have mined blocks during that interval, so the deficit at the time of the decision is itself uncertain. Evaluating that event requires a model that integrates over hidden progress and specifies the success condition; the simple known-deficit result is not an interchangeable confirmation guarantee. In one candidate history, applying the first valid spend removes or marks the output as spent. The second transaction then fails the spend-once condition even if its signature verifies. A branch-selection rule must operate among histories that satisfy validity rules, rather than treating extra work as permission to create an invalid double spend.

Test the limits and transfer the idea

1. Implementation · allow 50 minutes

Implement and challenge an inclusion proof

Build a four-leaf Merkle tree for byte strings A, B, C, D using Python hashlib.sha256. For this teaching format define leaf(x) = SHA256(0x00 || x) and parent(l,r) = SHA256(0x01 || l || r), where || concatenates bytes. The prefix bytes are part of this exercise, not Bitcoin's actual encoding.

Construct an inclusion proof for C, record sibling direction, and write a verifier. Test a changed payload and a reversed sibling direction. Count hashes to build the tree and to verify one proof. Explain what accepting the proof does and does not establish about a transaction.

Get a starting hint

The path from C first combines C with D, then combines the resulting right subtree with the left subtree AB. An unordered list of sibling hashes is insufficient.

Compare your reasoning with the worked solution

C's proof is [(right, leaf(D)), (left, parent(leaf(A), leaf(B)))]. At the first step C is the left child; at the second its subtree is the right child. A minimal complete implementation is:

from hashlib import sha256
def leaf(x): return sha256(b'\x00' + x).digest()
def parent(a,b): return sha256(b'\x01' + a + b).digest()
a,b,c,d = map(leaf, [b'A',b'B',b'C',b'D'])
ab = parent(a,b)
root = parent(ab,parent(c,d))
proof = [('right',d),('left',ab)]
def verify(payload, path, expected):
    current = leaf(payload)
    for side, sibling in path:
        if side == 'right': current = parent(current,sibling)
        elif side == 'left': current = parent(sibling,current)
        else: return False
    return current == expected
assert verify(b'C',proof,root)
assert not verify(b'X',proof,root)
assert not verify(b'C',[('left',d),('left',ab)],root)

Construction uses four leaf hashes and three internal hashes, totaling seven. Verification uses one leaf hash and two internal hashes, totaling three, plus the supplied sibling digests. Under the hash's binding assumptions, acceptance connects this payload to this particular root. It does not establish that the root belongs to the accepted chain, that the spend was authorized, that the inputs were unspent, or that no competing history will be adopted. The whitepaper's compact transaction verification mechanism depends on additional chain and trust assumptions; this local tree test implements only inclusion.

Check your reasoning

  • Preserves sibling direction and passes positive and tampering tests.
  • Counts seven construction hashes and three verification hashes.
  • Separates inclusion under a root from transaction validity and chain acceptance.

2. Probability proof · allow 45 minutes

Solve a bounded catch-up process

An original random-walk model starts with an attacker two blocks behind. Each independent step reduces the deficit by one with probability q = 1/4 and increases it by one with probability p = 3/4. Stop with success at deficit 0 or with failure at deficit 4.

Let H_z be the probability of success starting at deficit z. Derive and solve the boundary equations for z = 1,2,3. Compare H₂ with the probability of ever reaching zero if there is no failure boundary. Explain why neither number is automatically a merchant's double-spend risk after two confirmations.

Get a starting hint

Use H₀ = 1, H₄ = 0, and H_z = qH_(z-1) + pH_(z+1). A solution of the interior recurrence has the form A + B(q/p)^z.

Compare your reasoning with the worked solution

Conditioning on the first step gives H₁ = 1/4 + (3/4)H₂, H₂ = (1/4)H₁ + (3/4)H₃, and H₃ = (1/4)H₂. Substituting the third and first equations into the second yields H₂ = 1/16 + (3/8)H₂. Therefore H₂ = 1/10, H₁ = 13/40, and H₃ = 1/40.

For the closed form, let r = q/p = 1/3. Imposing the two boundary conditions on A + Br^z gives H_z = (r^z - r^4)/(1 - r^4). At z = 2 this is (1/9 - 1/81)/(1 - 1/81) = 1/10. Without an upper absorbing boundary, the eventual catch-up probability in this biased walk is r² = 1/9. It is larger because paths that first reach deficit 4 can still recover later in the unbounded process.

These calculations assume a known current deficit, independent block discoveries, constant hash-power shares, and success defined as reaching a tie. A confirmation-risk model also has to account for work the attacker may already have accumulated while the merchant waited, the protocol's tie behavior, and the attack strategy. The whitepaper discusses catch-up and confirmation calculations, but this finite absorbing barrier is an original exercise, not its deployed security guarantee. Checking the three equations numerically verifies the proposed finite solution; the recurrence and boundary argument explain why it is the solution.

Check your reasoning

  • Derives the first-step equations and obtains H₂ = 1/10.
  • Compares with 1/9 using the difference between bounded and unbounded paths.
  • States why known-deficit catch-up is not the same as confirmation risk.

Check your understanding

Two transactions correctly signed by the same owner spend one output. What do the signatures establish?

  • Both spends must be accepted in one history.
  • One is automatically newer.
  • Authorization evidence, without resolving the conflicting ledger updates.
  • That the transactions have equal proof of work.
Explanation

Authorization and a globally consistent spend history are separate requirements.

What is (q/p)^z in the stated q<p model?

  • Eventual catch-up probability from a known deficit z.
  • A universal probability for every merchant waiting z confirmations.
  • The fraction of all transactions that are invalid.
  • A guarantee that an attack finishes within z seconds.
Explanation

The event and model assumptions must be kept distinct from broader confirmation-risk scenarios.

Original paper and sources

Satoshi Nakamoto. Bitcoin: A Peer-to-Peer Electronic Cash System. White paper, 2008.

Read the original paper →

Read the primary paper: Bitcoin.org