Proof of stake and other consensus algorithms
Clear, exam-focused notes on Proof of Stake (PoS) and other consensus algorithms: definitions, mathematical ideas, step-by-step derivations, formulas, worked examples, common mistakes and exam tips for Computer Engineering students.
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
Blockchain systems need a way for many independent participants to agree on the next state. Consensus algorithms decide who can add the next block and how the network reaches agreement. An engineer uses these ideas when designing or auditing blockchains, selecting a consensus mechanism for throughput/energy/security trade-offs, or implementing client software and validators.
Key ideas
Start with the classical problem behind consensus.
Byzantine generals problem — the formal statement: a set of distributed processes (generals) must agree on a single course of action (attack/retreat) despite some processes being faulty or malicious (Byzantine). Assumptions: processes communicate via messages; messages can be delivered but may be delayed; faulty processes may send arbitrary messages. The goal is an algorithm that satisfies Agreement (all honest processes decide the same value) and Validity (if all honest processes propose the same value v then they decide v).
Safety and Liveness — formal definitions used in consensus: Safety (also called consistency) means the system never outputs two different decisions for the same position; Liveness means the system eventually makes a decision if conditions (usually partial synchrony) hold. Assumptions (model) must be stated: synchronous, asynchronous, or partially synchronous network.
FLP impossibility (informal statement): In a fully asynchronous network with even one crash failure, no deterministic algorithm can guarantee both safety and liveness. Consequence: practical protocols rely on randomization, timeouts, or partial synchrony assumptions.
Nakamoto consensus (used by Bitcoin) — probabilistic consensus where miners solve a PoW puzzle; longest (heaviest) chain rule gives eventual consistency; guarantees probabilistic finality: probability of reorg decreases exponentially with more confirmations.
Define Proof of Work (PoW) briefly: a resource-based scheme where the right to propose a block is earned by demonstrating a computationally costly proof (hash preimage meeting difficulty). Mentioned only for comparison.
Proof of Stake family — main definitions and mechanisms
Proof of Stake (PoS) — definition: a class of consensus algorithms where the right to propose or validate blocks is determined by the amount of cryptocurrency (stake) a participant locks (stakes) in the protocol instead of by expending computing power. Assumptions: stake is costly to acquire; protocol can punish misbehaviour by confiscating (slashing) stake; stake distribution is known or discoverable by the protocol.
Validator — a node that participates in proposing and/or voting on blocks after staking tokens.
Staking / Bonding — the action of locking tokens with the network to become a validator or to delegate to one. Usually involves a lock-up period.
Slashing — a punitive mechanism: if a validator behaves against protocol rules (double-signing, equivocation, or in some protocols prolonged downtime), some or all of its stake is confiscated as a penalty (other designs use non-slashing inactivity leaks for downtime).
Finality — a guarantee that once a block is finalized it cannot be reverted. PoS systems may provide probabilistic finality (like chain-based PoS) or deterministic / Byzantine Fault Tolerant finality (like Tendermint). In PoS, weak subjectivity is required to mitigate long-range attacks: new or long-offline nodes should bootstrap from a recent trusted checkpoint. PoS designs also address 'nothing-at-stake' and randomness-grinding via slashing conditions and unbiasable randomness (e.g., VRFs or RANDAO).
Stake-weighted leader selection — in many PoS protocols, the chance to propose a block is proportional to a validator's stake. If a validator has stake s and total active stake is S, then the proposer selection probability is s/S (derivation below).
Delegated Proof of Stake (DPoS) — token holders elect a fixed small set of delegates (validators) who run consensus; this trades decentralization for throughput.
Proof of Authority (PoA) — a consensus where a set of approved identities (authorities) create blocks; used in permissioned chains.
Proof of Elapsed Time (PoET) — uses trusted execution environments to elect leaders by assigning randomized waiting times; assumes hardware security.
BFT-style PoS (e.g., Tendermint, HotStuff) — consensus proceeds in rounds where a proposer suggests a block and validators vote in multiple phases. Tendermint uses prevote and precommit; HotStuff uses a three-phase (prepare, pre-commit, commit) pipelined protocol. They usually assume less than 1/3 of validators (by stake) are Byzantine and provide deterministic finality once >2/3 votes are collected.
Formal properties and thresholds (common theorems/claims students must know)
BFT threshold claim: In classical deterministic BFT consensus with authenticated voting and quorum certificates, both safety and liveness are achievable when n ≥ 3f + 1 (equivalently, f < n/3) in the synchronous or partially synchronous model (where n is number of validators). With this bound, safety holds unconditionally (even during asynchrony), and liveness holds under synchrony/partial synchrony assumptions. For stake-weighted systems, interpret quorums by voting power; safety if adversary stake fraction α < 1/3. Assumptions: authenticated channels and honest validators follow the protocol.
Chain-based PoS probabilistic finality: If an adversary controls fraction α of total stake, their expected control of produced blocks is α; probability of them overtaking the honest chain decreases exponentially with confirmations, similar to PoW analysis (assumptions: independent proposer selection, honest majority by stake). Typically, security requires α < 1/2 under a longest/heaviest-chain rule. The detailed bound depends on proposer selection randomness and fork-choice rule.
Derivations students are commonly asked for
Probability of being selected as proposer in a stake-weighted lottery. If validator i has stake s_i and active total stake is S, then
- Probability = s_i / S. Derive by proportional selection: imagine S balls in an urn, s_i labelled i; drawing one uniformly gives that probability.
Why BFT needs >2/3 votes to finalize: show that with n validators and f Byzantine, to ensure two different decisions cannot both get enough votes, require quorum size q satisfy 2q > n + f. Setting worst-case f = floor((n-1)/3) leads to q = floor(2n/3)+1 which is >2n/3.
Diagrams to draw (describe exactly):
- For Nakamoto vs BFT comparison: draw two columns labeled PoW/Nakamoto and PoS/BFT. Under each column sketch a timeline of blocks; in PoW show forks resolved by longest chain; in BFT draw round with proposer, arrow to votes, then finalized block. Label messages (proposal, vote), thresholds (e.g., >2/3).
Formulas
P(proposer i) = s_i / S — s_i is stake of validator i (tokens), S is total active stake (tokens). Applies when selection is proportional to stake.
q > 2n/3 — q is quorum size (votes) required to finalize a block in classical BFT with n validators (unitless). Applies for safety with up to floor((n-1)/3) Byzantine nodes.
Adversary_expected_blocks = α · N — α is fraction of total stake controlled by adversary (unitless), N is number of produced blocks in an epoch. Applies when leader selection is independent and proportional to stake.
Slash_penalty = p · s — p is slash fraction (unitless), s is validator stake (tokens). Applies when a validator is punished by protocol.
(These are simple algebraic statements students must remember; specific protocols add more parameters: epochs, inactivity leaks, lock-up durations.)
Worked examples
Example 1 — proposer selection probabilities and expected blocks
Given: total active stake S = 1000 tokens. Validators A=400, B=300, C=200, D=100.
P(A) = 400/1000 = 0.4.P(B) = 0.3,P(C) = 0.2,P(D) = 0.1.- If N = 100 blocks are produced in an epoch and selection is independent, expected blocks by A =
0.4·100 = 40blocks. For B = 30, C = 20, D = 10.
Final answers (bold): A: 0.4 (40 blocks), B: 0.3 (30), C: 0.2 (20), D: 0.1 (10).
Example 2 — Tendermint-like BFT vote trace (small input)
Setup: 4 validators V1..V4, equal stake (so stake fraction 1/4 each). Assume ≤1 Byzantine (<1/3 so at most 1). Quorum required >2/3 ⇒ need at least 3 votes.
Round 1:
- Proposer V1 proposes block B1.
- Each honest validator pre-votes for B1. If V2, V3, V4 are honest, pre-votes: V1,V2,V3,V4 ⇒ 4 pre-votes for B1.
- Once a validator sees >2/3 pre-votes for B1 it pre-commits; assume V1..V4 pre-commit.
- When a node sees >2/3 pre-commits, it finalizes B1. With 4 votes (≥3) the block is finalized.
Behavior under a Byzantine (V4 malicious):
- If V4 equivocates (signs two different proposals), honest votes from V1..V3 still reach 3 pre-votes/pre-commits, so finality holds. Slashing can be applied to V4 because of double-sign.
This trace shows how >2/3 thresholds prevent conflicting finalizations when fewer than 1/3 are Byzantine.
Example 3 — slashing penalty calculation
Validator stake s = 200 tokens, protocol slashes p = 5% = 0.05 on double-signing.
Slash_penalty = p · s = 0.05·200 = 10 tokens. Remaining stake = 190 tokens (not including possible loss due to lost rewards). Final answer: 10 tokens slashed, 190 tokens remain staked.
Common mistakes
Treating stake fraction α security thresholds as identical across all PoS systems; different protocols tolerate different α (e.g., some claim safety up to α < 1/2 in committee-based designs with additional checks). Always state which protocol the threshold applies to.
Mixing token units in probability formulas (express stake as numbers, not percentages, then show simplification).
Not describing exact slash conditions — slashing is protocol-specific. Do not claim a universal slashing percentage.
For your exam
Question types you will see: definitions (define PoS, validator, slashing), short notes (compare PoW vs PoS; describe DPoS), derivations (derive proposer probability; show why >2/3 quorum needed), algorithm traces (apply BFT rounds to a small validator set), numerical problems (compute expected blocks, slashing amounts), and diagrams (draw message flow in BFT or fork-choice in chain-based PoS).
What a full-marks answer includes:
- Clear definitions with bolded terms (or underlined in handwritten answers).
- Statement of the system model (synchronous/partially synchronous/asynchronous) and fault assumptions (Byzantine fraction f or stake fraction α).
- Exact formulas and brief derivations (e.g., probability = stake/total stake; quorum threshold derivation).
- If asked to compare, a concise table or bullet list of trade-offs: energy, finality type, throughput, centralization pressure.
- For algorithm traces: step-by-step messages, vote counts, and final state; draw and label the required diagram.
Quick check
- Define Proof of Stake in one sentence.
- For 5 validators, what is the minimum number of votes required to reach >2/3 quorum? (Give a number.)
- If a validator has 250 tokens and total stake is 1000 tokens, what is its expected number of blocks in an epoch of 120 blocks (selection proportional to stake)?
Answers: 1) A consensus family where block proposers/validators are chosen by locked cryptocurrency stake rather than computational work. 2) 4 votes (because >2/3 of 5 is >3.333 ⇒ 4). 3) P = 250/1000 = 0.25 so expected blocks = 0.25·120 = 30.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?