eth_getBlockTransactionCountByNumber
Polygon / https://triport.io/polygon
Minimum tier: Free
Last updated:
eth_getBlockTransactionCountByNumber returns how many transactions are
contained in a given Polygon block, selected by block number (a 0x-prefixed
hex integer) or by one of the named block tags. The count is returned as a
0x-prefixed hexadecimal string.
Use it when you only need the transaction count and not the full block body —
for example to size pagination, to detect empty blocks, or to decide whether a
heavier eth_getBlockByNumber call is worth issuing.
If you already have a block hash instead of a number, use the sibling method
eth_getBlockTransactionCountByHash.
This is a light read on the free tier (polygon_read_rpc category). Polygon
blocks are produced about every ~2.1 seconds and typically carry ~50–150
transactions, so latest advances quickly — poll on roughly that cadence if you
are tracking the chain tip. A request for a block that does not exist (e.g. a
height beyond the current chain head) returns a result of null rather than
an error.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://triport.io/polygon \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByNumber","params":[]}'const res = await fetch("https://triport.io/polygon", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockTransactionCountByNumber",
"params": []
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/polygon",
headers={"Authorization": "Bearer <api-key>"},
json={"jsonrpc":"2.0","id":1,"method":"eth_getBlockTransactionCountByNumber","params":[]},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Chain: Polygon.
- Clusters: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getBlockTransactionCountByNumber do?
- Returns the number of transactions in a Polygon block identified by its number or a block tag.
- 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.