Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Byzantine generals and blockchains

Clear study notes on the Byzantine Generals problem and how blockchains use ideas from Byzantine fault tolerance, with definitions, theorems, algorithm (OM), proofs, examples and exam guidance.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Two-sentence: Distributed systems must keep working even when some nodes act arbitrarily (bugs, hacks, or deliberate misbehaviour). Engineers use Byzantine-fault-tolerant designs and blockchain-style protocols to build resilient consensus in cryptocurrencies, permissioned ledgers, and safety-critical distributed controllers.

Key ideas

  • Byzantine Generals Problem (informal statement): Several generals must agree on a common plan (attack or retreat). Some generals may be traitors who send conflicting messages. The goal is for all loyal generals to agree on the same plan, and if the commander is loyal then the plan must be the commander’s order.

  • Formal definitions used in exam answers:

    • Agreement: All non-faulty (loyal) processes must decide on the same value.
    • Validity (or Correctness): If the commander (or some designated proposer) is non-faulty and proposes value v, then all non-faulty processes must decide v.
    • Byzantine Fault Tolerance (BFT): A protocol tolerates at most f Byzantine faults if it guarantees Agreement and Validity provided at most f nodes are faulty.
  • Precise theoretical result (Lamport, Shostak, Pease 1982) in the oral messages model (no signatures, synchronous rounds; messages are delivered correctly, the receiver knows who sent each message, and the absence of a message is detectable; traitors can lie about values they received but cannot spoof the immediate sender’s identity):

    • Theorem (necessary and sufficient condition): To solve Byzantine agreement with at most f Byzantine faults, you need n ≥ 3f + 1 processes. Equivalently, the maximum f tolerated is floor((n - 1) / 3).
    • Assumptions for this theorem: synchronous rounds, reliable pairwise channels (messages are delivered within bounded delay), no message authentication (traitors can lie about what they were told but cannot impersonate another process as the immediate sender). The theorem gives both the lower bound (impossibility if n ≤ 3f) and a constructive algorithm (OM) that works when n ≥ 3f + 1.
  • The OM (Oral Messages) family of algorithms (OM(0), OM(1), ..., OM(f)):

    • OM(0): Commander sends its value to every lieutenant. Each lieutenant uses the value received (or a default if none).
    • OM(m) for m ≥ 1: Commander sends its value to every lieutenant. Each lieutenant i, upon receiving value v_i from commander, acts as commander and runs OM(m-1) to send v_i to every other lieutenant j. Each lieutenant collects values (the commander’s sent value plus values from other lieutenants) and takes the majority value.
    • Correctness claim: OM(f) achieves Agreement and Validity if n ≥ 3f + 1. The standard proof is by induction on m, using majority properties and the fact that in every recursive step the number of faulty nodes remains ≤ f. OM(f) runs for f + 1 synchronous rounds and has message complexity exponential in f (roughly O(n^{f+1})).
  • Sketch of impossibility proof (necessity of n ≥ 3f + 1):

    • For contradiction, assume n ≤ 3f and a protocol exists tolerating f faults. Partition nodes into three groups A, B, C of sizes at most f. Build two executions that are indistinguishable to some group, leading to conflicting decisions: a classic triangle argument (describe in exam: draw three groups, show messages between two groups can be simulated by malicious nodes in the third group to produce contradictory views). This shows a protocol cannot force both Agreement and Validity if n ≤ 3f.
  • Authentication/signatures change the model: with unforgeable digital signatures and reliable broadcast of signed messages, fewer nodes suffice. In the signed-messages model of Lamport et al., Byzantine agreement is solvable for any f < n (i.e., n ≥ f + 1), for example via the SM/Dolev–Strong algorithm in synchronous networks; however, for state machine replication under (partial) synchrony, classical BFT protocols (e.g., PBFT/HotStuff/Tendermint) still require n ≥ 3f + 1 and use 2f + 1 vote quorums. (I note model-dependence: exact bounds depend on assumptions about signature schemes, synchrony, and whether signatures can be replayed — see verify list.)

  • Blockchain application and differences:

    • Blockchain: an ordered, cryptographically linked sequence of blocks of transactions maintained by a set of participants. Each block references the previous block’s hash.
    • Proof-of-Work (PoW): participants expend computational work to propose a block; the “longest (or heaviest) chain” rule resolves forks. PoW gives probabilistic guarantees against double-spend by making re-writing history costly.
    • Relationship to BFT: permissioned blockchains often use classical BFT protocols (e.g., PBFT) requiring n ≥ 3f + 1 and giving deterministic finality; permissionless blockchains (Bitcoin) use PoW and provide probabilistic finality based on attacker mining power. Nakamoto consensus is effectively a randomized, eventual-consistency solution to Byzantine behaviour under a partially synchronous/ probabilistic model.
  • Diagrams to draw in answers (describe exactly):

    • For OM(m): draw one commander node at top labelled C, three lieutenant nodes below labelled L1, L2, L3. Draw arrows from C to each Li labelled v_i for the commander’s sent values; for OM(1) also draw arrows between lieutenants showing forwarded values. Label the round numbers. Use notes: "apply majority on received values including default if missing."
    • For impossibility (n ≤ 3f): draw three groups A, B, C in a triangle; annotate sizes ≤ f; show how C can simulate messages to A and B leading to contradictory decisions.

