WHAT A TOKEN CONTRACT ACTUALLY HOLDS
ERC-20 is not a kind of coin. It is a short interface agreement — six functions and two events — filed as issue number 20 in the Ethereum improvement proposal repository, written by Fabian Vogelsteller (with Vitalik Buterin among the co-authors) on 19 November 2015, and later marked final. What follows takes one token apart, looks at every part on the bench, and puts the machine back together.
You tap Approve. A panel slides up and asks how much you want to authorize, and the option at the bottom is not 100 and not 1,000 — it is unlimited, a one-click promise that this contract may move every unit of this token you will ever own. You confirm, the wallet charges you gas, and a few seconds later nothing visible has happened. Your balance is unchanged. No coin travelled anywhere. What changed is a single number inside a contract somebody else deployed.
That moment is the part people skip, and it decides everything else. A token is not an object in your wallet; it is two tables inside a contract you did not write, plus rules about who may edit them. Your wallet is a renderer: it reads those tables and paints numbers on a screen. Remove the renderer, the tables remain; remove the tables, the renderer has nothing to paint.
If that sounds slippery, it is the same distinction I keep making about what a smart contract actually is: the word on the box names a mechanism, not a thing. A “token” is a mechanism too — a ledger plus an access-control list, on someone else’s machine.
It Is an Interface, Not a Coin
ERC-20 does not describe an asset. It describes a shape. Any contract that exposes six functions and fires two events can be plugged into any wallet, exchange or lending market without that consumer writing one line of code specific to your token. The value of ERC-20 is not “it makes coins”, it is it makes coins interchangeable at the software level.
Here is the whole required surface:
function totalSupply() constant returns (uint256 totalSupply)
function balanceOf(address _owner) constant returns (uint256 balance)
function transfer(address _to, uint256 _value) returns (bool success)
function transferFrom(address _from, address _to, uint256 _value) returns (bool success)
function approve(address _spender, uint256 _value) returns (bool success)
function allowance(address _owner, address _spender) constant returns (uint256 remaining)
event Transfer(address indexed _from, address indexed _to, uint256 _value)
event Approval(address indexed _owner, address indexed _spender, uint256 _value)
That is it. Nine lines of declaration, and an industry was built on them. Assuming those nine lines is what lets a lending protocol accept collateral it has never heard of, and what lets a liquidity pool hold two arbitrary assets and quote a price between them. The property has a name — composability — and it is why “DeFi” is a word at all.
The other half, quoted less often: every famous defect of ERC-20 comes from the same place as every famous success. The standard specifies function signatures. It does not specify how a caller should use them, what a wallet must show before signing, or what a receiving contract should do when tokens arrive. The interface made integration free; it also made misunderstanding free.
Part One: The Two Tables
Start with the simplest part, the one people over-imagine. A token contract holds a mapping:
mapping(address => uint256) balances;
That is the whole “coin”: one unsigned integer per address. When your wallet shows a balance, it called balanceOf(yourAddress) and printed the result, divided by a factor the contract also publishes. There is no coin and no envelope with your name on it. There is a row, and the row says a number.
transfer then does what a careful accountant would do:
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
Subtract from one cell, add to another, log it. Every transfer you have ever made is that. It costs gas because it writes to contract storage, the most expensive thing the EVM does — not because value is teleported.
Notice what totalSupply is not: it is not derived from the table, it is a variable somebody set, if the author bothered to maintain it. A contract that forgets still works as a ledger; it just lies about its own size. And transfer cannot tell whether _to is a person, a contract, a typo or a black hole. It writes to a cell.
The other table is the one you were editing when you tapped Approve, and it has one more dimension:
mapping(address => mapping(address => uint256)) allowed;
Read it as a nested spreadsheet: for each owner, a list of spenders, each with a number. balances answers “how much does X have”; this one answers “how much of X may Y move”. It is not a reservation, not a hold, not escrow. It is a permission slip written into storage, and nothing stops two spenders holding slips that overlap.
This exists for one reason: contracts cannot sign. A contract has no key and no moment of initiative — it only acts when someone calls it. Hence the two-step pattern: you grant permission once, and thereafter the contract moves your tokens whenever its own logic decides to.

