Tendermint
Chapter 17: Tendermint Consensus
Section titled “Chapter 17: Tendermint Consensus”Overview
Section titled “Overview”Tendermint is a Byzantine Fault Tolerant (BFT) consensus algorithm used by Cosmos and other blockchain networks. It provides instant finality and high throughput for blockchain applications.
17.1 What is Tendermint?
Section titled “17.1 What is Tendermint?”Tendermint is a consensus engine that:
- Guarantees safety and liveness
- Provides immediate block finality (no probabilistic finality)
- Supports 1/3 Byzantine fault tolerance
- Uses a rotating proposer mechanism
Key Properties
Section titled “Key Properties”| Property | Value |
|---|---|
| Fault Tolerance | Up to 1/3 malicious validators |
| Block Time | 5-7 seconds |
| Finality | Immediate (1 block) |
| Consensus | BFT (Byzantine Fault Tolerant) |
17.2 Tendermint Architecture
Section titled “17.2 Tendermint Architecture”┌─────────────────────────────────────────────────────────────────┐│ TENDERMINT NODE ARCHITECTURE │├─────────────────────────────────────────────────────────────────┤│ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ APPLICATION LAYER │ ││ │ ┌─────────────────────────────────────────────────────┐ │ ││ │ │ Cosmos SDK Application │ │ ││ │ │ (Your custom blockchain logic) │ │ ││ │ └─────────────────────────────────────────────────────┘ │ ││ └───────────────────────────────────────────────────────────┘ ││ │ ││ ▼ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ TENDERMINT CORE │ ││ │ │ ││ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ ││ │ │ Consensus │ │ Mempool │ │ Blockchain │ │ ││ │ │ Engine │ │ (TX Pool) │ │ (State) │ │ ││ │ └─────────────┘ └─────────────┘ └─────────────┘ │ ││ └───────────────────────────────────────────────────────────┘ ││ │ ││ ▼ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ NETWORK LAYER │ ││ │ (Peer-to-peer gossip with other validators) │ ││ └───────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────┘17.3 Consensus Phases
Section titled “17.3 Consensus Phases”Tendermint uses a three-phase consensus protocol:
┌─────────────────────────────────────────────────────────────────┐│ TENDERMINT CONSENSUS ROUND │├─────────────────────────────────────────────────────────────────┤│ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ PROPOSE PHASE │ ││ │ │ ││ │ ┌─────────────────────────────────────────────────┐ │ ││ │ │ PROPOSER (selected by round-robin) │ │ ││ │ │ Creates new block │ │ ││ │ └─────────────────────────────────────────────────┘ │ ││ │ ↓ │ ││ │ Broadcasts block proposal to all validators │ ││ └───────────────────────────────────────────────────────────┘ ││ │ ││ ▼ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ PRE-VOTE PHASE │ ││ │ │ ││ │ All validators receive the proposal │ ││ │ ↓ │ ││ │ Validate block (check signatures, transactions) │ ││ │ ↓ │ ││ │ Broadcast PRE-VOTE (vote for block validity) │ ││ │ │ ││ │ ┌─────────────────────────────────────────────────┐ │ ││ │ │ If 2/3+ PRE-VOTE: Proceed to PRE-COMMIT │ │ ││ │ │ If < 2/3+ PRE-VOTE: Start new round (timeout) │ │ ││ │ └─────────────────────────────────────────────────┘ │ ││ └───────────────────────────────────────────────────────────┘ ││ │ ││ ▼ ││ ┌───────────────────────────────────────────────────────────┐ ││ │ PRE-COMMIT PHASE │ ││ │ │ ││ │ Validators receive pre-votes │ ││ │ ↓ │ ││ │ If 2/3+ pre-votes received: │ ││ │ Broadcast PRE-COMMIT (commit to block) │ ││ │ ↓ │ ││ │ Block is finalized and added to blockchain │ ││ │ │ ││ │ ┌─────────────────────────────────────────────────┐ │ ││ │ │ If 2/3+ PRE-COMMIT: Block FINALIZED │ │ ││ │ │ If < 2/3+ PRE-COMMIT: Start new round │ │ ││ │ └─────────────────────────────────────────────────┘ │ ││ └───────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────┘17.4 Validator Set
Section titled “17.4 Validator Set”Becoming a Validator
Section titled “Becoming a Validator”Validators are responsible for:
- Running a Tendermint node
- Participating in consensus
- Proposing and voting on blocks
- Staking tokens (ATOM)
Validator Selection
Section titled “Validator Selection”┌─────────────────────────────────────────────────────────────────┐│ PROPOSER SELECTION ALGORITHM │├─────────────────────────────────────────────────────────────────┤│ ││ Proposers are selected using weighted round-robin: ││ ││ ┌─────────────────────────────────────────────────────────┐ ││ │ Weight = (Validator Stake / Total Staked) * Rotation │ ││ └─────────────────────────────────────────────────────────┘ ││ ││ Example: ││ - Validator A: 1000 ATOM (50% stake) → 50% selection chance ││ - Validator B: 600 ATOM (30% stake) → 30% selection chance ││ - Validator C: 400 ATOM (20% stake) → 20% selection chance ││ ││ Higher stake = More frequent proposer selection ││ │└─────────────────────────────────────────────────────────────────┘Slashing Conditions
Section titled “Slashing Conditions”Validators can be slashed for:
- Double-signing: Signing two different blocks at same height
- Downtime: Being offline for extended periods
- Missed votes: Not participating in consensus
17.5 State Machine
Section titled “17.5 State Machine”┌─────────────────────────────────────────────────────────────────┐│ TENDERMINT STATE MACHINE │├─────────────────────────────────────────────────────────────────┤│ ││ ┌──────────┐ ┌──────────┐ ┌──────────┐ ││ │ NewHeight │────▶│ Propose │────▶│ Prevote │ ││ └──────────┘ └──────────┘ └──────────┘ ││ │ ││ ▼ ││ ┌──────────┐ ┌──────────┐ ┌──────────┐ ││ │ Precommit│◀────│ Prevote │◀────│ Propose │ ││ └──────────┘ └──────────┘ └──────────┘ ││ │ ││ ▼ ││ ┌──────────┐ ││ │ Commit │ ───▶ Block added to blockchain ││ └──────────┘ ││ ││ States: ││ - NewHeight: Start of new block height ││ - Propose: Proposer creates block ││ - Prevote: Validators vote on block ││ - Precommit: Validators commit to block ││ - Commit: Block is finalized ││ │└─────────────────────────────────────────────────────────────────┘17.6 CometBFT (Tendermint v2)
Section titled “17.6 CometBFT (Tendermint v2)”CometBFT is the successor to Tendermint, featuring:
- Improved performance
- Simplified API
- Better transaction ordering
- Vote extensions
- Metadata in blocks
Key Differences
Section titled “Key Differences”| Feature | Tendermint | CometBFT |
|---|---|---|
| API | ABCI | ABCI++ |
| Performance | Good | Better |
| Vote Extensions | No | Yes |
| Partial Signatures | No | Yes |
17.7 Running a Tendermint Node
Section titled “17.7 Running a Tendermint Node”Installation
Section titled “Installation”# Install Tendermintgit clone https://github.com/cometbft/cometbft.gitcd cometbftmake install
# Verify installationtendermint versionConfiguration
Section titled “Configuration”# Validator configurationmoniker = "your-node-name"priv_validator_key_file = "config/priv_validator_key.json"priv_validator_state_file = "data/priv_validator_state.json"
# Network settingsp2p.laddr = "tcp://0.0.0.0:26656"rpc.laddr = "tcp://127.0.0.1:26657"
# Consensus settingsconsensus.timeout_propose = "3s"consensus.timeout_prevote = "1s"consensus.timeout_precommit = "1s"Starting the Node
Section titled “Starting the Node”# Initialize nodetendermint init
# Start nodetendermint start
# With custom configtendermint start --config /path/to/config.toml17.8 Interview Questions
Section titled “17.8 Interview Questions”| Question | Answer |
|---|---|
| What is Tendermint? | BFT consensus algorithm with instant finality |
| How does Tendermint guarantee safety? | 2/3+ honest validators required for consensus |
| What happens if 1/3 validators are offline? | Network halts (liveness failure) |
| How is the proposer selected? | Weighted round-robin based on stake |
| What is the block time in Tendermint? | 5-7 seconds |
| What is immediate finality? | Blocks are finalized in one block (no probabilistic finality) |
| What is ABCI? | Application Blockchain Interface - connects app to consensus |
Summary
Section titled “Summary”- Tendermint is a BFT consensus algorithm
- Provides instant block finality
- Uses rotating proposer selection
- Validators stake tokens to participate
- Supports up to 1/3 Byzantine faults
- CometBFT is the latest version
Next Chapter
Section titled “Next Chapter”In Chapter 18: RPC Nodes Explained, we’ll explore RPC node architecture.
Last Updated: 2026-02-20