A blockchain transaction ledger is, stripped of all the hype, a replicated append-only log that a set of mutually distrusting machines agree on. Clients submit transactions; a network of validator nodes has to decide a single total order over those transactions, pack them into blocks, and append each block to a hash-linked chain such that every honest validator ends up with the byte-identical chain in the byte-identical order. The “immutable” part is a consequence, not a feature you build directly: each block commits to the previous block’s hash, so changing an old transaction changes every hash after it, which the honest majority will reject. The hard, interesting part is the agreement.

The reason this is not just “Raft with extra steps” is the threat model. In a normal replicated log (Raft, Paxos, a primary-replica database) you assume nodes can crash or go slow, but a node that does respond tells the truth. A blockchain assumes the opposite: some fraction of validators are Byzantine - actively malicious. They can send different votes to different peers, propose two conflicting blocks at the same height (equivocate), sign invalid transactions, selectively withhold messages, or collude to try to fork the chain or double-spend. Crash fault tolerance tolerates f failures out of 2f+1 nodes. Byzantine fault tolerance needs 3f+1 nodes to tolerate f liars, because you have to out-vote not just the silent but the actively deceitful. That one change - “a responding node might be lying” - is what forces the whole design.

So the real problem the assignment names is precise: order and finalize peer-submitted transactions into one immutable chain using a Byzantine fault-tolerant consensus algorithm, keep throughput above 1,000 TPS, and get deterministic ordering across validators so every honest node appends identical blocks in identical sequence - without a single leader becoming a throughput bottleneck or a single point of failure. The leader tension is the crux. Classic BFT (PBFT, Tendermint) uses a single leader per round to propose the block, which is simple and gives a clean total order, but that leader is both a throughput ceiling (all proposals funnel through one node’s bandwidth) and a liveness risk (a crashed or censoring leader stalls the round). The design is about keeping BFT’s safety while taking the leader off the critical path. Let me do this like an interview: requirements, sizing, the end-to-end architecture, then take the genuinely hard parts - deterministic ordering, the BFT consensus itself, leader bottleneck removal, and finality - naive-first, break them, and evolve.

Functional Requirements (FR)

In scope:

  • Transaction submission and validation. Any client can submit a signed transaction to any validator. Each validator checks the signature, the nonce (replay protection), and that the transaction is well-formed and the sender has the funds/authorization. Invalid transactions are rejected before they ever reach consensus.
  • Deterministic total ordering. The network must agree on one global sequence of transactions. Given the same set of pending transactions, every honest validator must be able to compute the same ordered block - no ambiguity, no node-local tie-breaking that differs across nodes. This determinism is what lets replicas verify each other’s blocks instead of re-negotiating.
  • Byzantine fault-tolerant block agreement. Validators run a consensus protocol that commits a block at each height such that, with up to f Byzantine validators out of 3f+1, all honest validators commit the same block at that height and never two different blocks (safety), and the chain keeps making progress as long as 2f+1 validators are honest and connected (liveness).
  • Immutable append-only chain. Each committed block contains the hash of the previous block, a Merkle root over its transactions, the height, a timestamp, and the aggregated signatures (the commit certificate) proving 2f+1 validators agreed. Appending is the only mutation; there is no update or delete.
  • Deterministic state execution. Applying the ordered transactions to the ledger state (account balances / the state trie) must be deterministic - same block, same starting state, same resulting state root on every node - so validators can agree on state, not just on the ordering of bytes.
  • Finality. A committed block is final after its commit certificate forms - no probabilistic “wait N confirmations” rollback risk. A client that sees a finalized transaction can treat it as permanent.
  • Membership / validator set management. The set of validators (and in Proof of Stake, their stake weights) is itself recorded on-chain and can change over epochs via staking/unstaking transactions.

Explicitly out of scope (state this to bound the problem):

  • Smart-contract VM / Turing-complete execution. We assume transactions are value transfers (or simple typed operations) with deterministic execution. A general contract VM (gas metering, re-entrancy, the EVM) is a large separate problem layered on top.
  • The peer-to-peer gossip/discovery layer internals. We assume an authenticated broadcast primitive among validators (each can send a signed message that reaches the others). Building the libp2p-style transport, NAT traversal, and peer discovery is adjacent, not core.
  • Light clients / SPV proofs, cross-chain bridges, token economics. Consumers of finalized state and the monetary policy are out of scope; we produce the ledger.
  • Mempool MEV / fair-ordering fairness guarantees. We order deterministically and resist censorship, but we do not solve maximal-extractable-value fairness (a research area of its own).

The single decision that drives everything: the ledger is a deterministically-ordered, hash-linked, BFT-committed append-only log, and the threat model is Byzantine, not crash. Every hard part below exists because a validator that answers you might be lying, equivocating, or colluding - so “agreement” means out-voting malice, and “immutable” means cryptographically expensive to rewrite, not merely access-controlled.

Non-Functional Requirements (NFR)

  • Throughput: sustain > 1,000 TPS. The system must commit at least a thousand transactions per second steady-state, which (as the BoE shows) sets block size and block interval, and is the number that kills single-leader designs where one node must broadcast every proposal.
  • Finality latency: low single-digit seconds, deterministic. From submission to finalized should be a few seconds at most, and finality is absolute (BFT commit certificate), not probabilistic. No “wait 6 blocks” rollback window like Nakamoto/PoW.
  • Safety under f Byzantine out of 3f+1. Up to one third of validators (by stake, in PoS) can be arbitrarily malicious and the honest nodes still never commit two conflicting blocks at the same height. Safety is non-negotiable and must hold even under full asynchrony (no timing assumption can be allowed to break safety - only liveness may depend on timing).
  • Liveness under partial synchrony. As long as more than two thirds of validators (by stake) are honest and the network eventually delivers messages within some bound, the chain keeps producing blocks. During a partition or leader failure, progress may pause, but it resumes without manual intervention and without ever sacrificing safety.
  • No single point of failure. No one validator’s failure, slowness, or censorship can permanently stall the chain. Leadership rotates and failed leaders are bypassed by a view-change/timeout mechanism within a bounded time.
  • Durability: absolute. A finalized block is never lost or reordered. Each validator persists the chain and the commit certificates to disk before acting on them (write-ahead), so a crash-restart rejoins at the exact committed height.
  • Determinism: total. Ordering, execution, and serialization must be bit-for-bit deterministic across heterogeneous nodes (different hardware, compilers) - otherwise validators would compute different state roots and never agree. This bans floating point nondeterminism, map-iteration-order dependence, and wall-clock-in-execution.

