Skip to main content
Guides
Category
Operations
Reading time
6 minutes
Published

Why does eth_call fail at a historical block?

Your indexer needs a token balance at the end of an old block. The contract read works at the chain head. The old block is visible, but a historical eth_call returns 0x or an error. The endpoint may lack the old state, the contract may have had different code, or the call may have reached the contract and reverted. Run the checks below in order and keep the block fixed so each result tells you something about the same state.

Section 01

What does eth_call read at block N?

A historical call uses the selected block's post-state, after the transactions in that block have executed. This makes it suitable for an end-of-block snapshot, such as a token balance or a protocol parameter. It cannot recover the state immediately before a specific transaction in the middle of a block. If you need to know what an already-mined transaction encountered, follow the transaction diagnosis guide.

Capture the chain ID and retrieve the target block's number and hash with eth_getBlockByNumber. Use the same reference for the call and its diagnostic reads. Where supported, use the EIP-1898 block object with blockHash and requireCanonical set to true. If the endpoint only accepts a block number, use a settled block when the application can wait. For a recent block, check the height's hash before and after the reads and discard the results if it changed. That check can detect a hash change across the reads, while a hash-bound request identifies the block directly.

Section 02

Is the old state available?

An old block response establishes that the block data is readable. Executing a contract call also takes historical account state, including the code and storage the call touches. Ethereum's history and state overview explains why those are separate kinds of data.

Start with eth_getCode for the target address at the same block. As a control, run a known-good state read for an account or contract established at that height. If the old block is recognized but both state reads report unavailable state while recent equivalents work, check historical state coverage for the chain and height. Errors such as “missing trie node” can point to a state-access problem. Record the raw error before assigning a cause, since wording can vary.

A successful code read proves that the code is available for that address and block. The actual call may still need storage or other contracts. Run the exact historical call at the oldest block your application requires. The archive RPC guide gives a broader method-by-method qualification process.

Section 03

What does the raw response tell you?

Inspect the JSON-RPC envelope before relying on an SDK's error label. It may report a decode failure after receiving a valid response with empty bytes.

  • Empty result. A 0x result means the call returned zero bytes. Check the target's code at the same block. Empty code is consistent with an ordinary contract address that had yet to be deployed. If code exists, verify the function selector, the caller, and the historical implementation. A contract can also legitimately return zero bytes for a function with no return values. An ABI-encoded integer zero occupies 32 bytes.
  • The result contains bytes that fail to decode. Keep the raw value and check the expected return types against the ABI used at that block. A familiar selector or successful decode alone cannot establish the intended semantics.
  • The error reports execution reverted. Save the raw error and any revert bytes, then decode them with the applicable ABI. Compare the original from, to, calldata, value, and gas if supplied. An error can come from a nested call, so decoded bytes alone do not identify the failing contract.
  • The error reports a missing block or rejects the block argument. Check the chain ID, block hash, canonical status, and supported parameter format. A timeout alone leaves the cause unresolved.

The eth_call reference describes the result and revert shapes. The Solidity ABI specification covers selectors, typed output, and encoded errors.

Section 04

Which implementation did the proxy use at that block?

A proxy can keep the same address and bytecode across an upgrade. Its historical storage determines which implementation an old call uses. For a proxy that follows ERC-1967, read the implementation slot with eth_getStorageAt at the target block. If the proxy uses a beacon, read the beacon slot and call the beacon's implementation() at that same block. For other proxy designs, check the project's deployment records or storage layout.

Use that implementation's ABI to encode and decode the call, and send the request to the proxy address so the execution uses the proxy's storage. If the failure starts around an upgrade, use known test blocks just before and after it. A selector added in the upgrade may be absent at the earlier height even though code is present at the proxy address in both snapshots.

Section 05

What should you save as a regression test?

Keep one known historical success and one expected absence or revert. For example, take an ERC-20 balanceOf read at a block before the token was deployed and a second read at a block with a known balance. Save the chain ID, block number and hash, address, exact calldata, caller when relevant, ABI version, and expected raw response or decoded value. Include a fixture on each side of a relevant proxy upgrade. ERC-20 defines the balance method and its return type.

In a backfill, record unavailable state or an unexpected result as an unresolved block. Keep that block open for repair or replay. Write a zero balance only when you decode an actual zero from the expected response. Re-run the same fixtures after changing endpoints, libraries, or contract versions.

Workload review

Want us to benchmark your current RPC stack?

Send your providers, routing setup, method mix, or monthly bills. We will compare the complete stack with one SolidRPC integration across cost, useful completion rate, failover, and operational work.