In this track: Tokens and digital ownership
intermediate · 3 MIN READ

How ERC-20 balances are recorded

A token contract defines how an account’s quantity is represented.

LET’S PICTURE IT

A ticket office keeps its own register. A person’s ticket count is not the same field as their ordinary cash balance.

SEE IT FOR YOURSELF
A valid counter call, step by stepStep 1 / 4
A valid counter call, step by stepFunction requestincrement()No argumentsBefore executionstored count0A local teaching example with a defined starting stateIncoming callCheck function dispatchCheck coded conditionsRules passConditions passContinue executionA failed check can revert insteadCalculation0 + 1Result: 1Storage writecount = 1Persists if call succeedsCalculating a local value and storing it are separate stepsPersistent statecount1Later readGetter reports 1No new incrementState, logs and browser display have different roles

This example begins with count zero and a request to call increment(). No real contract is deployed.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Find the right register

The token contract and network identify which accounting system you are reading. balanceOf(address) is the standard ERC-20 interface for asking about an account’s raw quantity.

Do not assume the internal layout

Many implementations use a mapping, but the interface does not require every contract to store balances in exactly that way. Some compute values from shares or other state. Read the implementation when storage behavior matters.

Display is a separate conversion

A returned integer needs the token’s decimal convention to become a human amount. Metadata can be optional or unusual. A symbol and balance alone do not establish market value.

Practice the request shape

Choose balanceOf in the ABI encoder and supply a public address. The lab shows calldata, not the address’s live balance. A real answer would need a call against a specific contract and state.

TURN UNDERSTANDING INTO PRACTICEOpen the ABI encoder →
QUICK CHECK · NO PRESSURE

Does balanceOf require every implementation to use the same storage mapping?

Your progress stays in this browser.
Keep exploring the original referenceEthereum Improvement Proposals ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.