Back-of-the-Envelope Estimation (BoE)

Let me ground the numbers, because they set block size, block interval, validator count, and bandwidth - and they are what push the design off a single leader.

Throughput target and block sizing:

Target throughput              >= 1,000 TPS  (design for headroom: aim 2,000-4,000)
Avg transaction size           ~250 bytes (2 signatures, addresses, amount, nonce, fee)
Block interval (target)        1 second  (finality in a few seconds, few blocks)
Txns per block @ 2,000 TPS     2,000 tx/block x 1s = 2,000 txns
Block payload size             2,000 x 250 B = 500 KB per block
Block header + commit cert     ~few KB (prev hash, merkle root, height, signatures)

A 1-second block carrying ~2,000 transactions is 500 KB. That is the unit the network must propose, broadcast, and agree on every second.

Validator count and the quorum math:

Validators (N)                 ~100  (typical for a performant PoS BFT chain;
                                       hundreds is the practical ceiling for all-to-all)
Byzantine tolerance            f = floor((N-1)/3) = 33 malicious tolerated at N=100
Quorum for commit (2f+1)       67 of 100 validators (by stake weight in PoS)

Why ~100 and not 10,000: BFT consensus is all-to-all voting (each validator’s vote must reach the others), which is O(N^2) messages per round. That is fine at N=100 (10,000 messages), painful at N=1,000, impossible at N=10,000 without signature aggregation and committee sampling. N=100 is the sweet spot where you get real decentralization and the O(N^2) is cheap.

The single-leader bandwidth wall (why the leader cannot carry block bodies):

Naive single leader: leader broadcasts the full 500 KB block to all N-1 peers.
  Leader egress per block = 500 KB x 99 peers = ~49.5 MB per block per second
  = ~396 Mbps sustained, out of ONE node.
At 4,000 TPS (1 MB blocks): ~99 MB/block = ~792 Mbps out of one node.
  -> the leader's uplink is the throughput ceiling. This is THE bottleneck
     the assignment names. The leader must NOT ship the block body.

This is the number that defines the design. If the leader broadcasts full block bodies, its uplink caps the whole chain’s throughput, and raising TPS just moves the wall. The fix (deep dive) is to decouple transaction dissemination from ordering: validators gossip transactions peer-to-peer continuously, and the leader proposes only a tiny ordering (hashes/references), never the bodies.

Consensus message overhead (the O(N^2) term):

Per block, a BFT round has ~3 voting phases (propose, prevote, precommit).
Vote message size              ~200 bytes (block hash + signature + height/round)
Votes per phase                N validators each broadcast to N-1 = N x (N-1)
At N=100: 100 x 99 = 9,900 messages/phase x ~3 phases = ~29,700 msgs/block
Per-validator vote egress      ~99 peers x 200 B x 3 phases = ~59 KB/block  (tiny)

Voting traffic is negligible per node (~59 KB/block) - votes are small. The expensive thing is the block body, which is exactly why we keep the body off the voting/leader path and gossip it separately. With BLS signature aggregation, the 2f+1 precommit signatures collapse into one ~96-byte aggregate, shrinking the commit certificate from ~67 signatures to one.

Storage growth:

Block payload @ 2,000 TPS      500 KB/block x 1 block/s = 500 KB/s
Per day                        500 KB x 86,400 s = ~43 GB/day
Per year                       ~43 GB x 365 = ~15.7 TB/year of raw chain data
State (account balances)       bounded by #accounts, not throughput:
                               100M accounts x ~100 B = ~10 GB state trie (fits in RAM/SSD)

Raw chain grows ~16 TB/year - manageable on disk, and old blocks can be archived while validators keep only recent blocks plus the current state (state is small, ~10 GB, because it is keyed by account, not by history). This motivates separating the archival chain from the live state.

Bandwidth per validator (steady state):

Transaction gossip (dissemination): each tx seen ~once + some redundancy.
  2,000 tx/s x 250 B x ~2 (gossip fanout redundancy) = ~1 MB/s in + ~1 MB/s out
Block body (pulled once if missing)  amortized into the gossip above
Consensus votes                      ~59 KB/block = negligible
Per-validator steady bandwidth       ~a few MB/s  -> trivially within a datacenter link

The key insight from the numbers: block bodies are big (500 KB/s) and votes are tiny (~59 KB/block), so the design must disseminate transaction bodies by peer-to-peer gossip spread evenly across all validators, and run the expensive O(N^2) BFT voting only over tiny block hashes. The moment the leader has to ship bodies, its uplink is the ceiling; take the bodies off the leader and the leader proposes only a cheap ordering, which is what breaks the single-leader bottleneck.

High-Level Design (HLD)

The architecture is a network of ~100 validator nodes, each running four subsystems - a mempool + gossip layer (disseminates transactions peer-to-peer), a BFT consensus engine (agrees on block ordering), a deterministic execution engine (applies ordered blocks to state), and a persistent store (the append-only chain and the state trie) - plus client-facing RPC for submission and queries. There is deliberately no central sequencer; ordering emerges from the consensus protocol, and transaction bodies never funnel through one node.

