Ethereum

Ethereum

eth_getBlockTransactionCountByNumber

eth_getBlockTransactionCountByNumber reports how many transactions sit inside a single Ethereum block, identified by its height or by a tag such as latest or finalized. You point it at a block; it answers with one hex number. On Ethereum mainnet (chain ID 1, where block space is paid for in ETH) a validator seals one block every 12-second slot, so this count is a quick read on how busy that slot was. Send the request to https://ethereum.therpc.io/YOUR_API_KEY and you get back the transaction count for the block at the height or tag you named, without pulling down the full block body.

Use cases

  • Gauge live congestion by polling the count at latest each slot — a string of fat blocks usually means the EIP-1559 base fee is about to climb.
  • Build a per-block fullness series and feed it into your own fee-estimation heuristic alongside eth_feeHistory, since how packed recent blocks were drives the next base fee.
  • Walk a range of heights and flag the outliers: near-empty blocks during quiet hours, and the dense ones that spike during an airdrop claim or a popular NFT mint on OpenSea.

Parameters

#NameTypeRequiredDescription
1blockTagstringYesThe block to count transactions in.

Response

TypeDescription
string (hex)Hex-encoded transaction count.

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["latest"],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32602Invalid paramsBlock tag is malformed or unrecognised.

Common pitfalls

  • The pending tag counts the transactions a client currently expects to pack into the next block from the mempool, so two calls a second apart can disagree as new txs arrive and others get included.
  • The result is a hex string like 0x9c, not a JS number. Run it through parseInt(value, 16) before you compare or chart it, or your "150" block will sort as the string "0x96".

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

Parameters

hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByNumber","params":[""]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.