# txpool API proposal (draft) This proposal is an initial draft to standardize the `txpool` JSON-RPC API for Ethereum execution clients. All clients provide some access to `txpool` information, but currently all have their own implementations. See more details below. Standardizing the `txpool` namespace would be beneficial for interoperability, and hopefully allows for more reliable integrations that enable for example [crLists](https://github.com/flashbots/mev-boost/issues/215). ## Current state 1. [Geth](#Geth) 2. [Nethermind](#Nethermind) 3. [Hyperledger Besu](#Hyperledger-Besu) 4. [Erigon](#Erigon) ### Geth Repo https://github.com/ethereum/go-ethereum Docs https://geth.ethereum.org/docs/rpc/ns-txpool - **txpool_content** - returns all transactions currently pending for inclusion, as well as the ones queued for future execution. - method signature: `txpool.Content()` - response: ``` { pending: { 0x0216d5032f356960cd3749c31ab34eeff21b3395: { 806: { ...tx } } }, queued: { ... } } ``` - **txpool_contentFrom** - similar to txpool_content, but only includes transactions from the specified address - method signature: `txpool.contentFrom(address)` - example response: (see above) - **txpool_inspect** - a textxual summary of all the pending and queued transaction in the pool. - method signature: `txpool.Inspect() ` - example response ``` { pending: { 0x26588a9301b0428d95e6fc3a5024fce8bec12d51: { 31813: "0x3375ee30428b2a71c428afa5e89e427905f95f7e: 0 wei + 500000 × 20000000000 wei" }, }, queued: { ... } } ``` - **txpool_status** - the number of pending and queueud transactions in the pool. - method signature: `txpool.Status()` - example response: ``` { pending: 10, queued: 7 } ``` ### Nethermind Repo https://github.com/NethermindEth/nethermind Docs https://docs.nethermind.io/nethermind/ethereum-client/json-rpc/txpool #### Methods - **txpool_content** - same as Geth - **txpool_inspect** - same as Geth - **txpool_status** - same as Geth -- - **parity_pendingTransactions** - Returns a list of transactions currently in the queue. If address is provided, returns transactions only with given sender address https://docs.nethermind.io/nethermind/ethereum-client/json-rpc/parity#parity_pendingtransactions - method signature: parity_pendingTransactions(address?) - example response: ``` { "result": { ...tx } } ``` ### Hyperledger Besu Repo https://github.com/hyperledger/besu/ Docs https://besu.hyperledger.org/en/stable/public-networks/reference/api/#txpool-methods - **txpool_besuPendingTransactions** - lists pending transactions that match the supplied filter conditions. - method signature: `txpool_besuPendingTransactions(fields, numResults?)` - example response: ``` [ { ...tx }, { ...tx } ] ``` - **txpool_besuStatistics** - lists statistics about the node transaction pool - method signature: `txpool_besuStatistics()` - example response: ``` { "maxSize": 4096, "localCount": 1, "remoteCount": 0 } ``` - **txpool_besuTransactions** - lists transactions in the node transaction pool. - method signature: `txpool_besuTransactions()` - example response: ``` [ { "hash": "..", "isReceivedFromLocalSource": true, "addedToPoolAt": "2019-03-21T01:35:50.911Z" }, { ... } ] ``` ### Erigon Repo https://github.com/ledgerwatch/erigon Docs https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/README.md#rpc-implementation-status #### Methods - **txpool_content** - same as Geth - **txpool_status** - same as Geth ## Proposal The main outlier is Besu, although we could map their implementations to the following methods on other clients: - **txpool_content** <=> **txpool_besuPendingTransactions** - **txpool_inspect** <=> **txpool_besuTransactions** - **txpool_status** <=> **txpool_besuStatistics** Besu's `txpool_besuPendingTransactions` is however a good example using (optional) filters. This would make Geth's `txpool_contentFrom` obsolete, but also gives more fine-grained control over transaction results. ### Proposed API spec - **txpool_transactions** - params - filter: object (optional) - from - to - gas - gasPrice - value - nonce - **txpool_statistics** - **txpool_inspect**