eth_getBlockByHash — Polygon JSON-RPC
Returns a Polygon block, addressed by its 32-byte block hash, with its transactions either fully expanded or as a list of hashes.
https://triport.io/polygon- Network
- Polygon
- Scope
- polygon_read_rpc
- Auth
- x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
- Rate limit
- free — 15 RPS sustained · up to 30 burst · basic — 20 RPS sustained · up to 40 burst · pro — 100 RPS sustained · up to 200 burst · business — 250 RPS sustained · up to 500 burst; Burst capacity
Endpoint and plans: Polygon RPC endpoint.
eth_getBlockByHash looks up a single Polygon block by its hash and returns the
block header plus its transaction list. Use it when you already hold a block
hash — for example from a log, a receipt's blockHash, or a previous
eth_getBlockByNumber response — and want the canonical block it identifies.
Looking up by hash is unambiguous: a hash pins exactly one block, whereas a block
number can be reassigned to a different block after a reorganization.
The second parameter controls how transactions are returned. Pass true to get
each transaction inlined as a full object (sender, recipient, value, input data,
gas, etc.); pass false to get just the array of transaction hashes, which is
much cheaper to transfer when you only need the IDs. A typical Polygon block
carries ~50–150 transactions, so the full-body form can be 30–100 KB versus
~3–5 KB for the hash-only form.
If no block with the given hash is known to the node, the call succeeds and
returns null rather than an error. Because a hash that was canonical can stop
being canonical after a reorg, a previously-valid hash returning null is a
useful signal for re-org detection — always check for null before reading
fields off the result.
Parameters
Positional params array: [blockHash, fullTxBodies].
blockHashstring (32-byte hex)required0x-prefixed (66 characters total).fullTxBodiesbooleanrequiredtrue returns full transaction objects in transactions; false returns only transaction hashes.Response
With fullTxBodies = false, transactions is an array of hashes:
When fullTxBodies = true, each entry in transactions is a full transaction
object instead of a hash:
"transactions": [
{
"hash": "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
"blockHash": "0x9b7f2a3c1d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcd",
"blockNumber": "0x3753f00",
"transactionIndex": "0x0",
"from": "0xa1e4380a3b1f749673e270229993ee55f35663b4",
"to": "0x5df9b87991262f6ba471f09758cde1c0fc1de734",
"value": "0x7f110",
"gas": "0x4cb26",
"gasPrice": "0x6fc23ac00",
"nonce": "0x15",
"input": "0x"
}
]numberstring (hex)hashstring (hex)blockHash.parentHashstring (hex)noncestring (hex)sha3Unclesstring (hex)logsBloomstring (hex)transactionsRootstring (hex)stateRootstring (hex)receiptsRootstring (hex)minerstring (hex)difficultystring (hex)totalDifficultystring (hex)extraDatastring (hex)sizestring (hex)gasLimitstring (hex)gasUsedstring (hex)baseFeePerGasstring (hex)timestampstring (hex)transactionsarrayfullTxBodies = false) or full transaction objects (when true).unclesarray[] on Polygon — Bor consensus produces no uncle blocks.Errors
| Code | Meaning | When it happens |
|---|---|---|
401 | trial_expired | The API key's trial period has ended; upgrade to a paid tier to continue. |
403 | tier_insufficient | The key's tier is below the level required for this method. |
429 | rate_limited | Per-tier RPS limit exceeded (15 / 20 / 100 / 250 RPS sustained · short burst 30 / 40 / 200 / 500 for free / basic / pro / business). Back off and retry. |
401 | subscription_expired | The subscription tied to the key has lapsed. |
401 | unauthorized | Missing, malformed, or invalid API key. |
HTTP 403 | method_unknown | The method name is not recognized on this path. |
A non-existent block hash is not an error — the call returns result: null.
Every error follows the shared JSON-RPC error envelope — see
Errors for the full structure and handling guidance.
Examples
JavaScript (fetch)
const res = await fetch("https://triport.io/polygon", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "eth_getBlockByHash",
params: [
"0x9b7f2a3c1d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcd",
false,
],
}),
});
const { result: block } = await res.json();
if (block === null) {
console.log("no such block — possible re-org");
} else {
console.log(`block #${BigInt(block.number)} — ${block.transactions.length} txs`);
}Notes
nullmeans not found — and may mean a re-org. Unknown hashes returnresult: null, not an error. If a hash you held earlier now returnsnull, the block was likely orphaned by a chain reorganization. Guard fornullbefore reading any field.- Finality on Polygon. Bor reorgs are rare but real; finality lands after roughly 2–3 checkpoints (~256 blocks, about 9 minutes). For confirmation before acting on a block, wait at least 64–128 blocks (~2–4 minutes) past it.
- No uncles. Polygon's Bor consensus does not produce uncle blocks, so
unclesis always[]andsha3Unclesreflects empty uncle data. - Pick the cheaper transaction form. Use
fullTxBodies = falsewhen you only need transaction IDs; it avoids transferring every transaction body (~3–5 KB versus 30–100 KB for a full block). Passtrueonly when you need the inlined transaction objects. - Related methods:
eth_getBlockByNumber,eth_getBlockTransactionCountByHash,eth_getBlockReceipts.