Skip to main content
POST
/
eth_getBlockTransactionCountByNumber
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "latest"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Monad API method that returns the number of transactions in a block matching the given block number. This method allows you to quickly check the transaction count for any block by its number.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • quantity|tag — the block number as a hexadecimal string, or one of the following block tags:
    • latest — the most recent block in the canonical chain
    • earliest — the genesis block
    • pending — the pending state/transactions

Response

  • result — the number of transactions in the block, encoded as hexadecimal.

eth_getBlockTransactionCountByNumber code examples

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

async function getBlockTransactionCount() {
  const blockNumber = "latest"; // Or use hex like "0x1234"
  const count = await provider.send("eth_getBlockTransactionCountByNumber", [blockNumber]);
  console.log(`Transaction count: ${parseInt(count, 16)}`);
}

getBlockTransactionCount();

Use case

A practical use case for eth_getBlockTransactionCountByNumber is analyzing network throughput over time by sampling transaction counts across multiple blocks, which helps understand network congestion patterns.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getBlockTransactionCountByNumber
params
string[]

Response

200 - application/json

The number of transactions in the block.

jsonrpc
string
id
integer
result
string