Why Consensus Matters
In a distributed validator system, multiple operators hold shares of a validator key. Before signing any beacon chain duty (attestation, block proposal, etc.), operators must reach Byzantine agreement on:- What data to sign - The specific attestation, block, or sync committee message
- When to sign it - Ensuring duties execute in the correct slot
- That enough operators agree - Meeting the threshold for valid signatures
QBFT ensures consensus can be reached by a committee of
n validator nodes while tolerating f faulty nodes, defined by n ≥ 3f + 1.QBFT Fundamentals
Byzantine Fault Tolerance
Byzantine Fault Tolerance addresses the Byzantine Generals Problem: how to reach consensus when some participants may fail, crash, or act maliciously. QBFT Properties:- Safety: Never produces conflicting decisions (prevents slashing)
- Liveness: Eventually makes progress (duties execute)
- Byzantine Resilience: Tolerates up to
ffaulty operators out ofntotal
| Cluster Size | Faulty Tolerated | Safety Threshold | Liveness Threshold |
|---|---|---|---|
| 4 operators | 1 | 2 signatures | 3 online |
| 7 operators | 2 | 3 signatures | 5 online |
| 10 operators | 3 | 4 signatures | 7 online |
Consensus Terminology
Key Terms
- Instance (λ): A single consensus run for one duty
- Height: Monotonically increasing instance counter (equivalent to beacon slot)
- Round (r): Iteration within an instance; starts at 1, increments on timeout
- Leader: Operator responsible for proposing data in a given round
- Quorum (Q): Threshold of messages needed for consensus (2f+1)
- Committee: Group of n operators managing a validator
Consensus Phases
QBFT consensus proceeds through three main phases: PROPOSAL, PREPARE, and COMMIT. A fourth phase, ROUND-CHANGE, handles timeouts and leader failures.Phase 1: PROPOSAL
Leader Selection:- Deterministic:
leader = (λ + r) mod n - All operators know who should lead each round
- Invalid proposals from non-leaders are rejected
λ(lambda): Instance heightr: Current roundinputValue: Beacon chain duty data (attestation, block, etc.)
- Verify the sender is the correct leader for this round
- Validate the duty data against beacon chain state
- Check for slashing conditions (no conflicting signatures)
- Verify the proposal is for the expected slot and role
protocol/v2/qbft/instance/proposal.go
Phase 2: PREPARE
PREPARE Message:- Operators broadcast their acceptance of the proposal
- Acts as a “pre-vote” before final commitment
- Prevents premature commitment to unvalidated data
2f+1 valid PREPARE messages (including its own), it has achieved Qprepare. This signals that a supermajority has accepted the proposed value.
An operator can proceed to COMMIT upon receiving Qprepare, even without the original PROPOSAL. This optimization handles cases where the leader is slow but honest operators have already agreed.
protocol/v2/qbft/instance/instance.go:150
Phase 3: COMMIT
COMMIT Message:2f+1 valid COMMIT messages (Qcommit), consensus is decided:
- The operator stops the round timer
- Marks the instance as decided
- Proceeds to post-consensus (partial signature exchange)
- The decided value becomes immutable for this instance
ibft/storage/ to ensure:
- Operators don’t re-run consensus for the same duty
- Historical decisions can be retrieved for sync protocols
- Slashing protection databases are updated
protocol/v2/qbft/controller/decided.go
Phase 4: ROUND-CHANGE
Round changes handle scenarios where consensus stalls due to:- Leader failure or network partition
- Slow or faulty leader
- Insufficient quorum in current round
pr: Highest round where this operator received Qprepare (null if never)pv: The value from roundpr(null ifpris null)
- Timeout: Round timer expires without reaching Qcommit
- F+1 Round Changes: Receiving
f+1ROUND-CHANGE messages for higher rounds - Leader Failure: Detected through lack of valid PROPOSAL
- Operators broadcast ROUND-CHANGE messages
- Wait for Qrc (quorum of
2f+1ROUND-CHANGE messages) - New leader justifies the PROPOSAL:
- If any operator has
pr ≠ null, propose thepvfrom the highestpr - Otherwise, propose fresh duty data from the beacon node
- If any operator has
- New leader broadcasts justified PROPOSAL
- Consensus proceeds normally in the new round
- Proves that the new proposal is based on valid prior agreement
- Operators verify the justification before accepting the proposal
- Ensures safety across round transitions
Annotated IBFT Paper
For detailed round-change mechanics and formal proofs, see the IBFT Annotated Paper in the SSV repository.
protocol/v2/qbft/instance/instance.go (round change logic)
Consensus Flow Diagrams
Normal Case (Single Round)
In the optimal scenario:- Leader proposes valid data
- All honest operators prepare
- All honest operators commit
- Consensus decided in round 1
Round Change Scenario
When the leader fails or is slow:- Round timeout triggers ROUND-CHANGE
- Operators achieve Qrc
- New leader elected
- Justified proposal in round 2
- Consensus decided
Implementation Details
QBFT Controller
TheController (protocol/v2/qbft/controller/controller.go) orchestrates consensus instances:
- Starting new consensus instances for each duty
- Managing instance lifecycle (active, decided, historical)
- Processing incoming consensus messages
- Triggering timeouts and round changes
Instance Management
Each duty creates a new QBFT instance (protocol/v2/qbft/instance/instance.go):
Height: Beacon slot / consensus instance numberRound: Current round within the instanceProposalAcceptedForCurrentRound: Accepted proposal (if any)LastPreparedRound&LastPreparedValue: Highest round with Qprepare
Message Processing
Message flow through the stack:- P2P Layer (
network/p2p/p2p_pubsub.go): Receives messages on GossipSub topics - Message Router: Routes to appropriate validator/committee
- Runner (
protocol/v2/ssv/runner/runner.go): Decodes and validates structure - QBFT Controller: Delivers to the correct instance
- Instance: Processes according to current state and message type
Timing and Timeouts
Timer configuration (protocol/v2/qbft/controller/timer.go):
- Base Timeout: Configurable per network (e.g., 2 seconds for mainnet)
- Exponential Backoff:
timeout(r) = base_timeout * 2^(r-1) - Round 1: 2s
- Round 2: 4s
- Round 3: 8s
- Round 4: 16s
Security Properties
Slashing Prevention
QBFT guarantees at most one decided value per instance:- Byzantine operators cannot cause conflicting commitments
- Double-signing is impossible when
2f+1operators are honest - Slashing protection databases provide additional safety
- Each operator independently validates against slashing conditions
- Pre-consensus checks prevent conflicting partial signatures
- Consensus ensures all operators sign the same data
Network Resilience
QBFT handles various failure scenarios:| Failure Mode | QBFT Response |
|---|---|
| Leader crash | Round change to new leader |
| Network partition | Progress when partition heals |
| Byzantine messages | Ignored or scored negatively |
| Delayed messages | Round change, eventual progress |
Liveness Guarantees
Assumptions for Liveness:- At most
foperators are Byzantine - Network eventually delivers messages (asynchronous model)
- There exists a synchronous period long enough for message exchange
- Liveness holds even with changing network conditions
- Round changes ensure eventual leader rotation
- No deadlock scenarios with honest majority
Performance Characteristics
Message Complexity
Per consensus instance withn operators:
- PROPOSAL: O(n) messages (1 leader to n operators)
- PREPARE: O(n²) messages (n operators broadcast to n)
- COMMIT: O(n²) messages (n operators broadcast to n)
Latency
Typical consensus latency on mainnet (4 operators):- Best case: 1-2 seconds (single round, low network latency)
- Average case: 2-4 seconds (including network jitter)
- Worst case: Scales with round changes (exponential backoff)
Optimizations
Message Aggregation:- PREPARE and COMMIT messages can be aggregated (multiple signers)
- Reduces message count in implementations (not yet in SSV)
- New instances can start before previous ones finish
- Duty queue processes multiple duties concurrently
protocol/v2/ssv/queue/ for concurrent duty processing
Research Foundations
QBFT is based on rigorous academic research:Istanbul BFT Paper
The Istanbul BFT Consensus AlgorithmFormal specification and proofs for:
- Safety (agreement on single value)
- Liveness (eventual termination)
- Byzantine resilience (up to f faults)
- EIP-650: Istanbul Byzantine Fault Tolerance - Original Ethereum proposal
- PBFT Paper - Castro & Liskov’s Practical Byzantine Fault Tolerance
- HotStuff - Linear consensus protocol
Next Steps
Network Topology
Learn how consensus messages propagate through the P2P network
Validator Duties
Understand what data operators are reaching consensus on
