Prerequisite Readings
Cosmos EVM vs Ethereum
In Ethereum, pending blocks are generated as they are queued for production by miners. These pending blocks include pending transactions that are picked out by miners, based on the highest reward paid in gas. This mechanism exists as block finality is not possible on the Ethereum network. Blocks are committed with probabilistic finality, which means that transactions and blocks become less likely to become reverted as more time (and blocks) passes. Cosmos EVM is designed differently as it uses CometBFT consensus which provides instant finality for transactions. While there is no concept of “pending blocks” that can be reorganized, Cosmos EVM implements an experimental EVM mempool that provides Ethereum-compatible pending state functionality.EVM-Compliant Mempool
The experimental EVM mempool introduces a two-tiered system that brings Ethereum-like pending state behavior to Cosmos EVM:Transaction States
Pending Transactions
Transactions with correct nonces that are immediately executable. These are in the public mempool, broadcast to peers, and ready for block inclusion.
Queued Transactions
Transactions with future nonces (nonce gaps) that are stored locally. These wait for earlier transactions to execute before being promoted to pending.
Key Differences from Traditional Cosmos
- Nonce Gap Handling: Unlike traditional Cosmos chains that reject out-of-order transactions, the EVM mempool queues them locally until gaps are filled.
-
Fee-Based Priority: Both EVM and Cosmos transactions compete fairly based on their effective tips rather than FIFO ordering:
- EVM transactions: Priority =
gas_tip_cap
ormin(gas_tip_cap, gas_fee_cap - base_fee)
- Cosmos transactions: Priority =
(fee_amount / gas_limit) - base_fee
- EVM transactions: Priority =
- Transaction Replacement: Supports replacing pending transactions with higher fee versions using the same nonce, enabling “speed up” functionality common in Ethereum wallets.
Pending State Queries
With the experimental EVM mempool, pending state queries now reflect a more Ethereum-compatible view:Transaction Pool Inspection
The mempool provides dedicated RPC methods to inspect pending and queued transactions:txpool_status
txpool_status
Returns counts of pending and queued transactions:
txpool_content
txpool_content
Returns detailed information about all transactions in the pool, organized by account and nonce.
txpool_inspect
txpool_inspect
Provides human-readable summaries of transactions for debugging.
Pending State Behavior
When making queries with “pending” as the block parameter:- Balance Queries: Reflect the account balance after all pending transactions from that account are applied
- Nonce Queries: Return the next available nonce considering all pending transactions
- Gas Estimates: Account for pending transactions that may affect gas costs
Pending state queries are subjective to each node’s local mempool view. Different nodes may return different results based on their transaction pool contents.
JSON-RPC Calls Supporting Pending State
The following RPC methods support the"pending"
block parameter:
eth_getBalance
- Get balance considering pending transactionseth_getTransactionCount
- Get next nonce considering pending transactionseth_getBlockTransactionCountByNumber
- Count pending transactionseth_getBlockByNumber
- Get pending block informationeth_getTransactionByHash
- Retrieve pending transactionseth_getTransactionByBlockNumberAndIndex
- Access specific pending transactionseth_sendTransaction
- Submit new transactions
txpool_*
namespace provides specialized methods for mempool inspection:
txpool_status
- Get pool statisticstxpool_content
- View all pool transactionstxpool_contentFrom
- Filter by addresstxpool_inspect
- Human-readable summaries
Practical Examples
Monitoring Transaction Status
Handling Nonce Gaps
Transaction Replacement
Architecture Details
For a detailed understanding of how the pending state is managed:- See Mempool Architecture for the two-tier system design
- Review Transaction Flow for state transitions
- Check Integration Guide for implementation details