eth_getBlockByNumber — Polygon JSON-RPC
Returns a single Polygon block selected by block number or a named tag, optionally with every transaction body inlined.
https://triport.io/polygon- Network
- Polygon
- Scope
- polygon_read_rpc
- Auth
- x-token: $TRIPORT_API_KEY (or Authorization: Bearer) (the x-token: $TRIPORT_API_KEY header is also accepted)
- Rate limit
- free (and up) — 15 rps (free) · 20 rps (basic) · 100 rps (pro) · 250 rps (business); burst = 2 × the sustained rps
Endpoint and plans: Polygon RPC endpoint.
eth_getBlockByNumber is the most common block read on Polygon. Given a block
number (or one of the tags latest, earliest, pending, safe,
finalized) it returns the block's header plus its transaction list. The second
parameter chooses how transactions are rendered: pass false to get an array of
transaction hashes (a light ~3–5 KB payload), or true to inline every
full transaction body (a heavier ~30–100 KB payload for a typical block of
50–150 transactions).
Polygon's block time is roughly 2.1 seconds, so eth_getBlockByNumber("latest", …)
advances about every 2 s. A bot tracking the chain tip in real time should poll
on that cadence rather than tighter — there is no new block to fetch in between.
Polygon runs Bor consensus and therefore has no uncle blocks: the uncles
array is always empty and sha3Uncles is the empty-list hash. This is the main
shape difference from Ethereum mainnet. Use eth_getBlockByHash
instead when you already hold a block hash (for example, to detect a re-org by
checking whether a previously seen hash still resolves).
Parameters
Positional params array: [blockNumber, fullTxBodies].
blockNumberstringrequired"0x3b9aca00") or a tag: latest, earliest, pending, safe, or finalized.fullTxBodiesbooleanrequiredfalse → transactions is an array of tx hashes (light). true → transactions holds full transaction objects (heavy).Response
With fullTxBodies: true, each entry of transactions is a full transaction
object (hash, from, to, value, input, gas, gasPrice,
maxFeePerGas, nonce, blockNumber, transactionIndex, …) instead of a hash
string.
If the requested block does not exist, result is null.
numberstring (hex)null for a pending block.hashstringnull for a pending block.parentHashstringnoncestring (hex)0x00…0 on Bor.sha3UnclesstringlogsBloomstringtransactionsRootstringstateRootstringreceiptsRootstringminerstringdifficultystring (hex)totalDifficultystring (hex)extraDatastringsizestring (hex)gasLimitstring (hex)gasUsedstring (hex)baseFeePerGasstring (hex)timestampstring (hex)unclesarray[] on Polygon (Bor consensus).transactionsarrayfullTxBodies=false; full tx objects when true.Errors
Errors arrive in the standard JSON-RPC error object; the extra fields move
into error.data.
| Code | Meaning | When it happens |
|---|---|---|
401 | trial_expired | The free 7-day trial has ended. |
403 | tier_insufficient | Your tier is below what the method requires. (Not expected here — this method is included in the Free trial.) |
429 | rate_limited | You exceeded the sustained rps for your tier; respect Retry-After / data.retry_after_sec. |
401 | subscription_expired | A previously active paid subscription has lapsed. |
401 | unauthorized | Missing, invalid, or revoked credentials. |
HTTP 403 | method_unknown | The method name was not recognised on the polygon chain. |
See the shared Errors reference for the full envelope, the
HTTP-status mapping, and error.data field definitions.
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_getBlockByNumber",
params: ["latest", false],
}),
});
const { result, error } = await res.json();
if (error) throw new Error(`${error.code}: ${error.message}`);
console.log("tip block:", parseInt(result.number, 16), "tx count:", result.transactions.length);Notes
- Payload sizing.
fullTxBodies=falseis ~3–5 KB;trueis ~30–100 KB for a typical 50–150-tx Polygon block. Fetch hashes first and pull only the bodies you need unless you genuinely require all of them. - Tip polling. With ~2.1 s block time, poll
["latest", false]about every 2 seconds for real-time tip tracking. - No uncles.
unclesis always[]andsha3Unclesis the empty-list hash (Bor consensus). Do not write logic that expects uncle data on Polygon. - No daily cap. Rate limiting is sustained-rps-per-tier with a 2× burst allowance — there is no daily quota. See Rate limits.
- Related:
eth_getBlockByHash(same shape, by hash) ·eth_getBlockReceipts(all receipts in a block in one call) ·eth_getBlockTransactionCountByNumber.
- Finality: read the
finalizedtag instead of counting confirmations — see Polygon PoS finality: milestones and confirmations.