eth_getBlockReceipts
https://api.triport.ioReturns every transaction receipt for a single Polygon block in one call — the fast path for block-level indexing.
eth_getBlockReceipts returns the receipts for all transactions in a given
block as a single array. It is the bulk equivalent of calling
eth_getTransactionReceipt once per
transaction — but in a single round trip, which is dramatically faster when you
need to index or analyze a whole block (gas usage, event logs, contract
creations, status flags).
Use it when you are building an indexer, analytics pipeline, or block explorer
that processes every transaction in a block. For pulling only events that match
a filter (by address/topic), prefer
eth_getLogs instead; for a single transaction's outcome,
use eth_getTransactionReceipt.
Gotchas to plan for:
- Payload-heavy. A typical Polygon block carries 50–150 transactions, so a single response is commonly 50–300 KB. Make sure your HTTP client and any intermediate proxy allow response bodies of that size and set generous read timeouts.
- Block cadence. Polygon block time is ~2.1 s, so
latestadvances roughly every two seconds. When polling the chain tip, align your interval to that cadence rather than hammering the endpoint. - Still cheaper than N calls. Even though the response is large, one
eth_getBlockReceiptscall avoids the per-transaction network round-trips ofN×eth_getTransactionReceipt, which is the main reason to use it for indexing.
Parameters
A single positional parameter — a block number, block hash, or a named block tag.
blockstringrequired"0x3a1f2c0"), a 32-byte block hash, or a tag — "latest", "earliest", "pending", "safe", or "finalized".Response
The result is an array of receipt objects — one per transaction, in the order
they appear in the block. (Trimmed to two receipts below; a real block returns
50–150.)
blockHashstringblockNumberstringtransactionHashstringtransactionIndexstringfromstringtostring | nullnull for contract-creation transactions.contractAddressstring | nullnull if the transaction was not a contract creation.cumulativeGasUsedstringgasUsedstringeffectiveGasPricestringlogsarraylogsBloomstringstatusstring"0x1" on success, "0x0" on revert.typestring"0x0" legacy, "0x2" EIP-1559, etc.).Errors
Errors are returned in the standard JSON-RPC envelope (error.code,
error.message, optional error.data). See errors.md for the
full envelope and the data fields attached to tier/rate-limit errors.
| Code | Meaning | When it happens |
|---|---|---|
-32001 | trial_expired | The account's trial period has ended. |
-32002 | tier_insufficient | The key's tier does not include the polygon_read_rpc capability. |
-32003 | rate_limited | Per-tier RPS exceeded; retry after data.retry_after_sec. |
-32004 | subscription_expired | The paid subscription lapsed. |
-32005 | unauthorized | Missing or invalid API key. |
-32601 | method_unknown | Method not available on this network/key. |
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "eth_getBlockReceipts",
params: ["latest"],
}),
});
const { result: receipts } = await res.json();
const totalGas = receipts.reduce((sum, r) => sum + BigInt(r.gasUsed), 0n);
console.log(`${receipts.length} receipts, ${totalGas} gas used`);TypeScript SDK (@triport/sdk)
import { Triport } from "@triport/sdk";
const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });
const receipts = await client.polygon.rpc<unknown[]>("eth_getBlockReceipts", [
"latest",
]);
console.log(`fetched ${receipts.length} receipts in one call`);Python (triport-sdk)
import os
from triport import Triport
client = Triport(api_key=os.environ["TRIPORT_API_KEY"])
receipts = client.polygon.rpc("eth_getBlockReceipts", ["latest"])
total_gas = sum(int(r["gasUsed"], 16) for r in receipts)
print(f"{len(receipts)} receipts, {total_gas} gas used")Notes
- Indexing pattern. To backfill a range of blocks, iterate block numbers and
call
eth_getBlockReceiptsonce per block rather than fanning outeth_getTransactionReceiptper transaction — fewer round trips, far less overhead. Pace your loop against your tier's RPS limit and handle-32003with theretry_after_sechint. - Related methods:
eth_getTransactionReceipt(single receipt),eth_getLogs(filtered events across a block range),eth_getBlockByNumber(block header and transaction list). - No pagination. The full block's receipts are returned in one response; size scales with the number of transactions in the block.