Four logical layers per validator:

  • Mempool and dissemination (gossip). Receives transactions from clients and peers, validates them (signature, nonce, balance), de-duplicates, and gossips them to peers so every validator independently accumulates the same pool of pending transactions. This is the layer that carries the 500 KB/s of bodies - spread across all nodes, not through the leader.
  • Consensus engine (BFT). Runs the leader-based BFT protocol (propose, prevote, precommit) to agree, at each height, on an ordered block. Crucially the proposer proposes a block that references transactions (by hash / by a compact list the peers already have via gossip), and the voting is over the block hash. Leadership rotates every height. This is where Byzantine agreement happens.
  • Execution engine (deterministic state machine). Takes the committed, ordered block and applies each transaction to the state trie deterministically, producing a new state root. The state root goes into the next block header so validators agree on state, not just ordering.
  • Store (append-only chain + state). Write-ahead persists the block, its commit certificate, and the new state root before acting. The chain is immutable (hash-linked); the state trie is a versioned key-value structure (Merkle-Patricia) keyed by account.
   Clients (wallets, dApps, exchanges)                         Clients
        │  submit signed txn / query                              │
        ▼                                                         ▼
 ┌─ VALIDATOR A (one of ~100) ───────────────┐          ┌─ VALIDATOR B ──────────┐
 │  RPC: submit() / getTx() / getBlock()      │          │  RPC                   │
 │        │                                   │          │                        │
 │        ▼                                   │          │                        │
 │  ┌──────────────┐   gossip txns (bodies)   │          │  ┌──────────────┐      │
 │  │  MEMPOOL +   │◄────────────────────────┼──────────┼─►│  MEMPOOL +   │      │
 │  │  GOSSIP      │   validate, dedupe,      │          │  │  GOSSIP      │      │
 │  │ (carries the │   spread 500 KB/s evenly │          │  └──────┬───────┘      │
 │  │  big bodies) │                          │          │         │              │
 │  └──────┬───────┘                          │          │         │              │
 │         │ pending txns (everyone has them) │          │         │              │
 │         ▼                                  │          │         ▼              │
 │  ┌──────────────────────────┐  BFT votes   │          │  ┌──────────────┐      │
 │  │  CONSENSUS ENGINE (BFT)   │  (tiny: hash │          │  │  CONSENSUS   │      │
 │  │  propose(hashes/order) -> │  + signature)│          │  │  ENGINE      │      │
 │  │  prevote -> precommit ->  │◄────────────┼──────────┼─►│  O(N^2) votes│      │
 │  │  COMMIT (2f+1 cert)       │  all-to-all  │          │  └──────┬───────┘      │
 │  │  leader rotates each height│             │          │         │              │
 │  └──────────┬───────────────┘              │          │         │              │
 │             │ committed ordered block       │          │         ▼              │
 │             ▼                              │          │  ┌──────────────┐      │
 │  ┌──────────────────────┐                  │          │  │  EXECUTION   │      │
 │  │  EXECUTION ENGINE     │  deterministic   │          │  │  (same block │      │
 │  │  apply txns -> state  │  -> state root   │          │  │   -> same    │      │
 │  │  root (must match!)   │                  │          │  │   state root)│      │
 │  └──────────┬───────────┘                  │          │  └──────┬───────┘      │
 │             ▼                              │          │         ▼              │
 │  ┌──────────────────────┐                  │          │  ┌──────────────┐      │
 │  │ STORE: append-only    │  write-ahead     │          │  │ STORE        │      │
 │  │ chain + state trie    │  before acting   │          │  │ chain+state  │      │
 │  │ block_n -> hash(n-1)  │                  │          │  └──────────────┘      │
 │  └──────────────────────┘                  │          │                        │
 └────────────────────────────────────────────┘          └────────────────────────┘
      every honest validator ends with the byte-identical chain in identical order

Submission and dissemination flow (continuous, off the critical consensus path):

  1. A client signs a transaction and submits it via RPC to any validator (or several).
  2. That validator validates it: signature verifies, nonce is the sender’s next expected nonce (replay protection), sender has sufficient balance + fee, transaction is well-formed. Invalid -> rejected immediately, never gossiped.
  3. The validator adds it to its mempool and gossips it to its peers. Peers validate and re-gossip (with de-duplication by txn hash). Within a gossip round or two, every honest validator has the transaction in its mempool. The 500 KB/s of bodies is spread evenly across all 100 nodes, not pushed through one.

Consensus flow (per height, leader-based BFT, but leader proposes only ordering):

  1. For height H, a deterministic rotation selects the proposer (round-robin or stake-weighted over the validator set - everyone computes the same proposer for (H, round)).
  2. The proposer picks an ordered list of transactions from its mempool (deterministic ordering rule - see deep dive), and broadcasts a proposal containing the block header + the ordered list of transaction hashes (and a compact availability proof), not the full bodies. Peers already have the bodies from gossip; if a peer is missing one, it pulls just that txn from a peer. The proposal is a few KB, not 500 KB.
  3. Prevote: each validator checks the proposal is valid (proposer is correct for this height/round, every referenced txn is known and valid, the ordering rule was followed) and broadcasts a signed prevote for the block hash (or for nil if invalid/timed out).
  4. Precommit: when a validator sees 2f+1 prevotes for the same block hash (a polka), it locks on that block and broadcasts a signed precommit.
  5. Commit: when a validator sees 2f+1 precommits for the block hash, the block is committed. Those 2f+1 precommit signatures form the commit certificate (aggregated via BLS into one signature) - proof of finality that any node can verify.

Execution and append flow:

  1. Every validator applies the committed block’s transactions in the agreed order to its state trie, deterministically, producing a new state root.
  2. It write-ahead persists the block, the commit certificate, and the new state root. The block header links to the previous block’s hash, extending the immutable chain.
  3. If a validator’s computed state root disagrees with the committed block’s declared root, that is a fatal consensus bug or a Byzantine proposer; the honest 2f+1 agreed on a root, so the dissenter halts and alerts rather than forking.

Component Deep Dive

Four hard parts, each taken naive-first: (1) deterministic transaction ordering so every honest node builds the identical block; (2) the BFT consensus protocol itself - how 3f+1 nodes agree despite f liars; (3) removing the single-leader bottleneck and single point of failure; (4) finality and view-change (recovering from a bad or dead leader without forking). I break each before fixing it.

1. Deterministic transaction ordering

The goal: given a set of pending transactions, every honest validator must agree on one order, and the proposer’s chosen order must be verifiable by everyone else - not trusted blindly.

Naive A: order by arrival time at each node

Each validator orders transactions by the local timestamp it received them.

