01

"Received" versus the real balance

Token histories in wallets and block explorers are mostly assembled from event logs that smart contracts emit. So a history may show 100 tokens received while the actual balance rose by 98, or not at all. Logs are records a contract leaves, not the contract's current state itself.

This post walks through how event logs differ from contract state, compares in a hypothetical table the common cases where they diverge, and sets out how to query logs and verify them against state rather than trusting logs alone.

02

Events and logs

Ethereum.org's page on the anatomy of smart contracts explains that events let a contract communicate with frontends and other subscribing applications. When a contract emits an event, its contents are recorded as a log in the transaction receipt, and apps read those logs to update their screens. Logs are cheaper to store than contract storage, but other smart contracts cannot read them directly.

The ERC-20 standard requires tokens to emit a Transfer event when tokens move. It carries the sender, recipient, and amount, with sender and recipient placed in indexed fields called topics for easy searching. The eth_getLogs method in Ethereum.org's JSON-RPC documentation queries logs for a given contract and topics over a block range.

03

When logs and state diverge

The table compares, in a hypothetical example, how actual contract state, the balance returned by balanceOf, can differ when a log showing 100 tokens received appears.

Event logs versus actual balances (hypothetical)
CaseLog seenActual balance changeWhy
Ordinary tokenTransfer 100+100Log and state agree
Fee-on-transfer tokenTransfer 100 (2 of it to a fee address)+98Part of the transfer goes to a fee
Rebasing tokenNo logBalance changes on its ownSupply adjustments emit no Transfer event
Event from a fake contractTransfer 100 (emitted by a fake contract)No change in the real tokenAnother contract emits a look-alike event

A log is a contract's record that something happened. The actual balance is known accurately only by querying the token contract's state directly.

04

Spotting fake events

Each log records the address of the contract that emitted it. Anyone can deploy a contract that emits Transfer events shaped exactly like a real token's, so check that the emitting address is the genuine token contract. Some phishing schemes use this to make it look as though fake tokens left a user's address.

Block explorers usually show the emitting contract, but a matching name and symbol make it easy to be fooled. For large amounts or unfamiliar transactions, make a habit of comparing the contract address with official sources.

05

Reorgs and logs

Logs in recent blocks can disappear if a block is reorganized. Results from eth_getLogs and log subscriptions include a field marking logs removed by a reorg, and services that process logs must check it. Otherwise they may act on a deposit that was in fact undone.

For important processing such as crediting deposits, it is safer to recheck logs and state after the block is finalized rather than acting the moment a log arrives.

Indexers that power wallet histories handle this in different ways and at different speeds. If a deposit appears in one app but not another, the gap often reflects indexing delay or reorg handling rather than a real difference on chain.

06

Steps to verify logs

When checking a token deposit or an event, follow these steps.

  1. Confirm the emitting contract address matches the official token contract.
  2. Query the token contract's balanceOf to see the actual balance change and compare it with the logged amount.
  3. Check the official documentation for whether the token charges transfer fees or rebases.
  4. See whether the block containing the log is finalized and whether the log was removed by a reorg.
  5. Know which indexer or data service your app uses for its history, and check important values directly against a node.
07

Why logs are still useful

That logs and state can diverge does not make logs useless. They make it cheap and fast to find what happened and when, underpinning transaction histories, analytics tools, and notification services. Contract state tells you only the current value; logs show how it got there.

Logs tell you what happened; state tells you how things stand now. Reading both, and finding the reason when they disagree, is how to read blockchain data accurately.

Nick's note: wallet history was my source of truth

When I traded crypto without rules, the transaction history in my wallet was the final word. If it said I had received a token, I had it. I did not know that most of those entries are assembled from event logs that any contract can emit, including contracts written to imitate real tokens.

The gap in this article between a log showing 100 tokens received and a balance that rose by 98, or not at all, explained a lot of confusion I had over the years. Logs are a contract's own announcement; the balance is the state the network actually holds.

Now when a token appears in my history unexpectedly, I check the contract address against the project's official one and read the balance directly before I interact with it. A surprise token is a reason to slow down, not to click.

09

Open questions

The tokens and amounts here are hypothetical and illustrate the principle. Real token contracts may implement the standard differently or emit additional events, and indexers interpret logs in different ways.

When checking, use Ethereum.org, the ERC-20 standard, each token's official documentation, and current block explorer data with their dates. Any decision remains yours, based on your own circumstances and risk tolerance.