Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines EIP-1898, which extends JSON-RPC to allow blockchain state queries using a block hash.
This article translates, summarizes, and supplements the material linked below.
I have also covered other EIPs.
Overview
EIP-1898 extends the default block parameter in Ethereum's JSON-RPC interface. Previously, callers specified a block using a tag such as latest or finalized, or a block number. EIP-1898 allows the block itself to be identified directly by its hash.
This enables clients to identify a particular block regardless of its position in the chain. Even when a chain reorganization (reorg) occurs, clients can request information associated with a particular state, provided the node retains it.
This generalizes the block-hash-based approach of EIP-234, which adds block hash filtering to log queries, to additional JSON-RPC methods. Explicit block hashes help clients consistently track the state they are interested in, including when the block is no longer canonical.
See the following article for EIP-234.
[EIP-234] Adding Block Hashes to Ethereum Log Filter Options
EIP-1898 also improves efficiency and flexibility because clients need not maintain a persistent connection to a node, and nodes need not maintain per-client state for this purpose. Developers can make consistent block-state queries while reducing the effects of reorganizations, contributing to a more stable user experience.
Specification
Applicable JSON-RPC Methods
EIP-1898 enables several JSON-RPC methods exposed by Ethereum clients to select a block by hash, in addition to block numbers and tags such as "latest" and "finalized".
The affected methods are:
eth_getBalanceeth_getStorageAteth_getTransactionCounteth_getCodeeth_calleth_getProof
Previously, these methods accepted a defaultBlock parameter in one of the following forms.
- A hexadecimal block number, such as "0x10d4f".
- "earliest" — the genesis block.
- "latest" — the latest canonical block.
- "pending" — the pending state.
- "safe" — the block considered safe.
- "finalized" — the finalized block.
String and numeric representations do not provide an unambiguous way to specify a block hash, and a block number alone cannot reliably identify a particular block across reorganizations. The proposal therefore introduces an object-based parameter.
New Parameter Format
The specification allows the following object format in place of the conventional defaultBlock parameter.
{
"blockNumber": "0x10d4f"
}Alternatively, callers can specify a block explicitly by its hash.
{
"blockHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"
}When using blockHash, callers may also supply an optional Boolean field, requireCanonical. This specifies whether the block must belong to the canonical chain.
{
"blockHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
"requireCanonical": true
}If the specified block is not canonical, this request produces an error. With requireCanonical: false, a known noncanonical block may also be accepted, subject to the availability of its state.
Error Handling
If the block cannot be found, the recommended JSON-RPC error is -32001: Resource not found.
If requireCanonical: true is specified and a known block is not canonical, the recommended error is -32000: Invalid input.
This distinction enables clients to differentiate a missing block from a known block that is not canonical.
The missing-block check takes precedence over the canonical-chain check.
Maintaining Compatibility
The new syntax coexists with the existing block selection formats. For example, the following three representations refer to the same genesis block.
"earliest"
"0x0"
{ "blockNumber": "0x0" }The following block-hash-based representation is also valid.
{ "blockHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" }
{ "blockHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", "requireCanonical": true }
{ "blockHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", "requireCanonical": false }The specification enables more flexible and precise block references without breaking existing syntax, facilitating adoption by JSON-RPC clients.
Additional Notes
Why Is This Change Necessary?
Ethereum JSON-RPC provides several methods for querying blockchain state. For example, eth_getBalance retrieves an account balance, and eth_call executes a smart contract call for inspection.
Previously, these methods could not unambiguously identify the precise block whose state should be queried. Callers could select a block number or a tag such as "latest" or "finalized", but could not identify an individual block by hash.
This creates difficulties when an application needs multiple consistent state queries.
For example, a wallet displaying the sender's and recipient's balances after a transfer might request the sender's balance first and then the recipient's balance. If a reorganization occurs between the requests, the two results could refer to different blocks and become inconsistent.
A more complex example is a decentralized exchange interface. If order information is stored on-chain, the interface may retrieve individual orders through separate eth_call requests. If chain state changes between calls, some orders may be retrieved from an older block while others are retrieved from a newer one.
Developers can attempt to work around this by choosing a fixed block number, checking its hash after each request, and restarting if the hash changes. However, the additional network overhead grows as O(n), and retries introduce further costs.
Such checks may also miss a temporary reorganization if a displaced block returns to the canonical chain between observations.
Another approach relies on log information that can be filtered by block hash, but this requires contracts to emit appropriate events. Without those events, the desired state cannot necessarily be reconstructed.
Some clients also provide proprietary extensions such as parity_subscribe, requiring persistent WebSocket or IPC connections and complicating system design.
EIP-1898 addresses the underlying problem by allowing callers to explicitly specify a block hash.
Methods such as eth_call and eth_getBalance can receive the same block hash, allowing all state queries to target the same block precisely.
This helps developers build applications with consistent state views despite reorganizations, provided the requested block and state remain available.
Citation
Charles Cooper (@charles-cooper), "EIP-1898: Add blockHash to defaultBlock methods," Ethereum Improvement Proposals, no. 1898, April 2019. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1898.
Conclusion
EIP-1898 extends Ethereum JSON-RPC to support querying blockchain state by block hash.
If you have questions, feel free to contact me on Twitter.
I also publish articles on the following platforms.



