eth_getBlockTransactionCountByNumber
BNB Smart Chain / https://triport.io/rpc/bsc
Minimum tier: Free
Last updated:
eth_getBlockTransactionCountByNumber returns the number of transactions in a selected BNB Smart Chain block as an EVM hex quantity.
Use it when only the count is needed and fetching the full block would be unnecessary. The block can be addressed by latest, earliest, pending, or a hex block number.
This method is block-scoped. eth_getTransactionCount instead returns an account nonce, while eth_getBlockByNumber returns the full block representation.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| block | BlockTag | Yes |
Returns
| Field | Type |
|---|---|
| transactionCount | Quantity |
Examples
curl https://triport.io/rpc/bsc \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByNumber","params":["<block>"]}'const res = await fetch("https://triport.io/rpc/bsc", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockTransactionCountByNumber",
"params": [
"<block>"
]
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/rpc/bsc",
headers={"Authorization": "Bearer <api-key>"},
json={"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByNumber","params":["<block>"]},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Chain: BNB Smart Chain.
- Clusters: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getBlockTransactionCountByNumber do?
- Return the transaction count in a block.
- How many credits does eth_getBlockTransactionCountByNumber cost?
- eth_getBlockTransactionCountByNumber costs 1 credit(s) per call on Triport by default.
- Is eth_getBlockTransactionCountByNumber available over WebSocket?
- eth_getBlockTransactionCountByNumber is an HTTP JSON-RPC method.