Where it breaks:

  • No two nodes see the same arrival order. Gossip delivers transactions in different orders to different peers, so node X thinks txn1 arrived before txn2 and node Y thinks the reverse. If ordering is arrival-based and node-local, every validator builds a different block, and consensus has nothing to agree on - or must re-negotiate the entire ordering from scratch, which is the expensive thing we are trying to avoid.
  • Wall-clock is non-deterministic and forgeable. Clocks skew; a Byzantine node can claim any timestamp. Ordering on an attacker-controllable, node-local value is both nondeterministic and manipulable.

Arrival order is fine as an input hint but useless as the canonical order, because it is not a function of shared data.

Naive B: the leader’s chosen order is final, everyone just trusts it

The proposer orders transactions however it likes and the others accept whatever the leader sends.

Where it breaks:

  • A Byzantine leader controls ordering entirely - it can front-run, censor specific senders (omit their transactions), or insert its own transactions ahead of others (MEV). “Trust the leader’s order” hands all ordering power to a single, possibly-malicious node each round.
  • Nothing to verify against. If the order is arbitrary and unverifiable, validators cannot detect a misbehaving proposer; they either accept malice or reject everything, with no principled middle.

The root problem in both: ordering must be a deterministic function of data every honest node shares, and the proposer’s output must be checkable against that function - not a local observation (A) and not an unverifiable leader whim (B).

Better: proposer proposes an order; validators verify it against a deterministic rule over shared mempool content

  • Canonical ordering rule. Define a total order that is a pure function of transaction content, not arrival time. For example: order by (gas price / fee descending, then by transaction hash ascending) for economic priority with a deterministic tie-break; or strictly by txn hash for neutrality; whatever the policy, it is a fixed, published function. Because the function depends only on the transactions’ bytes - which every honest node has from gossip - any honest node can recompute the exact order.
  • Proposer proposes, validators check. The proposer builds the block by applying the canonical rule to its mempool and broadcasts the ordered list of hashes. Each validator, in the prevote phase, recomputes the canonical order over its view of the referenced transactions and checks the proposal matches (and that all referenced transactions are valid and nonces are sequential per sender). If the proposer violated the rule - censored a high-fee txn it clearly had, or reordered to front-run - honest validators prevote nil and the round fails, rotating to a new proposer. So the proposer has latitude in which transactions to include (it cannot be forced to include a txn it genuinely has not seen) but no latitude in how to order the ones it includes.
  • Per-sender nonce sequencing enforces intra-sender order. Within a single sender’s transactions, order is pinned by nonce (nonce 5 must come before nonce 6), independent of fee. This prevents reordering a single account’s operations and is trivially verifiable.
  • Deterministic execution closes the loop. Ordering alone is not enough; executing the ordered block must be deterministic too (no floating point, no map-iteration-order dependence, no wall-clock reads in execution, canonical serialization). Then every validator that agrees on the order also agrees on the resulting state root, and the state root in the header becomes a second thing consensus pins down - so a Byzantine proposer cannot slip in a block whose declared state differs from honest execution.
Mempool (every honest node has ~the same set from gossip):
   tx_a (fee=50, hash=0x9f..)   tx_b (fee=90, hash=0x12..)   tx_c (fee=50, hash=0x4e..)

Canonical rule: fee DESC, then hash ASC, nonce-sequential per sender
   -> deterministic order: [ tx_b(90), tx_c(50,0x4e), tx_a(50,0x9f) ]

Proposer broadcasts: block{ height, prev_hash, order=[hash_b, hash_c, hash_a],
                            state_root, txn_count }       (hashes only, ~few KB)

Each validator in PREVOTE:
   recompute canonical order over referenced txns -> must equal proposed order
   verify every txn valid + nonces sequential
   re-execute -> state_root must match
   match? prevote(block_hash)   mismatch/censorship? prevote(nil) -> round fails

Why this wins: ordering becomes a verifiable function of shared data rather than a local observation or an unchecked leader decision. The proposer is a sequencer whose work every other node audits in the same step it votes, so a Byzantine proposer that misorders or front-runs is caught and its round discarded, while honest proposers’ blocks are accepted by everyone because everyone computes the identical order. Determinism in both ordering and execution is what lets validators agree on byte-identical blocks and state roots - the “identical blocks in identical sequence” the assignment demands.

2. The BFT consensus protocol - agreeing despite liars

The goal: at each height, all honest validators commit the same block (safety), and the chain keeps advancing while 2f+1 are honest (liveness), tolerating f Byzantine validators out of 3f+1.

Naive: simple majority vote (crash-fault style, like Raft)

Collect votes; whatever block gets f+1 (a simple majority of 2f+1) wins. This is how crash-tolerant consensus works.

Where it breaks:

  • Equivocation forks the chain. A Byzantine proposer sends block X to half the validators and block Y to the other half. With simple-majority counting, X can gather a majority in one partition’s view and Y in another, and two honest nodes commit different blocks at the same height. That is a fork - the cardinal sin. Simple majority has no defense against a node that says different things to different peers.
  • f liars + silent honest nodes defeat a 2f+1-node system. With only 2f+1 nodes you cannot distinguish f Byzantine nodes from f slow-but-honest ones; a quorum of f+1 can be entirely the f liars plus one honest, or entirely honest - you cannot tell, so you cannot safely commit.

Crash-fault consensus assumes a responding node is honest; drop that assumption and simple majority forks.

Naive: single round of 2f+1 votes, commit immediately

Use 3f+1 nodes and require 2f+1 votes (the correct quorum size), but commit as soon as you see 2f+1 prevotes - one voting phase.

Where it breaks:

  • One phase cannot prevent conflicting commits across rounds. Suppose 2f+1 prevote block X but some precommit messages are lost and the round times out before everyone sees the quorum. A later round might gather 2f+1 for a different block Y (the f Byzantine nodes vote both ways across rounds, and honest nodes that never saw X’s quorum feel free to vote Y). Node that saw X’s quorum commits X; others commit Y. Fork. You need a second phase that makes validators lock on a value and a rule that a later round cannot change a locked value without proof.

The deep reason BFT needs two voting phases (and 3f+1): one phase establishes that a quorum exists; the second establishes that the quorum is durable across rounds so no later round can contradict it.