Note where I am cautious: statements about how many faults can be tolerated when message authentication (digital signatures) is available depend on the precise communication and adversary model — check the verify list.

Formulas

n >= 3·f + 1 — n is total number of processes (no unit); f is maximum number of Byzantine faults tolerated (no unit). Applies to the oral messages synchronous model (no signatures).

f = floor((n - 1) / 3) — maximum f tolerated for given n in the same model. In many BFT state-machine-replication protocols with n = 3f + 1, safety/commit quorums are size 2f + 1 so that any two quorums intersect in at least f + 1 processes (at least one honest).

n >= 2·f + 1 — (check context) appears for some authenticated or crash-tolerant models; symbol meanings as above. For crash faults under synchronous majority voting, n ≥ 2f + 1 ensures quorum intersection; do not quote n ≥ 2f + 1 for Byzantine consensus under partial synchrony, which still needs n ≥ 3f + 1. Verify applicability before using in answers.

(For blockchains, informal relation at fixed difficulty D:) Expected time between blocks ≈ D / H — H is aggregate hash-rate (hashes per second) and D is the expected number of hashes per block at the current difficulty. Units: seconds. Protocols (e.g., Bitcoin) adjust D to target a fixed average block interval.

Worked examples

  1. Minimum n for f = 2 (numerical)

    • Formula: n >= 3·f + 1.
    • Substitute: n >= 3·2 + 1 = 7.
    • Therefore n must be at least 7 to tolerate 2 Byzantine faults in the oral messages model.
  2. Trace OM(1) with n = 4 (commander C, lieutenants A, B, D) and at most f = 1 faulty node. Let B be the faulty lieutenant who sends conflicting messages.

    • Step 1 (commander sends): C sends value v to A, B, D. Suppose C is honest and sends v = ATTACK; A receives ATTACK, B receives ATTACK, D receives ATTACK.
    • Step 2 (lieutenants forward using OM(0)): Each lieutenant acts as a commander for others using the value it received:
      • A forwards ATTACK to B and D.
      • B (faulty) forwards RETREAT to A and ATTACK to D (conflicting).
      • D forwards ATTACK to A and B.
    • Step 3 (collect and majority): Each lieutenant now has three values: value from C, and values forwarded by the other two lieutenants. For A: {from C=ATTACK, from B=RETREAT, from D=ATTACK} → majority ATTACK. For D: {ATTACK, from A=ATTACK, from B=ATTACK} → majority ATTACK. B is faulty and can decide arbitrarily. Result: A and D agree on ATTACK, satisfying Agreement and Validity.
  3. Blockchain intuition example (qualitative numeric): Suppose an attacker controls 30% of hashing power (q = 0.3). Bitcoin’s analysis shows the probability the attacker can overtake k blocks decreases roughly exponentially with k (for q < 0.5). For k = 6 confirmations the probability becomes very small (commonly cited as acceptable safety), so many exchanges treat 6 confirmations as near-final. Exact probability uses a Poisson model from the Bitcoin paper — see verify.

Common mistakes

  • Confusing deterministic finality (BFT protocols like PBFT in permissioned settings) with probabilistic finality (PoW-based permissionless blockchains).
  • Forgetting to include the default value when a message is missing in OM(0) or OM(m).
  • Drawing message arrows incorrectly for OM recursion: students often omit the forwarded messages between lieutenants in OM(1).

For your exam

Types of questions and what full-mark answers include:

  • Definitions: define Byzantine fault, Agreement, Validity, finality (deterministic vs probabilistic). Include model assumptions (synchrony, message authentication).
  • Short notes: Compare PBFT-style protocols and Nakamoto consensus; list pros/cons (latency, throughput, finality, membership control). Also mention FLP impossibility for deterministic consensus in fully asynchronous systems and the need for partial synchrony/timeouts for liveness in practical BFT protocols (e.g., PBFT/HotStuff/Tendermint).
  • Derivation/proofs: Prove necessity of n ≥ 3f + 1 (triangle/partition argument) and outline correctness of OM(f) by induction. Show base case OM(0) correctness and induction step using majority property.
  • Trace/algorithm: Run OM(1) on a small network; show messages sent and the majority decision.
  • Diagram question: Draw the three-group partition for impossibility proof and label group sizes ≤ f; or draw OM(1) message flow with rounds.
  • Numerical: Given n, compute maximum f = floor((n - 1) / 3). For blockchains, explain meaning of k confirmations.

A full-marks answer always states the model assumptions before stating bounds, gives the constructive algorithm (OM) or references a standard protocol (PBFT/Paxos/Raft) as appropriate (note: Paxos/Raft are crash-fault tolerant, not Byzantine), and supplies the required diagram or step-by-step reasoning.

Quick check

  1. State the Agreement and Validity properties for Byzantine agreement.
  2. What minimum n is needed to tolerate f = 3 Byzantine faults in the oral messages model?
  3. Name one major difference between PBFT-style consensus and Nakamoto consensus.

Answers: 1) Agreement: all honest processes decide same value; Validity: if commander (or proposer) is honest and proposes v then honest processes decide v. 2) n >= 3·3 + 1 = 10. 3) PBFT gives deterministic finality and requires fixed membership (permissioned) with n >= 3f + 1; Nakamoto uses probabilistic finality via PoW and works in a permissionless setting.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?