TriportRPC

eth_getBlockByHash

Polygon / https://triport.io/polygon

Minimum tier: Free

Polygon method guide

Last updated:

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

This method takes no parameters.

Returns

eth_getBlockByHash 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_getBlockByHash","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_getBlockByHash",
  "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_getBlockByHash","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_getBlockByHash do?
Returns a Polygon block, addressed by its 32-byte block hash, with its transactions either fully expanded or as a list of hashes.
How many credits does eth_getBlockByHash cost?
eth_getBlockByHash costs 1 credit(s) per call on Triport by default.
Is eth_getBlockByHash available over WebSocket?
eth_getBlockByHash is an HTTP JSON-RPC method.