BNB Smart Chain

BNB Smart Chain

eth_getBlockTransactionCountByHash

eth_getBlockTransactionCountByHash answers a single question about a BNB Smart Chain block: how many transactions it contains, looked up by the block's 32-byte hash. It skips the payload entirely and just returns the tally as hex. BNB Smart Chain is the BNB-gas, PoSA-validator EVM, so this count reflects exactly what one canonical, uncle-free block sealed. Send the hash to https://bsc.therpc.io/YOUR_API_KEY at chain ID 56 and you get back that number alone — a cheap way to gauge how busy the block was.

Use cases

  • Gauge how full a BSC block was without paying to download its entire body.
  • Cross-check that an indexer captured the expected transaction count for a block it already processed.
  • Sample throughput across a set of known block hashes to chart BSC activity over time.

Parameters

#NameTypeRequiredDescription
1blockHashstring (hex)YesThe hash of the block to count transactions in.

Response

TypeDescription
string (hex)Hex-encoded transaction count. "0x0" means the block is empty.

Example request

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

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32602Invalid paramsBlock hash is malformed or not 32 bytes.

Common pitfalls

  • An unrecognized hash comes back as null rather than an error, so null-check before you feed the result into parseInt.
  • If you only hold a height and do not need hash-level certainty, eth_getBlockTransactionCountByNumber is the simpler counterpart to reach for.

Supported networks

  • Mainnet — Chain ID: 56
  • Testnet — Chain ID: 97

See also

Parameters

0x-prefixed 32-byte block hash

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

Ready to call this in production?

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