POST
/
35848e183f3e3303c8cfeacbea831cab
curl --request POST \
  --url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByHash",
  "params": [
    "0x06edbf31479cd7452a1d579ec7990a631068b670de89c06822ceaef58f3729d4"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}

BNB API method that returns the number of transactions in a block specified by block hash. This information can be useful for analytics purposes.

Get you own node endpoint today

Start 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

  • hash — the block hash of the requested block.

Response

  • quantity — an integer value representing how many transactions are included in the block.

eth_getBlockTransactionCountByHash code examples

const { Web3 } = require("web3");

const NODE_URL = "CHAINSTACK_NODE_URL";

const web3 = new Web3(NODE_URL);



async function getTransactionsCount(blockHash) {

  const count = await web3.eth.getBlockTransactionCount(blockHash)

  console.log(count);

}



getTransactionsCount('0xc6dad3e4111ed170b899744f77d3fe2d87f3cc65b4e9bb1028293b7eff40d63e')

Use case

eth_getBlockTransactionCountByHash is a useful tool for analyzing transaction volume on the BNB blockchain. On average, a new block is generated on the BNB mainnet every 3 seconds, resulting in approximately 1,200 blocks per hour. Using a Web3 library, one can inspect the past 1,200 blocks starting from the latest block, retrieve the hash of each block, and use eth_getBlockTransactionCountByHash to find the number of transactions in each block.

Body

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

The block hash identifier.

Response

200 - application/json
The block information
jsonrpc
string
id
integer
result
string