txpool
Inspecting Unconfirmed Transactions in Erigon
The txpool namespace provides methods for inspecting and managing the transaction pool (mempool) in Erigon. These methods allow you to view pending, queued, and base fee transactions, providing insight into the current state of unconfirmed transactions. In Erigon, the txpool namespace is implemented through the TxPoolAPI interface and TxPoolAPIImpl struct.
The txpool namespace must be explicitly enabled using the --http.api flag when starting the RPC daemon. These methods are particularly useful for monitoring transaction pool status and debugging transaction submission issues.
Transaction Pool Architecture
Erigon's transaction pool is organized into three sub-pools: pending (executable), baseFee (insufficient base fee), and queued (nonce gaps)
The pool can run either integrated within the main Erigon process or as a separate service for scalability
Transaction pool methods communicate via gRPC with the txpool service when running in external mode
Implementation Details
The
TxPoolAPIImpluses aproto_txpool.TxpoolClientto communicate with the transaction pool serviceAll transactions are decoded from RLP format and converted to
ethapi.RPCTransactionobjects for JSON-RPC responsesThe implementation handles transaction categorization based on the
TxnTypefield from the pool service
External vs Internal Mode
Internal Mode: Transaction pool runs within the main Erigon process (default configuration)
External Mode: Transaction pool runs as a separate service, requiring explicit configuration with
--txpool.api.addr. External mode requires an external sentry service and provides better resource isolation
Usage in Development and Testing
These methods are commonly used for monitoring transaction submission and pool state
The
txpool_statusmethod provides quick insight into pool health and congestionTransaction pool content methods help debug why transactions may not be getting mined
Configuration and Limits
Transaction pool limits can be configured via flags like
--txpool.globalslots,--txpool.globalbasefeeslots, and--txpool.globalqueueThe pool supports various transaction types including blob transactions with separate limits
Pool configuration is managed through the
txpoolcfg.Configstructure
Availability
The
txpoolnamespace is available when included in the--http.apiflagMethods are marked as "remote" in the documentation, indicating they communicate with external services
All
txpoolmethods are available on both HTTP and WebSocket connections
txpool_content
Returns the content of the transaction pool, organized by sender address and categorized into pending, queued, and baseFee sub-pools.
Parameters
None
Example
Returns
Object
Transaction pool content organized by sub-pool type
pending
Object
baseFee
Object
queued
Object
txpool_contentFrom
Returns the content of the transaction pool for a specific sender address, showing all transactions from that address across all sub-pools.
Parameters
address
DATA, 20 BYTES
The sender address to query transactions for
Example
Returns
Object
Transaction pool content for the specified address
pending
Object
baseFee
Object
queued
Object
txpool_status
Returns the current status of the transaction pool, including the count of transactions in each sub-pool.
Parameters
None
Example
Returns
Object
Transaction pool status counts
pending
QUANTITY
baseFee
QUANTITY
queued
QUANTITY
Last updated
Was this helpful?