txpool_inspect - BSC
Example code for the txpool_inspect JSON RPC method. Complete guide on how to use txpool_inspect JSON RPC in GetBlock Web3 documentation.
This method returns a compact, human-readable summary of the pending and queued transactions in the transaction pool on the BNB Smart Chain. It has the same sender-and-nonce nesting as txpool_content, but each transaction is reduced to a single summary string instead of a full object, which makes the response far smaller.
Parameters
None
Request Example
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_inspect",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
method: 'txpool_inspect',
params: [],
id: 'getblock.io'
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => {
const { pending } = response.data.result;
for (const [sender, byNonce] of Object.entries(pending)) {
for (const [nonce, summary] of Object.entries(byNonce)) {
console.log(`${sender} #${nonce} -> ${summary}`);
}
}
})
.catch(error => console.error(error));Response Example
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"pending": {
"0x000000005f49971f36545bc6b07b8fb92c3999b1": {
"1263681": "0x000000002BCD37f2bB3B5ACab9Ff5E247556f592: 0 wei + 1208900 gas × 50000000 wei"
},
"0x00000000acd597fa0cbeec9f9a094252d5236082": {
"1020711": "0x000000002BCD37f2bB3B5ACab9Ff5E247556f592: 0 wei + 1208900 gas × 50000000 wei"
}
},
"queued": {
"0x000000000ce4f22a3cd50cc9a1ffe7f2417c5966": {
"7": "0xdec03919846f1b929ead493a927d3bda27a33d2e: 12000 wei + 21000 gas × 23675012 wei"
}
}
}
}Response Parameters
pending
object
Transactions eligible for inclusion, keyed by sender address, then by nonce
queued
object
Transactions not yet processable, with the same nesting
Each leaf value is a string in the form <to>: <value> wei + <gas> gas × <gasPrice> wei, where all numbers are decimal rather than hex-encoded.
to
Recipient address
value
BNB transferred, in wei
gas
Gas limit of the transaction
gasPrice
Gas price offered, in wei
Use Cases
Survey mempool contents without transferring megabytes of transaction data
Spot senders offering unusually high gas prices
Identify nonce gaps that leave transactions stuck in the queued set
Feed lightweight mempool dashboards and alerting
Error Handling
-32601
Method not supported
-32603
Internal error
SDK Integration
Last updated
Was this helpful?