What was this balance two years ago?
Block explorers make it easy to see an address's past transactions. Ask an ordinary node directly what an address's token balance was at a specific block two years ago, however, and it often cannot answer. Past transaction history and past state are different data.
This guide explains how Ethereum full nodes and archive nodes differ in what they keep, shows with a hypothetical case what happens when you query past state, and sets out which kind of node or data service each task needs.
History versus state
Ethereum has two kinds of data. One is blocks and the transactions in them, the history accumulated since the chain began. The other is state: every account balance and contract storage value at a given moment. State changes with every block processed.
As Ethereum.org's page on nodes and clients explains, full nodes verify blocks and transactions and keep the current state, but many prune older state to save storage. Past transactions remain, but the state at a particular past block can no longer be read directly.
Node types compared
According to Ethereum.org's page on archive nodes, an archive node keeps the state at every block so past state can be queried directly. The table compares what each type of node stores and what it can answer.
| Node type | Blocks and transactions | State kept | Balance at a block two years ago | Storage |
|---|---|---|---|---|
| Full node (pruned state) | All | Recent blocks only | Usually not possible | Moderate |
| Archive node | All | Every block | Possible | Very large |
| Light client | Mostly headers | None | Not possible (asks other nodes) | Small |
Storage requirements vary greatly by client implementation; clients with more efficient storage keep the same archive data in far less space.
A hypothetical query
Suppose a researcher wants a token contract's total supply and the balances of its largest holders at a specific block two years ago. As Ethereum.org's JSON-RPC documentation shows, requests such as eth_getBalance and eth_call accept a block number. Sent to a full node, such a request often returns an error saying the data is missing, because that state was pruned.
Sent to an archive node, the same request executes the contract against that block's state and returns the exact value. If only current balances are needed, a full node suffices. Tasks needing past state are more varied than one might expect: valuations on a given date for tax purposes, historical analysis of DeFi protocols, and incident investigations.
Recomputing state from history
Without an archive node, state at a desired moment can be computed by replaying past transactions from the beginning. Some clients in fact avoid storing old state and recompute it on demand. The older the point in time, though, the more transactions must be replayed and the longer it takes.
Information that can be tracked through event logs, such as token balance changes, can also be computed by aggregating logs. State changes that emit no events and internal contract storage cannot be known from logs alone, so state data is still needed.
Many analytics services build their own indexed databases from archive data for exactly this reason. Querying them is fast, but the results are only as reliable as the indexing, so spot-checking a few values against a node is worthwhile.
Checking which data you need
If you are planning work that uses historical blockchain data, check these items.
- Decide whether you need past transaction history or the state at a specific past moment.
- Check whether your RPC provider or node supports queries at past blocks, that is, archive data.
- If running your own, compare archive storage requirements and sync times across clients.
- Judge whether the information can be computed from event logs alone or needs contract storage.
- Cross-check results against another data source for query errors or gaps.
The future of historical data
Ethereum's data keeps growing, making it ever harder for every node to keep all history forever. Proposals are under discussion that would let ordinary nodes stop storing older block history after a period. Historical data would then rest mainly with archive nodes and specialized data services.
That lowers the cost of participating, but it also means fewer parties to rely on for independently checking past data. For important historical data, the habit of checking several sources becomes more important.
Limits of the analysis
The node comparison and query case describe typical situations. Storage methods and supported queries vary by client, configuration, and upgrade, and policies on historical data may change.
When checking, use Ethereum.org and each client's current documentation with their revision dates in mind. This guide does not recommend buying or selling anything.