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
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Yes | The hash of the block to count transactions in. |
Response
| Type | Description |
|---|---|
| string (hex) | Hex-encoded transaction count. "0x0" means the block is empty. |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32602 | Invalid params | Block hash is malformed or not 32 bytes. |
Common pitfalls
- An unrecognized hash comes back as
nullrather than an error, so null-check before you feed the result intoparseInt. - If you only hold a height and do not need hash-level certainty,
eth_getBlockTransactionCountByNumberis 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