A balance, price, and transaction count read at different blocks may not describe the same state. Pin related calls to one block so your application compares like with like. Choose finality based on whether the result can tolerate a later chain reorganization.
Block references
| Reference | Use it when |
|---|---|
latest | You want the freshest available view and can tolerate best-effort consistency across requests. |
safe | You want a safer recent block for user-visible reads. |
finalized | You want finalized data and can tolerate additional latency. |
| Block number | You need repeatable reads across multiple requests. |
| Block hash | You need to anchor work to one exact block. |
Repeatable read pattern
When multiple calls must observe the same state:
- Select a block with
eth_blockNumber, or witheth_getBlockByNumberand a tag such assafeorfinalized. - Store the block number or block hash.
- Pass that same reference to follow-up
eth_call,eth_getLogs,eth_getBalance,eth_getStorageAt, oreth_getCoderequests.
For example, these two reads can describe different blocks, because each latest resolves when
its request arrives:
[
{ "method": "eth_getBalance", "params": ["0x...", "latest"] },
{ "method": "eth_call", "params": [{ "to": "0x...", "data": "0x..." }, "latest"] }
]These two reads describe the same block, 18000000:
[
{ "method": "eth_getBalance", "params": ["0x...", "0x112a880"] },
{ "method": "eth_call", "params": [{ "to": "0x...", "data": "0x..." }, "0x112a880"] }
]Sending the reads in one batch does not pin them; only the explicit block reference does. Read contract state shows the pattern in client code.
Choose finality
A pinned block can still be reorganized if it is newer than finalized. Pick the reference by
what a reorganization would cost you:
- Use
latestfor displays that refresh and can show a brief inconsistency. - Use
safefor user-visible reads that should rarely change. - Use
finalizedfor settlement, accounting, or any irreversible step.
When you store data from recent blocks, keep enough block identity to undo it. Retries and reorgs shows how.