For the complete documentation index, see llms.txt. This page is also available as Markdown.

txpool_status - Ethereum

Example code for the txpool_status JSON RPC method. Complete guide on how to use txpool_status JSON RPC in GetBlock Web3 documentation.

This method returns the number of pending and queued transactions currently held in the node's transaction pool. It is the cheapest of the txpool_* methods: the response is two integers regardless of how busy the mempool is.

Parameters

This method takes no parameters.

Request

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "txpool_status",
    "params": [],
    "id": "getblock.io"
}'
example.js
const axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'txpool_status',
    params: [],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

const result = response.data.result;
console.log('Pending:', parseInt(result.pending, 16));
console.log('Queued:', parseInt(result.queued, 16));

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "pending": "0x1739e",
        "queued": "0x36f3"
    }
}

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC protocol version ("2.0")

id

string

Request identifier matching the request

pending

string

Hex-encoded count of transactions eligible for inclusion (0x1739e = 95,134)

queued

string

Hex-encoded count of transactions not yet processable (0x36f3 = 14,067)

Use Cases

  • Congestion Monitoring: Track mempool depth over time to gauge network load

  • Confirmation Estimates: Combine pending depth with block gas limits to estimate wait times

  • Node Health Checks: Confirm an endpoint is peered and receiving transactions

  • Cheap Polling: Detect mempool changes before paying for a full txpool_content call

Error Handling

Error Code
Message
Description

-32601

Method not found

The txpool module is not enabled on this endpoint

-32603

Internal error

Node failed to read the transaction pool

Web3 Integration

Last updated

Was this helpful?