Overview
Curated: · Written: · Reviewed:
Consensus Mechanisms
In one line
Consensus makes untrusted or unreliable nodes agree on one ordered history of state transitions. Reach for it when no single party can be trusted to order writes, and state the failure model first: crash-fault protocols (Raft) need n = 2f + 1 with a majority quorum, while Byzantine protocols (PBFT, HotStuff, CometBFT, and the voting layers of PoW and PoS chains) need n = 3f + 1 with quorums above two-thirds. Pick the protocol only after the failure model, membership and latency budget are fixed.
Key definitions
- Safety: honest nodes never finalize conflicting decisions at the same position in the log.
- Liveness: the system eventually makes progress once the network is synchronous enough and an honest leader or proposer is selected.
- Quorum intersection: two quorums of size q drawn from n replicas share at least 2q − n replicas.
- Quorum certificate (QC): a set of signed votes from a quorum that justifies progress or commitment.
- Lock: a validator's commitment to a block after a qualifying prevote set, which it releases only on justified later evidence.
- Equivocation: signing two conflicting votes for the same height and round. This is the provable fault that slashing punishes.
- Weak subjectivity: the trusted recent checkpoint a client needs so that old validator keys cannot forge an alternative history.
Formulas and complexity
Ethereum: 12 s slots, 32 slots per epoch, finality after two-thirds of staked ETH votes for a checkpoint across two consecutive epochs, about 12.8 minutes in the happy path. Bitcoin: one block about every 10 minutes, difficulty retargeted every 2016 blocks.
How it works
A proposal rule picks the next entry. Validators validate the proposal and vote. A quorum certificate justifies progress. Locks stop a validator from supporting a conflicting block later. Timeouts advance the round, and nil votes allow progress without endorsing a bad proposal. A timeout is a progress mechanism, not evidence of malice.
When to use and when not to
| situation | right choice | why |
|---|---|---|
| one org, one writer, crash tolerance | Raft/etcd or synchronous Postgres replica | no independent trust domains to distribute |
| known consortium, mutual distrust | BFT with identified validators | deterministic finality over enumerable membership |
| open permissionless network | PoW or PoS with economic finality | membership cannot be enumerated or authenticated up front |
| single-region, read-heavy, low latency | primary/replica, no consensus on reads | avoids a consensus round trip per write |
| cross-region quorum | expect the slowest link on every decision | a 150 ms round trip sets a floor of roughly 150–300 ms per commit |
Traps interviewers probe
- Counting replicas as Byzantine tolerance. Fix: state f, n = 3f + 1 and the 2f + 1 quorum, and require independent operators, since ten validators behind one provider are one failure domain.
- Using n/2 + 1 as a BFT quorum. Fix: that is the crash-fault majority; BFT needs more than two-thirds of voting power.
- Treating a timeout as proof of malice. Fix: delay, loss, overload and partition look identical from a timeout. Slashing needs signed, conflicting messages.
- Treating mempool presence as acceptance. Fix: mempools differ per node and can be censored or reordered. Accept only on canonical inclusion, then wait for finality.
- Equating ordering with validity. Fix: consensus orders bytes. Nondeterministic execution (clocks, unordered map iteration, external calls) can make honest nodes diverge at the same height.
Interview tips
Open with the failure model: crash or Byzantine, how many faults, and which synchrony assumption applies. Then give the quorum arithmetic and the overlap that makes conflicting commits impossible.
Expected follow-ups:
- What happens during a partition? Safety holds; the minority side stalls until it reaches a quorum.
- Why 3f + 1 and not 2f + 1 for BFT? Two quorums of 2f + 1 out of 3f + 1 overlap in f + 1 replicas, so at least one honest replica sits in both.
- How do you change membership without split brain? Joint consensus or delayed activation, so no two disjoint configurations can each decide.
- Confirmation versus finality? Confirmation is depth or inclusion; finality is a prefix whose reversion would break stated assumptions or cost defined value.
- Why not just use Postgres? Only if one party owns every writer; otherwise you have distributed latency, not trust.
30-second outline: state the failure model and replica count; name the quorum and its overlap; walk the proposal, vote, lock and commit path; say that safety holds and liveness does not under partition; name the finality semantics and the assumptions they depend on.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.