TriportRPC

eth_getBlockByHash

POSThttps://api.triport.io/v1/ethereum

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

Ethereumeth_read_rpcfree — 10 RPS · basic — 20 RPS · pro — 100 RPS · business — 250 RPS

eth_getBlockByHash looks up a single block by its hash and returns the full 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 across reorgs: 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 cheaper to transfer when you only need the IDs.

If no block with the given hash is known to the node, the call succeeds and returns null rather than an error — always check for null before reading fields off the result.

Parameters

Positional params array: [blockHash, fullTransactions].

blockHashstring (32-byte hex)required
Hash of the block to fetch, 0x-prefixed (66 characters total).
fullTransactionsbooleanrequired
true returns full transaction objects in transactions; false returns only transaction hashes.

Response

With fullTransactions = false, transactions is an array of hashes:

When fullTransactions = true, each entry in transactions is a full transaction object instead of a hash:

"transactions": [
  {
    "hash": "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
    "blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "blockNumber": "0xf4629",
    "transactionIndex": "0x0",
    "from": "0xa1e4380a3b1f749673e270229993ee55f35663b4",
    "to": "0x5df9b87991262f6ba471f09758cde1c0fc1de734",
    "value": "0x7f110",
    "gas": "0x4cb26",
    "gasPrice": "0x2d79883d2000",
    "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)
Proof-of-work nonce (pre-Merge blocks).
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)
Address credited with the block reward / fees.
difficultystring (hex)
Block difficulty (pre-Merge).
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 blocks).
timestampstring (hex)
Unix timestamp of when the block was collated.
transactionsarray
Transaction hashes (when fullTransactions = false) or full transaction objects (when true).
unclesarray
Hashes of uncle blocks.

Errors

CodeMeaningWhen it happens
-32001trial_expiredThe API key's trial period has ended; upgrade to a paid tier to continue.
-32003rate_limitedPer-tier RPS limit exceeded (10 / 20 / 100 / 250 RPS for free / basic / pro / business). Back off and retry after retry_after_sec.
-32602Invalid paramsblockHash is not a 32-byte hex string, or fullTransactions is missing or not a boolean.

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/v1/ethereum", {
  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: [
      "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
      false,
    ],
  }),
});


const { result: block } = await res.json();
if (block === null) {
  console.log("no such block");
} 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.ethereum.getBlockByHash(
  "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
  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.ethereum.get_block_by_hash(
    "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    full_transactions=False,
)


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

Notes

  • null means not found. Unknown hashes return result: null, not an error. Guard for it before reading any field.
  • Hashes are reorg-stable. A block hash identifies exactly one block, so lookups by hash are unaffected by chain reorganizations — unlike lookups by block number.
  • Pick the cheaper transaction form. Use fullTransactions = false when you only need transaction IDs; it avoids transferring every transaction body. Pass true only when you need the inlined transaction objects.
  • Related methods: eth_getBlockByNumber, eth_getBlockTransactionCountByHash, eth_blockNumber.