Overview
Cosmos SDK applications integrate with the CometBFT (formerly Tendermint) consensus engine through the Application Blockchain Interface (ABCI). This separation allows the consensus layer and application layer to evolve independently.ABCI Architecture
ABCI Methods
BaseApp implements all ABCI methods:Execution Modes
The SDK supports different execution contexts:Block Lifecycle
InitChain
Called once when the chain starts:CheckTx (Mempool)
Validates transactions before mempool inclusion:CheckTx Types
PrepareProposal
Proposer constructs a block:Default Behavior
ProcessProposal
Validators verify proposed blocks:Validation Checks
Transaction Validity
Transaction Validity
All transactions decode successfully and pass basic validation
Gas Limits
Gas Limits
Total gas wanted doesn’t exceed block gas limit
Deterministic Ordering
Deterministic Ordering
Transactions are in expected order (if required)
Custom Rules
Custom Rules
Application-specific validation (e.g., minimum fees)
FinalizeBlock
Executes the agreed-upon block:Execution Order
- PreBlock: Process vote extensions, update consensus params
- BeginBlock: Mint rewards, distribute fees, update validators
- Transactions: Execute each transaction in order
- EndBlock: Finalize validator updates, execute governance
Commit
Persists state changes:Commit ID
Vote Extensions
Validators can attach additional signed data to votes:Extend Vote
Verify Vote Extension
Use Cases
Oracle Prices
Validators submit price feeds in vote extensions
Randomness
Generate verifiable random numbers from validator contributions
Threshold Signatures
Collect signature shares for multisig operations
MEV Prevention
Commit-reveal schemes for transaction ordering
Consensus Parameters
Updating Consensus Params
Info and Query
Info Method
Query Method
State Synchronization
CometBFT state sync enables fast bootstrapping:ABCI++ Features
ABCI++ (introduced in CometBFT v0.38) adds:PrepareProposal & ProcessProposal
Gives applications control over block construction:- Enforce minimum fees
- Require specific transactions (e.g., oracle updates)
- Implement MEV protection
- Custom transaction ordering
Vote Extensions
Enables new consensus mechanisms:Best Practices
Keep ABCI Methods Fast
Keep ABCI Methods Fast
ABCI methods block consensus. Avoid expensive operations.
Deterministic Execution
Deterministic Execution
All nodes must produce identical results. Avoid randomness and timestamps.
Validate in ProcessProposal
Validate in ProcessProposal
Reject invalid blocks early to save execution costs.
Graceful Error Handling
Graceful Error Handling
Return appropriate ABCI response codes, don’t panic.
Monitor Gas Usage
Monitor Gas Usage
Track block gas to prevent DoS attacks.
CometBFT Configuration
Key consensus parameters inconfig.toml:
Related Topics
BaseApp
BaseApp ABCI implementation
Transactions
Transaction lifecycle
CometBFT Docs
CometBFT documentation
ABCI Spec
ABCI specification