Better: two-phase BFT with locking and 3f+1 nodes (Tendermint/PBFT-style)

  • 3f+1 validators, 2f+1 quorum. With 3f+1 nodes, any two 2f+1 quorums overlap in at least f+1 nodes, so they share at least one honest node. That honest node will not vote for two conflicting blocks, which is exactly what makes two conflicting commits impossible. This quorum-intersection argument is the mathematical heart of BFT.
  • Two voting phases: prevote then precommit. After the proposal, validators broadcast prevotes. Seeing 2f+1 prevotes for a block (a polka) proves a super-majority finds it valid. Validators then lock on that block and broadcast precommits. Seeing 2f+1 precommits commits the block. The lock is the key: once an honest validator precommits (locks) block X at round r, it will not prevote a different block in a later round unless it sees a newer polka for that different block at a round > r. This locking rule is what prevents the cross-round fork of the naive single-phase design.
  • Equivocation is detectable and slashable. Every vote is signed. A Byzantine node that sends conflicting votes for the same height/round produces two signed messages that are cryptographic proof of misbehavior. In Proof of Stake, that proof is submitted on-chain and slashes the offender’s stake - burning a large fraction of their bonded tokens. So equivocation is not just out-voted, it is economically punished, which disincentivizes the attack in the first place.
  • The 2f+1 precommit set is the finality certificate. The collection of 2f+1 signed precommits for a block is the proof the block is final. Aggregated with BLS into a single ~96-byte signature, it rides in the next block header. Any party - a validator rejoining, a light client - can verify finality by checking that aggregate against the known validator public keys, without replaying the protocol.
Height H, round r, proposer P (deterministically chosen for (H,r)):

  PROPOSE   P broadcasts block B (ordered txn hashes + state_root)
              │
              ▼
  PREVOTE   each validator: B valid & canonical-order correct?
              yes -> prevote(B)   no/timeout -> prevote(nil)
              │  collect votes (all-to-all, O(N^2))
              ▼
          see 2f+1 prevotes for B  ===> POLKA. Lock on B.
              │
              ▼
  PRECOMMIT each locked validator -> precommit(B)   (signed)
              │  collect precommits
              ▼
          see 2f+1 precommits for B ===> COMMIT B. FINAL.
              2f+1 precommit signatures -> BLS-aggregated commit certificate

  Safety: any two 2f+1 quorums overlap in >= f+1 nodes -> >= 1 honest node in common
          that honest node votes for at most one block -> no two blocks commit at H.
  Locking: a validator that precommitted B at round r won't prevote B' != B at
           round r'>r unless it sees a 2f+1 polka for B' at some round > r.
           -> later rounds cannot silently contradict a committed value.

Why this wins: 3f+1 with 2f+1 quorums makes every pair of quorums share an honest node, so conflicting commits are mathematically impossible however the f Byzantine nodes vote; the two-phase prevote/precommit with locking extends that guarantee across rounds so a timed-out or disrupted round cannot later be overturned; and signed votes turn equivocation into on-chain-provable, stake-slashing evidence so the attack is punished, not merely tolerated. This is deterministic, absolute finality - a committed block can never roll back - which is strictly stronger than probabilistic PoW finality.

3. Removing the single-leader bottleneck and single point of failure

This is the crux the assignment names: the leader must not be a throughput ceiling or a liveness SPOF.

Naive: the leader broadcasts the full block (bodies and all) to everyone

The classic PBFT shape: the primary assembles the block, including all transaction bytes, and multicasts it.

Where it breaks:

  • Leader uplink is the throughput wall. From the BoE, broadcasting a 500 KB block to 99 peers is ~396 Mbps out of one node per block; at 4,000 TPS it is ~792 Mbps. Raising TPS just raises the leader’s required uplink until it cannot keep up, and every block routes through whichever node is leader this round. One node’s bandwidth caps the entire chain. This is precisely the bottleneck.
  • Leader is a liveness SPOF and a censorship chokepoint. If the leader is slow, partitioned, or deliberately stalling, the whole round stalls until a timeout fires. A malicious leader can censor by simply never including certain senders’ transactions. All proposing power each round sits in one node.

Naive: no leader at all - everyone proposes, intersect the proposals

Remove the leader; every validator proposes its own block and they try to merge.

Where it breaks:

  • No clean total order emerges. If 100 nodes each propose a different ordering, you are back to the ordering problem at 100x scale with no designated sequencer to break ties, and merging 100 conflicting proposals into one agreed order is itself a consensus problem - you have not removed the hard part, you have multiplied it.
  • O(N) concurrent proposals, O(N^2) voting per proposal - a message explosion with no convergence guarantee.

Leaderless is appealing but turns ordering into a free-for-all; some designated-sequencer-per-height structure genuinely simplifies total order. The fix is not to delete the leader but to shrink its job to the one thing only a sequencer can do.

Better: separate dissemination from ordering - leader proposes only references, bodies gossip peer-to-peer, leadership rotates

  • Decouple data availability from consensus. Transaction bodies are disseminated continuously by the mempool gossip layer, spread evenly across all 100 validators (each node relays a share - the 500 KB/s is ~1 MB/s per node, trivial). By the time a block is proposed, every honest validator already has the transactions. The leader therefore proposes only the ordering - a list of transaction hashes plus the header - a few KB, not 500 KB. The leader’s egress per block drops from ~396 Mbps to a few hundred KB. The bandwidth wall is gone because the big data never flows through the leader.
  • Data-availability check before voting. A validator only prevotes a proposal if it can confirm it has (or can immediately pull) every referenced transaction. If it is missing a few, it pulls just those from peers (not from the leader). This stops a Byzantine leader from proposing a block referencing transactions it withholds (an unavailability attack): if the data is not available to 2f+1 honest nodes, the block cannot gather a polka and the round rotates.
  • Rotate leadership every height; bypass failures by timeout. The proposer for height H is chosen deterministically (stake-weighted round-robin). No node is the permanent leader, so no node is a permanent bottleneck or censorship point - over any window, proposing duty is spread across all validators by stake. If the current proposer is slow or malicious (no valid proposal within the round timeout), validators prevote nil, the round times out, and the protocol advances to round r+1 with the next proposer for the same height (view change). A dead or censoring leader costs one round-timeout of delay, then is bypassed - never a permanent stall.
  • Pipeline across heights for throughput. Because dissemination is continuous and independent of the current round, the mempool for height H+1 fills while height H is being voted on. Consensus can pipeline: start proposing H+1 as soon as H commits (or even overlap the phases, as in HotStuff’s pipelined two-phase design), keeping the block rate at ~1/s without waiting out the full propose-vote-execute latency serially.
  • Optional: committee sampling for very large validator sets. If N grows past the all-to-all O(N^2) comfort zone, randomly sample a smaller voting committee per height (verifiably, via a VRF) so voting stays O(committee^2) while the full stake set still backs security. At N=100 we do not need this; it is the lever for N in the thousands.
