Tendermint Consensus Interview Questions
Tendermint consensus algorithm interview questions covering the Byzantine Fault Tolerant consensus used in Cosmos chains.
Q1: How does Tendermint consensus work?
Answer:
Tendermint is a Byzantine Fault Tolerant consensus algorithm used in Cosmos chains.
Sequence Diagram:
Overall Flow Diagram:
Individual Node Decision Diagram:
Tendermint Phases:
1. Propose:
- Proposer selected (round-robin by voting power)
- Creates block with transactions
- Broadcasts proposal
2. Prevote:
- Validators receive proposal
- Validate block
- Broadcast prevote (yes/no)
- Need
2/3+prevotes to continue
3. Precommit:
- After
2/3+prevotes, broadcast precommit - Need
2/3+precommits to commit - If timeout: Move to next round
4. Commit:
- Block committed when
2/3+precommits received - State updated
- Move to next height
Key Properties:
- Finality: Blocks are final (no reorgs)
- Safety: Tolerates up to
1/3Byzantine validators - Liveness: Continues with
2/3+honest validators - Fast: ~1-6 second block time
Example:
1type TendermintState struct {
2 Height int64
3 Round int32
4 Step Step
5}
6
7type Step int
8
9const (
10 StepPropose Step = iota
11 StepPrevote
12 StepPrecommit
13 StepCommit
14)
15
16func (s *TendermintState) Propose(block *Block) {
17 // Proposer creates and broadcasts block
18 s.Step = StepPropose
19 broadcastProposal(block)
20}
21
22func (s *TendermintState) Prevote(blockID BlockID) {
23 // Validators vote on proposal
24 s.Step = StepPrevote
25 if validateBlock(blockID) {
26 broadcastPrevote(blockID, true)
27 } else {
28 broadcastPrevote(blockID, false)
29 }
30}
31
32func (s *TendermintState) Precommit(blockID BlockID) {
33 // After 2/3+ prevotes, precommit
34 if countPrevotes(blockID) >= getQuorum() {
35 s.Step = StepPrecommit
36 broadcastPrecommit(blockID, true)
37 }
38}
39
40func (s *TendermintState) Commit(blockID BlockID) {
41 // After 2/3+ precommits, commit block
42 if countPrecommits(blockID) >= getQuorum() {
43 s.Step = StepCommit
44 commitBlock(blockID)
45 s.Height++
46 s.Round = 0
47 }
48}
Use Cases:
- Cosmos chains
- Binance Chain
- Terra
Related Snippets
- Bitcoin (Nakamoto) Consensus Interview Questions
Bitcoin consensus algorithm interview questions covering Proof-of-Work (PoW) and … - Byzantine Fault Tolerance (BFT) Consensus Interview Questions
Byzantine Fault Tolerance (BFT) consensus algorithm interview questions covering … - Cardano Interview Questions - Easy
Easy-level Cardano interview questions covering blockchain basics, Plutus, and … - Cardano Interview Questions - Hard
Hard-level Cardano interview questions covering advanced optimization and formal … - Cardano Interview Questions - Medium
Medium-level Cardano interview questions covering advanced Plutus development … - Consensus Algorithms Comparison Interview Questions
Consensus algorithm comparison and general implementation interview questions. … - Cosmos Chain Operations Interview Questions - Easy
Easy-level Cosmos chain operation interview questions covering chain operations, … - Cosmos Chain Operations Interview Questions - Hard
Hard-level Cosmos chain operation questions covering advanced algorithms, … - Cosmos Chain Operations Interview Questions - Medium
Medium-level Cosmos chain operation questions covering advanced chain … - Cosmos SDK Interview Questions - Easy
Easy-level Cosmos SDK interview questions covering chain code, SDK basics, and … - Cosmos SDK Interview Questions - Hard
Hard-level Cosmos SDK interview questions covering advanced SDK internals, … - Cosmos SDK Interview Questions - Medium
Medium-level Cosmos SDK interview questions covering advanced module … - Ethereum Proof-of-Stake Consensus Interview Questions
Ethereum Proof-of-Stake consensus algorithm interview questions covering Casper … - Ouroboros (Cardano) Consensus Interview Questions
Ouroboros consensus algorithm interview questions covering Cardano's … - Paxos Consensus Interview Questions
Paxos consensus algorithm interview questions covering the classic distributed … - Polkadot (NPoS) Consensus Interview Questions
Polkadot consensus algorithm interview questions covering Nominated … - Polkadot Interview Questions - Easy
Easy-level Polkadot interview questions covering blockchain basics, Substrate, … - Polkadot Interview Questions - Hard
Hard-level Polkadot interview questions covering advanced optimization and … - Polkadot Interview Questions - Medium
Medium-level Polkadot interview questions covering advanced Substrate … - Solana Interview Questions - Easy
Easy-level Solana interview questions covering blockchain basics, programs, and … - Solana Interview Questions - Hard
Hard-level Solana interview questions covering advanced optimization, security, … - Solana Interview Questions - Medium
Medium-level Solana interview questions covering advanced program development, … - Solana Proof of History Consensus Interview Questions
Solana consensus algorithm interview questions covering Proof of History (PoH) … - Web3 Interview Questions - Easy
Easy-level Web3 interview questions covering blockchain fundamentals, Ethereum, … - Web3 Interview Questions - Hard
Hard-level Web3 interview questions covering MEV, zero-knowledge proofs, … - Web3 Interview Questions - Medium
Medium-level Web3 interview questions covering DeFi, advanced Solidity, …