BNB Smart Chain
eth_getBlockTransactionCountByNumber
eth_getBlockTransactionCountByNumber answers a narrow question cheaply: how many transactions sit in the block at a given height or named tag? BNB Smart Chain finalizes new blocks about every three seconds under PoSA and pays its fees in BNB. You pass either a hex block number or a label like latest, safe, or finalized, and receive the count as a hex integer without downloading the full block body. Send the request to https://bsc.therpc.io/YOUR_API_KEY on chain ID 56 whenever you want block fullness but not the transactions themselves.
Use cases
- Gauge live BSC congestion by polling the
latestblock and watching how its transaction count rises and falls. - Accumulate a per-block fullness time series that feeds gas-price and fee-estimation heuristics for your wallet.
- Scan a range of heights to flag near-empty blocks or unusually packed ones during validator-performance analysis.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockTag | string | Yes | The block to count transactions in. |
Response
| Type | Description |
|---|---|
| string (hex) | Hex-encoded transaction count. |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32602 | Invalid params | Block tag is malformed or unrecognised. |
Common pitfalls
- Asking with the
pendingtag counts transactions the node is currently queuing for the next BSC block, so the figure can shift from one call to the next. - The value comes back as a hex string such as
0x9c; run it throughparseInt(value, 16)before doing any numeric comparison or arithmetic.
Supported networks
- Mainnet — Chain ID: 56
- Testnet — Chain ID: 97
See also
- eth_getBlockTransactionCountByHash
- eth_blockNumber
- eth_getBlockByNumber
- eth_getTransactionByBlockNumberAndIndex
Parameters
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"