BEFORE (leader ships bodies):               AFTER (leader ships only order):

 leader --[500 KB block]--> 99 peers         txns gossip peer-to-peer, continuously,
   = ~396 Mbps out of ONE node                spread across all 100 nodes (~1 MB/s each)
   -> leader uplink = throughput ceiling              │  everyone already has the bodies
                                                       ▼
                                             leader --[few-KB list of hashes]--> peers
                                               = a few hundred KB/s out of leader
                                               -> no bandwidth wall; leader rotates each
                                                  height; dead leader bypassed in 1 timeout

 Availability guard: prevote only if you have every referenced txn (pull missing
 ones from peers, not the leader) -> Byzantine leader can't propose withheld data.

Why this wins: by splitting “get the transactions to everyone” (bulk, parallelizable, done by gossip across all nodes) from “agree on their order” (tiny, done by the leader + O(N^2) voting over hashes), the leader’s job shrinks to the one irreducible sequencing task, and its bandwidth stops being the throughput ceiling - the chain scales with aggregate network capacity, not one node’s uplink. Rotating leadership and timeout-driven view change mean no node is a permanent bottleneck or a single point of failure: a bad leader is bypassed in one round, and proposing duty spreads across the whole validator set. That is exactly “keep throughput above 1,000 TPS without a single leader becoming a bottleneck or SPOF.”

4. Finality and view change - recovering from a bad round without forking

The goal: when a proposer is faulty or the network hiccups mid-round, the protocol must move on and still never commit two different blocks at the same height.

Naive: on any timeout, just move to the next proposer and start fresh

If a round stalls, drop everything and let the next proposer propose whatever it wants.

Where it breaks:

  • A validator may have already committed in the stalled round. Suppose some honest nodes saw 2f+1 precommits for block X (so X is committed for them and final) but others timed out before seeing the quorum. If the next round lets the new proposer propose a different block Y with no constraint, honest nodes that did not see X’s quorum could commit Y. Fork - at a height where X was already final. Starting “fresh” throws away the locking that prevents exactly this.

Better: locked values and polka proofs carry across rounds (view change with justification)

  • Carry the lock across rounds. When an honest validator precommits block X at round r, it records (locked_block = X, locked_round = r). In any later round r' > r, it will only prevote X - not any other block - unless the new proposer presents a polka proof (a set of 2f+1 prevotes) for a different block at some round between r and r’. In other words, a later round cannot move a validator off its locked value without proving a super-majority already moved on at a higher round. Since X being committed means 2f+1 precommitted it, and precommitting requires a polka, any competing block would need its own polka at a higher round - which cannot form if 2f+1 are locked on X. This is what makes committed blocks unforkable even through view changes.
  • Proposer must justify re-proposals. A new proposer that wants to propose block Y different from what validators might be locked on must include the justification (the highest polka it has seen). Honest validators reject an unjustified attempt to override a lock, prevoting nil. So the only way a round can legitimately commit a new block is if no conflicting commit could have happened.
  • Round timeouts grow (partial synchrony). Each failed round increases the round timeout (exponential backoff), so during a network disruption the protocol slows down rather than spinning, and once messages flow within the (now larger) timeout, a round completes and the chain resumes. Safety never depends on the timeout being right - only liveness does. If the timeout is too short, you get more empty rounds but never a fork; this is the “safety under asynchrony, liveness under partial synchrony” split.
  • Finality is a verifiable certificate, not a wait. The instant a validator sees the 2f+1 precommit quorum, the block is final - no confirmation-depth wait, no reorg risk. The aggregated certificate is durable proof: a node that was partitioned and rejoins fast-forwards by verifying each block’s commit certificate against the validator set, without re-running consensus. This is the deterministic finality the NFR demands, and it is why a client can treat a finalized transaction as permanent immediately.
  • Crash-restart safety via write-ahead. Before a validator sends a precommit (a binding, slashable vote), it write-ahead logs its vote and lock state to disk. On restart it reloads (locked_block, locked_round) and the last committed height, so it never votes contradictorily after a crash - a restart cannot make an honest node equivocate.
