Ethereum

Ethereum

eth_getBlockByHash

eth_getBlockByHash returns the full block that matches a 32-byte hash on Ethereum mainnet. A block hash uniquely pins one block, so unlike a height it survives reorgs cleanly — the hash either exists in your view of the chain or it doesn't. The response carries the header (parent hash, timestamp, miner/proposer, state and receipts roots), the EIP-1559 baseFeePerGas, gas metrics, the post-Merge withdrawals list, and either full transaction objects or just their hashes depending on the second argument. Send it to https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1, native coin ETH). An unknown hash yields null.

Use cases

  • Resolve a hash you already hold. A transaction receipt or a log entry hands you a blockHash; this turns it into the full block context.
  • Reorg detection. Store the hash you saw for a height, then later ask the node for that same height — if the canonical hash differs, that slot reorged and you reindex from there.
  • Pull header detail for one block. Read the validator withdrawals, gas used vs limit, base fee, and the various roots for a specific canonical block without scanning a range.

Parameters

#NameTypeRequiredDescription
1blockHashstring (hex)YesThe hash of the block to retrieve.
2includeTransactionsbooleanYesWhen true, transactions[] contains full transaction objects. When false, only hashes.

Response

TypeDescription
object | nullBlock object with fields: number, hash, parentHash, timestamp, miner, gasUsed, gasLimit, baseFeePerGas, transactions, uncles, withdrawals, stateRoot, receiptsRoot, transactionsRoot, logsBloom, extraData, size, difficulty, totalDifficulty, mixHash, nonce, sha3Uncles. Returns null if no block was foun

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
false
],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32602Invalid paramsBlock hash is malformed or not 32 bytes.

Common pitfalls

  • The second argument is a real boolean. Passing the string "true" makes some nodes reject the request or treat it as false — send JSON true/false, not quoted text.
  • With the flag set to true, a full mainnet block packed with Uniswap and transfer activity can push the response past 1 MB. Stream or fetch hashes only and pull transactions on demand if bandwidth matters.
  • An unknown or non-canonical hash returns null, not an error. Null-check before reading .number or .transactions, or you'll throw on a missing block.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

Parameters

0x-prefixed 32-byte block hash

true = full tx objects, false = tx hashes only

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByHash","params":["",""]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.