Skip to main content
POST
/
eth_getBlockTransactionCountByHash
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByHash",
  "params": [
    "0xf3cf930f1b4d9637134d09f126c57c30c3f4f40edf10ba502486b26d14b4f944"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Monad API method that returns the number of transactions in a block matching the given block hash. This method is useful for quickly determining the transaction count without retrieving the entire block data.
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

  • data — the 32-byte hash of the block.

Response

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

eth_getBlockTransactionCountByHash code examples

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

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

async function getBlockTransactionCount() {
  const blockHash = "0xf3cf930f1b4d9637134d09f126c57c30c3f4f40edf10ba502486b26d14b4f944";
  const count = await provider.send("eth_getBlockTransactionCountByHash", [blockHash]);
  console.log(`Transaction count: ${parseInt(count, 16)}`);
}

getBlockTransactionCount();

Use case

A practical use case for eth_getBlockTransactionCountByHash is monitoring network activity by tracking transaction counts in specific blocks, or validating block data integrity when you have a known block hash.

Body

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

Response

200 - application/json

The number of transactions in the block.

jsonrpc
string
id
integer
result
string