How an ERC-20 token works
An ERC-20 token is a smart contract that keeps a table of balances by address. The token does not sit in a wallet: the wallet holds the key to an address, and the contract records what that address owns.
The standard was proposed on 19 November 2015 and is now final. A token's name, symbol and number of decimals are optional in it, and six functions and two events are required:
- totalSupply and balanceOf: read the supply and an address's balance
- transfer: send tokens from the caller's address
- approve and allowance: let another address spend up to a set amount
- transferFrom: spend tokens under that approval
- Transfer and Approval events: logs that wallets and exchanges watch
What ERC-20 means for a product that handles tokens
One integration covers every ERC-20 token: adding an asset is a matter of its contract address and its decimals. Decimals differ between tokens, and an amount read with the wrong figure is wrong by orders of magnitude.
Moving a token costs gas, paid in ETH and not in the token, so an address holding only stablecoins cannot send them on until it is funded with ETH. Deposits are detected by watching Transfer events, and the standard tells callers to handle a transfer that returns false.
The same token name can exist as separate contracts on several networks. A USDT balance on Ethereum and one on Tron are different assets to a ledger, with different addresses and fees.
ERC-20, TRC-20 or ERC-721?
- TRC-20
- Tron's token standard, with an interface modelled on ERC-20 and widely used for USDT. Addresses and fees are Tron's, not Ethereum's.
- ERC-721
- The standard for non-fungible tokens, where each token is unique. ERC-20 tokens are interchangeable, like units of a currency.
- ETH
- The network's own coin is not an ERC-20 token. ETH moves by a plain transaction, not by a call to a token contract.
Where ERC-20 shows up in a platform
Modules that do the work
- Custody & walletsWallets on every major chain, with MPC custody from leading providers or your own keys.
- LedgerThe double-entry book of record behind every balance, fee and transfer.
Platforms that need it
Guides that go deeper
Where it is written
The laws and standards this page's facts come from.
General information, not legal advice: what applies to you depends on your services and your market.