TriportRPC

eth_getBlockByNumber

Polygon / https://triport.io/polygon

Minimum tier: Free

Polygon method guide

Last updated:

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

This method takes no parameters.

Returns

eth_getBlockByNumber return value
FieldType
resultobject

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_getBlockByNumber","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_getBlockByNumber",
  "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_getBlockByNumber","params":[]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Polygon.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_getBlockByNumber do?
Returns a single Polygon block selected by block number or a named tag, optionally with every transaction body inlined.
How many credits does eth_getBlockByNumber cost?
eth_getBlockByNumber costs 1 credit(s) per call on Triport by default.
Is eth_getBlockByNumber available over WebSocket?
eth_getBlockByNumber is an HTTP JSON-RPC method.