txpool_status - Ethereum

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

bashcurl --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

javascriptconst 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));

example.py

pythonimport requests

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

result = response.json()['result']
print(f"Pending: {int(result['pending'], 16)}")
print(f"Queued: {int(result['queued'], 16)}")

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "txpool_status",
            "params": [],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Result: {}", response["result"]);
    Ok(())
}

Response

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

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
pendingstringHex-encoded count of transactions eligible for inclusion (0x1739e = 95,134)
queuedstringHex-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 CodeMessageDescription
-32601Method not foundThe txpool module is not enabled on this endpoint
-32603Internal errorNode failed to read the transaction pool

Web3 Integration

ethers-example.js

javascriptimport { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

const status = await provider.send('txpool_status', []);
console.log('Pending:', parseInt(status.pending, 16));
console.log('Queued:', parseInt(status.queued, 16));

viem-example.js

javascriptimport { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';

const client = createPublicClient({
    chain: mainnet,
    transport: http('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/'),
});

const status = await client.request({ method: 'txpool_status' });
console.log('Pending:', parseInt(status.pending, 16));