TriportRPC

eth_getBlockByHash

POSThttps://api.triport.io/polygon

Returns a Polygon block, addressed by its 32-byte block hash, with its transactions either fully expanded or as a list of hashes.

Polygonpolygon_read_rpcfree — 15 RPS · basic — 20 RPS · pro — 100 RPS · business — 250 RPS

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)required
Hash of the block to fetch, 0x-prefixed (66 characters total).
fullTxBodiesbooleanrequired
true 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)
Block number.
hashstring (hex)
Hash of this block — equals the requested blockHash.
parentHashstring (hex)
Hash of the parent block.
noncestring (hex)
Block nonce. On Bor (proof-of-stake) this is zero.
sha3Unclesstring (hex)
Keccak-256 of the uncles data.
logsBloomstring (hex)
Bloom filter for the block's logs.
transactionsRootstring (hex)
Root of the transaction trie.
stateRootstring (hex)
Root of the final state trie.
receiptsRootstring (hex)
Root of the receipts trie.
minerstring (hex)
Block author address.
difficultystring (hex)
Block difficulty (low on Bor).
totalDifficultystring (hex)
Total chain difficulty up to this block.
extraDatastring (hex)
Arbitrary extra data field of the block.
sizestring (hex)
Block size in bytes.
gasLimitstring (hex)
Maximum gas allowed in this block.
gasUsedstring (hex)
Total gas used by all transactions in the block.
baseFeePerGasstring (hex)
Base fee per gas (EIP-1559).
timestampstring (hex)
Unix timestamp of when the block was produced.
transactionsarray
Transaction hashes (when fullTxBodies = false) or full transaction objects (when true).
unclesarray
Always [] on Polygon — Bor consensus produces no uncle blocks.

Errors

CodeMeaningWhen it happens
-32001trial_expiredThe API key's trial period has ended; upgrade to a paid tier to continue.
-32002tier_insufficientThe key's tier is below the level required for this method.
-32003rate_limitedPer-tier RPS limit exceeded (15 / 20 / 100 / 250 RPS for free / basic / pro / business). Back off and retry.
-32004subscription_expiredThe subscription tied to the key has lapsed.
-32005unauthorizedMissing, malformed, or invalid API key.
-32601method_unknownThe 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://api.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`);
}

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const triport = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const block = await triport.polygon.getBlockByHash(
  "0x9b7f2a3c1d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcd",
  false, // transaction hashes only; pass true for full objects
);


if (block) {
  console.log(`block #${BigInt(block.number)}${block.transactions.length} txs`);
}

Python (triport-sdk)

import os
from triport import Triport


triport = Triport(api_key=os.environ["TRIPORT_API_KEY"])


block = triport.polygon.get_block_by_hash(
    "0x9b7f2a3c1d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcd",
    full_tx_bodies=False,
)


if block is not None:
    print(f"block #{int(block['number'], 16)}{len(block['transactions'])} txs")

Notes

  • null means not found — and may mean a re-org. Unknown hashes return result: null, not an error. If a hash you held earlier now returns null, the block was likely orphaned by a chain reorganization. Guard for null before 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 uncles is always [] and sha3Uncles reflects empty uncle data.
  • Pick the cheaper transaction form. Use fullTxBodies = false when you only need transaction IDs; it avoids transferring every transaction body (~3–5 KB versus 30–100 KB for a full block). Pass true only when you need the inlined transaction objects.
  • Related methods: eth_getBlockByNumber, eth_getBlockTransactionCountByHash, eth_getBlockReceipts.