---
eip: 1898
label: EIP-1898
title: Add `blockHash` to defaultBlock methods
status: Final
type: Standards Track
category: Interface
created: 2019-04-01
requires: 234
official: https://eips.ethereum.org/EIPS/eip-1898
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1898.md
canonical: https://eips.huatuo.xyz/eip-1898/
lang: en
tldr: Lets state-reading JSON-RPC calls such as eth_call and eth_getBalance target a block by its hash, so a series of queries is guaranteed to read the same state even across reorgs.
tags: [json-rpc, reorg, eth_call, node, interface]
---

# EIP-1898: Add `blockHash` to defaultBlock methods

> Add `blockHash` option to JSON-RPC methods that currently support defaultBlock parameter.

**TL;DR:** Lets state-reading JSON-RPC calls such as eth_call and eth_getBalance target a block by its hash, so a series of queries is guaranteed to read the same state even across reorgs.

## What problem does it solve?

Many RPC methods take a "default block" parameter: a block number or a tag like `"latest"`. Neither pins down a single block. If a chain reorganisation happens between two calls, block number 100 may refer to a different block the second time, and `"latest"` moves anyway.

That breaks apps that need a consistent view across several calls: a wallet showing sender and recipient balances after a transfer, a DEX UI walking an on-chain order list with many `eth_call`s, or logic that depends on two pieces of state at once. Workarounds (re-checking block hashes after each call, relying on logs, vendor-specific subscriptions) are clumsy or incomplete.

EIP-1898 generalises what [EIP-234](/eip-234/) did for log filters: let callers name the exact block by hash.

## How it works

For these methods:

`eth_getBalance`, `eth_getStorageAt`, `eth_getTransactionCount`, `eth_getCode`, `eth_call`, `eth_getProof`

the block parameter may now also be an **object**:

- `{ "blockNumber": "0x..." }`, or
- `{ "blockHash": "0x...", "requireCanonical": false }`

Rules:

- If the block is not found, the node should return an error (recommended code `-32001`, Resource not found).
- `requireCanonical` defaults to `false`, so a block that has been reorged out can still be queried if the node has it. If `true`, the node should also error when the block is not on the canonical chain (recommended `-32000`), with "not found" taking precedence.
- The old forms (hex number, `"latest"`, `"earliest"`, `"pending"`, `"safe"`, `"finalized"`) keep working.

## Sample code

Raw JSON-RPC request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getBalance",
  "params": [
    "0x0000000000000000000000000000000000000000",
    { "blockHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", "requireCanonical": true }
  ]
}
```

(The hash above is mainnet's genesis block, the example the spec uses.)

Pinning several reads to one block with ethers v6:

```ts
import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const head = await provider.getBlock("latest");
const at = { blockHash: head!.hash, requireCanonical: false };

const [balA, balB] = await Promise.all([
  provider.send("eth_getBalance", [alice, at]),
  provider.send("eth_getBalance", [bob, at]),
]);
console.log(BigInt(balA), BigInt(balB)); // both read from exactly the same state
```

## Things to know

- Status is **Final**. Support can still vary between node providers, so test against yours.
- Querying an old or non-canonical block only works if the node still has that state; non-archive nodes prune old state, so very old block hashes may return errors.
- The method list in the spec does not cover every RPC call; check client docs for others.
- The full method catalogue lives in the execution-apis spec; [EIP-1474](/eip-1474/) is the older RPC spec this extends.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1898