Round r: block X gets 2f+1 precommits for SOME honest nodes -> X FINAL (for them)
         others time out before seeing the quorum (X is still final, they just haven't seen it)

Round r+1: new proposer wants to propose Y != X
   validators locked on X at round r will ONLY prevote Y if shown a 2f+1 POLKA
   for Y at a round > r.  But 2f+1 are locked on X -> no polka for Y can form
   -> Y cannot get a polka -> Y cannot be committed. X stands. NO FORK.

   Meanwhile the timed-out honest nodes eventually see X's commit certificate
   (gossiped) and adopt X. The chain converges on X at height H. Round r+1 then
   proposes height H+1.

 Timeout backoff: each empty round doubles the round timer -> rides out disruption,
 resumes when messages fit the window. Safety independent of timing; only liveness waits.

Why this wins: locking plus polka-justified view change means the only block that can ever commit at a height is one no honest node could have already contradicted - so proposer failures and network hiccups cost rounds (liveness), never forks (safety). Finality is an aggregated certificate a node verifies in isolation, giving deterministic, immediate, non-reversible finality and letting crashed or partitioned validators rejoin by certificate-checking rather than re-deriving history. That is the complete answer to “immutable append-only chain where every honest node appends identical blocks in identical sequence,” surviving faulty leaders without a single point of failure.

API Design & Data Schema

Two surfaces: the client-facing RPC (submit and query) and the validator-to-validator consensus/gossip wire protocol (internal). Plus the on-disk schemas for the chain and state.

Client-facing RPC

POST /tx
  body: { from, to, amount, nonce, fee, signature, (optional) data }
  -> 202 { tx_hash }                 # accepted into mempool, not yet final
  -> 400 { error: "invalid_signature" | "bad_nonce" | "insufficient_funds" }
  # validator validates (sig, nonce, balance) before accepting + gossiping.

GET /tx/{tx_hash}
  -> { tx_hash, status: PENDING | FINALIZED | REJECTED,
       block_height?, block_hash?, index_in_block? }
  # FINALIZED means it is in a block with a valid 2f+1 commit certificate.

GET /block/{height|hash}
  -> { height, hash, prev_hash, merkle_root, state_root, timestamp,
       proposer, txn_count, txns:[...], commit_certificate: <BLS aggregate sig> }

GET /account/{address}
  -> { address, balance, nonce }     # from the current state trie

GET /chain/head
  -> { height, hash, state_root, finalized: true }   # latest finalized block

GET /proof/tx/{tx_hash}
  -> { merkle_path:[...], block_header, commit_certificate }
  # a light client verifies inclusion (merkle_path -> merkle_root in a header whose
  # commit_certificate is a valid 2f+1 aggregate) without downloading the block.

Validator consensus / gossip wire protocol (internal, signed)

TxGossip      { txn_bytes, txn_hash }                 # mempool dissemination (bodies)

Proposal      { height, round, proposer_id,
                prev_hash, ordered_tx_hashes:[...],    # ORDER only, not bodies
                state_root, timestamp,
                justification?: <highest polka seen>,  # for view-change re-proposal
                signature }                            # proposer's signature

Prevote       { height, round, block_hash | nil, validator_id, signature }
Precommit     { height, round, block_hash | nil, validator_id, signature }

CommitCert    { height, block_hash,
                agg_signature: <BLS aggregate of 2f+1 precommits>,
                signer_bitmap }                        # which validators signed

EvidenceMsg   { type: EQUIVOCATION, height, round,
                vote_a, vote_b }                       # two conflicting signed votes
                                                       # -> on-chain slashing of signer

# Quorum rules: 2f+1 prevotes = POLKA (lock); 2f+1 precommits = COMMIT (final).
# All votes signed; equivocation (two signed votes, same height/round, diff block)
# is cryptographic proof submitted as an EvidenceMsg -> slashes the offender's stake.

Data / storage schema

Two stores per validator: the append-only chain (immutable, archival, write-heavy sequential) and the state trie (mutable current state, keyed by account). SQL is a poor fit for both; this is purpose-built storage.

Block (append-only chain, stored as a sequential log + an index):

block {
  height         uint64     PRIMARY ordering key (monotonic, gap-free)
  hash           bytes32    hash(header) - this block's id
  prev_hash      bytes32    hash of block[height-1]  <- the immutability link
  merkle_root    bytes32    Merkle root over the ordered transactions
  state_root     bytes32    root of the state trie AFTER applying this block
  timestamp      int64      median of validators' times (deterministic, not one clock)
  proposer       validator_id
  txn_count      uint32
  commit_cert    bytes      BLS-aggregated 2f+1 precommit signatures + signer bitmap
}
# Stored append-only; blocks are never updated or deleted. Index: height -> offset,
# hash -> height. Old blocks archivable to cold storage; validators keep recent + state.

transaction (inside a block, order is significant) {
  tx_hash        bytes32
  from           address
  to             address
  amount         uint128
  nonce          uint64     per-sender sequence number (replay protection + intra-sender order)
  fee            uint64
  signature      bytes
  index          uint32     position in the block (the agreed order)
}

State trie (mutable current state, Merkle-Patricia or similar authenticated structure):

account_state (key: address)        # a versioned, hash-addressable key-value trie
  address        address  PRIMARY KEY
  balance        uint128
  nonce          uint64              # next expected nonce for this sender

# The trie is authenticated: its root hash is the block's state_root, so agreeing
# on state_root == agreeing on every balance. Versioned per block so a node can
# compute/verify the state at any height. ~10 GB total (keyed by account, not history).

Validator set / staking (on-chain, changes per epoch):

validator (key: validator_id)
  validator_id   bytes      pubkey (BLS, for signature aggregation)
  stake          uint128    bonded tokens -> vote weight; 2f+1 is by STAKE, not count
  status         ACTIVE | JAILED | UNBONDING     # JAILED after a slashing event
  slashed_total  uint128
# Changes (bond/unbond/slash) are themselves transactions, applied deterministically.
# Validator-set changes take effect at epoch boundaries so the set is stable within a height.

Store choice: no relational database on either path. Reasons:

  • The chain is an append-only, sequentially-written, hash-indexed log - not relational data. It wants a log-structured store (an embedded LSM KV like RocksDB, or a flat file + index), optimized for sequential append and hash/height lookups. There are no joins, no ad-hoc queries on the hot path; a SQL engine’s query planner and row-locking buy nothing and cost write throughput. Immutability is enforced by the hash-link, not by table permissions.
  • The state trie must be an authenticated data structure (Merkle-Patricia or a verkle trie), because the root hash has to summarize all of state so validators can agree on it in one 32-byte value and light clients can prove individual entries. A plain SQL table has no such root; you cannot cheaply prove “this balance is in the agreed state” from a row. The trie is a KV store (again RocksDB-style) holding the trie nodes.
  • Both are replicated by the consensus protocol, not by database replication. Every validator independently builds the identical chain and state from the agreed block stream - that is the replication. There is no primary-replica DB; the “replication” is deterministic re-execution of a BFT-agreed log, which is what makes it Byzantine-tolerant rather than trusting a replica.

The shape is a purpose-built append-only log plus an authenticated state trie, both embedded and replicated by re-execution of a BFT-ordered stream - because the one thing that must be true is that every honest node derives byte-identical chain and state from the same agreed sequence.

Bottlenecks & Scaling

Where it breaks first, in order, and the fix for each.

1. Single-leader block broadcast (breaks first, the headline). A leader shipping 500 KB blocks is ~396 Mbps out of one node; its uplink caps chain TPS and every block routes through it. Fix: separate dissemination from ordering. Gossip transaction bodies peer-to-peer across all validators (~1 MB/s each); the leader proposes only an ordered list of hashes (a few KB). The leader’s bandwidth stops being the ceiling; throughput scales with aggregate network capacity.

2. Single leader as a liveness SPOF / censor. A slow, dead, or censoring leader stalls the round or omits senders. Fix: rotate leadership every height (stake-weighted) and bypass failures by round-timeout view change. A bad leader costs one timeout, then the next proposer takes over; proposing duty spreads across the whole set, so no permanent bottleneck or censorship point.

3. O(N^2) consensus messaging as N grows. All-to-all voting is 10,000 messages/phase at N=100, but quadratic. Fix: BLS signature aggregation collapses 2f+1 precommits into one ~96-byte signature (certificate is O(1), not O(N)); committee sampling via VRF caps the active voting set at large N while full stake backs security. At N=100 the raw O(N^2) is already cheap (~59 KB/node/block).

4. Data-availability attack by a Byzantine proposer. A leader proposes a block referencing transactions it withholds, so honest nodes cannot execute it. Fix: prevote only on confirmed availability - a validator prevotes a proposal only if it has (or can immediately pull from peers) every referenced transaction. Withheld-data blocks cannot gather a polka and the round rotates. (At huge scale, erasure-coded data-availability sampling generalizes this.)

5. Finality latency / serial propose-vote-execute per block. Doing propose, vote, execute strictly serially per block caps the block rate. Fix: pipeline across heights (HotStuff-style) - disseminate for H+1 while voting H, overlap the two voting phases, so block production stays at ~1/s and finality stays a few seconds rather than summing every phase latency serially.

6. State growth / execution as the hot CPU path. Applying 2,000 txns/block and updating the trie every second is the per-node CPU cost. Fix: deterministic parallel execution of non-conflicting transactions (transactions touching disjoint accounts run concurrently; conflicting ones by nonce order), batched trie updates, and keeping state in memory with periodic snapshotting. State is small (~10 GB) so it fits; the chain (~16 TB/yr) is archived to cold storage while validators keep recent blocks + current state.

7. Mempool spam / DoS by flooding invalid or low-fee transactions. An attacker submits millions of transactions to exhaust mempools and gossip bandwidth. Fix: validate before gossip (signature, nonce, balance, fee) so invalid txns never propagate; fee market (order by fee, require a minimum fee) prices out spam; per-sender nonce limits and mempool eviction bound memory. The gossip layer de-duplicates by hash so a flooded txn is relayed once.

8. Long-range / history-rewrite attack. An attacker with old validator keys tries to build an alternative chain from a past point. Fix: slashing + weak subjectivity. Equivocation produces slashable evidence (stake burned), so building a conflicting history costs the attacker their bond; nodes trust a recent finalized checkpoint (weak subjectivity point) rather than re-deriving from genesis, so an old-key fork is rejected. Finality being absolute (not probabilistic) means there is no reorg window to exploit.

9. Validator-set churn mid-height. Changing who can vote while a block is being decided corrupts the quorum math. Fix: epoch boundaries - validator-set and stake changes (bond/unbond/slash) apply only at epoch transitions, so within any height the 2f+1 set is fixed and well-defined. Changes are themselves on-chain transactions, applied deterministically.

10. Clock-based manipulation of block timestamps. A single node’s clock cannot be trusted for the block time. Fix: deterministic median timestamp - the block timestamp is the median of the proposer-reported times weighted by the committing validators, bounded to be monotonically increasing and within a window of real time. No single clock controls it, and execution never reads wall-clock (determinism), so timestamp cannot skew state.

Wrap-Up

The trade-offs that define this design:

  • Byzantine, not crash, is the whole reason for the cost. 3f+1 validators, two voting phases, signed votes, and slashing all exist because a responding node might be lying. Quorum intersection (2f+1 quorums share an honest node) is what makes conflicting commits mathematically impossible, and it is strictly more expensive than Raft/Paxos - that expense is the price of tolerating malice, and it buys absolute, non-reversible finality instead of probabilistic PoW confirmation waits.
  • Determinism is what lets replicas verify instead of re-negotiate. Ordering is a pure function of shared transaction content (fee + hash tie-break, nonce-sequenced per sender) and execution is bit-for-bit deterministic, so every honest node independently computes the identical block and the identical state root. The proposer is an auditable sequencer, not a trusted one - it has no latitude in ordering the transactions it includes.
  • Splitting dissemination from ordering is what kills the leader bottleneck. Transaction bodies gossip peer-to-peer across all validators (the bulk 500 KB/s, parallelized); the leader proposes only a few-KB list of hashes. The leader’s uplink stops being the throughput ceiling, so the chain scales with aggregate capacity and comfortably clears 1,000 TPS. Rotating leadership plus timeout-driven view change means no node is ever a permanent bottleneck or single point of failure.
  • Locking plus polka-justified view change is what turns leader failure into delay, never a fork. A committed block can never be contradicted because 2f+1 locked validators prevent any conflicting block from gathering a polka; a bad leader costs one round-timeout and is bypassed. Safety holds under full asynchrony; only liveness waits on the timeout.
  • Purpose-built storage, replicated by re-execution. An append-only hash-linked log (immutability from the hash chain, not permissions) plus an authenticated state trie (one root hash summarizes all balances), both replicated by every validator deterministically re-executing the BFT-ordered stream - not by trusting any replica.

One-line summary: validators disseminate signed transactions by peer-to-peer gossip so every node independently holds the same mempool, a stake-weighted rotating proposer proposes only a deterministic ordering of transaction hashes (never the bodies, killing the leader bandwidth wall), and a two-phase BFT protocol over 3f+1 validators commits each block when 2f+1 precommits form an aggregated finality certificate - so every honest node appends byte-identical, hash-linked, deterministically-executed blocks in identical sequence, tolerating up to one third malicious validators, surviving leader failure in one round-timeout without ever forking, and sustaining well above 1,000 TPS with no single leader as bottleneck or single point of failure.