eth_getBlockTransactionCountByHash
Polygon / https://triport.io/polygon
Minimum tier: Free
Last updated:
eth_getBlockTransactionCountByHash returns a single integer: how many
transactions are contained in the block whose hash you pass. It is the standard
EVM read for "how big is this block" when you already hold the block hash (for
example, from a logs entry, a receipt, or a prior eth_getBlockByHash call).
The count is returned as a hex-encoded quantity (e.g. "0x4d" = 77). If no block
with the given hash exists on the canonical chain — an unknown hash, or a hash
that was orphaned by a re-org — the method returns null rather than an error.
This is a light, low-cost read. In practice it is often redundant: a single
eth_getBlockByNumber/eth_getBlockByHash already returns the transaction
hashes, so their length gives you the same count without a second round-trip.
Reach for this method when you specifically want the count and nothing else.
Polygon note: Polygon runs Bor consensus with ~2.1 s block time and no uncle blocks. A typical block carries ~50–150 transactions.
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_getBlockTransactionCountByHash","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_getBlockTransactionCountByHash",
"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_getBlockTransactionCountByHash","params":[]},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Chain: Polygon.
- Clusters: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getBlockTransactionCountByHash do?
- Returns the number of transactions in a Polygon block, identified by its block hash.
- How many credits does eth_getBlockTransactionCountByHash cost?
- eth_getBlockTransactionCountByHash costs 1 credit(s) per call on Triport by default.
- Is eth_getBlockTransactionCountByHash available over WebSocket?
- eth_getBlockTransactionCountByHash is an HTTP JSON-RPC method.