Back to that button. When a DEX asks you to “approve USDC”, it is not asking for your tokens; it is asking you to write a number into this nested table, and “unlimited” means writing the largest integer the type can hold. The tokens never leave balances. What you handed over is the authority to move them later, indefinitely.
Part Two: approve and transferFrom
The two halves of the dance are worth naming precisely:
So approve is a declaration by the owner, transferFrom is the spender cashing it in, and transfer — the one you think of as sending money — never touches this table at all. Three functions, two power relationships, one storage layout.
Now the grimy part, my favourite example of a specification’s politeness turning into an ecosystem’s bug: approve overwrites the current allowance. It does not add, it does not ask, it assigns. EIP-20 carries a NOTE telling clients they should set the allowance to 0 first and then to the new value, to dodge this race:
- You have granted a spender 100.
- You change your mind and submit a transaction setting it to 50.
- Before your transaction lands, the spender spends the full 100.
- Your transaction lands, and the allowance is now 50 again. Total spent: 150.
Then the spec says something remarkable: contracts should not enforce the zero-then-set pattern, because deployed contracts would break. A standards document declining to fix its own known race out of respect for installed base — that is the Ethereum upgrade process in miniature. Later implementations added increaseAllowance and decreaseAllowance; they are widely used, and they are not part of the standard.
SPEC SAYS
The EIP-20 text is unusually blunt on one point: Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned! Some early tokens return nothing where a bool should be, and some return false instead of reverting on failure — so a caller that only checks “did the transaction throw” will happily book a failed transfer as a success.
Read that as a confession. The standard knew, at authorship time, that implementations would misbehave, could not stop them, and pushed the burden onto the caller. This is not the standard being broken; it is the standard predicting sloppiness and assigning blame in advance. Every “wrap it in a safe helper library” pattern since is the ecosystem paying that bill.
Part Three: The Two Events, and Three Labels You Cannot Count On
The events are easy to underrate, so: the events are the real ledger. Storage holds the current state; events hold the history, and history is what block explorers and analytics tools consume. Transfer must fire on any movement of tokens, including a transfer of zero — the spec insists a zero-value transfer be treated as a normal one and logged. Contracts that mint should fire a Transfer with _from set to 0x0, which is how creation gets expressed in a system that only knows movements. Approval fires on every successful approve.
Both are indexed, so their arguments land in the log and can be filtered without re-executing anything. That is why an interface spec bothers to mandate logging: the log is the part everyone else uses.
Then the three optional extras, which nearly every token implements anyway because wallets and explorers want them:
name()→stringsymbol()→stringdecimals()→uint8
decimals is the interesting one. It is not a property of the token but a display instruction: 8 means “divide the raw integer by 100000000 before showing it to a human”. Every token counts internally in whole units; decimals exist only at the rendering layer. And the spec is explicit: these are optional, and no contract may assume they exist.

What the Standard Specifies, and What It Does Not
Put the machine back on the bench:
| The standard specifies | The standard does not specify |
|---|---|
| Six function signatures and their return types | What a wallet must show a user before they sign |
| Two events, including zero-value transfers | How a contract learns it received tokens — there is no receiver hook |
approve overwrites the allowance | How to change an allowance safely; contracts must not force 0-then-N |
Callers must handle a false return | That implementations actually return a bool at all |
| Metadata is optional and must not be assumed | Anything about what the token represents, or who may mint it |
Three consequences follow:
- The allowance race — mitigated in practice, never fixed in the standard.
- Tokens sent to the wrong contract are gone — send to an address whose code does not understand ERC-20 and the tokens are permanently stuck. No callback, no rejection, no undo.
- No receiver hook means no notification — a contract cannot react to an incoming transfer, because nothing tells it one happened. That is why “deposit” flows need the two-step at all.
None of these are exotic. They are what a specification that defines a language but not a conversation produces.
Two Million Contracts, a Few Thousand That Matter
Scale is worth stating once, without romance: over two million ERC-20 contracts exist on Ethereum, and only a few thousand have meaningful market activity. Deploying a token is copy-paste; attracting liquidity is not a software problem. USDC, USDT, DAI, LINK, UNI, WBTC and stETH are all instances of this same nine-line interface — identical machinery across assets whose economics have nothing in common.
Later standards went after specific holes instead of replacing the whole thing: ERC-721 for non-fungible items, ERC-1155 for many token types in one contract, ERC-4626 for vault shares. ERC-223 and ERC-777 proposed direct fixes to the transfer and hook problems. None displaced ERC-20, and not because of technical elegance — wallets, exchanges, auditors and indexers were already written against the old shape, and a better interface with no tooling is worse in practice. Standards win by installed base, then by inertia.
Diagnosis
ERC-20 is a small, honest document that got lucky, and it deserves admiration for the right reason: it asked for almost nothing — nine declarations, no opinion on economics, governance, or what a token means. That restraint is why two million contracts could implement it, and why its failure modes are social rather than cryptographic. The machines work; the humans read a button, see “unlimited”, and click.
The recurring mistake in talking about tokens is treating the interface as the asset. It is a promise about which function names exist, and every guarantee you care about — whether the receiver can handle the token, whether supply is maintained, whether failure reverts or quietly returns false — lives outside the standard, in code someone wrote on a deadline. When I look at a token I ignore the ticker and ask who can write to the two tables.
What I Ruled Out
I considered arguing that ERC-20’s defects mean it should have been replaced years ago. I do not believe that: the replacements were better on paper and lost in the wild, and “lost in the wild” is the only scoreboard that counts for infrastructure. I also considered calling the approve race a hole in the standard. It is not — it is a documented race the standard declined to enforce against, and calling a trade-off a bug is lazy.
I have not verified any particular token here, and the sample code is not audited. I am describing an interface, not vouching for contracts that claim to implement it — different claims, and conflating them is how people lose money.
What Would Change My Mind
If major wallets ever refused to display tokens lacking a receiver hook, my “installed base always wins” conclusion would need revisiting: that is compatibility pressure applied deliberately, not accidentally. And if tooling ever made an unlimited approval impossible without an explicit second confirmation, both the race and the stuck-transfer problem would shrink without a single contract changing.
Short of that, I expect ERC-20 to keep absorbing criticism and keep not being replaced. The interfaces that win are the ones boring enough to outlive their authors, and this one qualifies. Understanding it is not optional, though: the next time a panel asks how much you want to authorize, you know you are editing one cell in a stranger’s contract — and that “unlimited” is a very large number to write there.
(The End)


