Skip to content
Tech Interview Prep
Technical interview guide

Consensus Mechanisms

How a distributed network of untrusted nodes agrees on a single canonical transaction history: Proof of Work, Proof of Stake, and BFT-style consensus.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed

Scope: NISTIR 8202; Bitcoin white paper; Ethereum proof-of-stake documentation reviewed 2026-09-04; CometBFT main specification reviewed 2026-09-04; PBFT, HotStuff, and Raft papers.

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

nCFT=2f+1,qCFT=f+1n_{\text{CFT}} = 2f+1,\quad q_{\text{CFT}} = f+1 nBFT=3f+1,qBFT=2f+1,overlap=2q−n=f+1n_{\text{BFT}} = 3f+1,\quad q_{\text{BFT}} = 2f+1,\quad \text{overlap} = 2q-n = f+1 PBFT messages per round=O(n2),HotStuff messages per view=O(n)\text{PBFT messages per round} = O(n^2),\qquad \text{HotStuff messages per view} = O(n)

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.

no quorum or timeout Leader proposes block at height h, round r Validators validate Prevote: more than 2/3 power Lock on block Nil vote, next round Precommit: more than 2/3 power Commit at height h

When to use and when not to

situationright choicewhy
one org, one writer, crash toleranceRaft/etcd or synchronous Postgres replicano independent trust domains to distribute
known consortium, mutual distrustBFT with identified validatorsdeterministic finality over enumerable membership
open permissionless networkPoW or PoS with economic finalitymembership cannot be enumerated or authenticated up front
single-region, read-heavy, low latencyprimary/replica, no consensus on readsavoids a consensus round trip per write
cross-region quorumexpect the slowest link on every decisiona 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.