Crypto
ERC-20
Definition
ERC-20 is the standard set of rules that makes Ethereum-based tokens work consistently across wallets, exchanges, and smart contracts.
What is ERC-20?
ERC-20 is a token standard on Ethereum—a shared “interface” that defines the basic functions and events a fungible token contract should expose so other apps can interact with it reliably. In practical terms, ERC-20 is why a new Ethereum token can usually be sent, received, displayed in wallets, and integrated into DeFi without every platform writing custom code for that specific token.
How Does ERC-20 Work?
ERC-20 works by specifying a common set of smart contract methods and logs (events) that external software can call or listen to. The token itself is a smart contract that maintains an internal ledger mapping addresses to balances. When you “hold” an ERC-20 token, you’re not holding coins in a separate database—your balance is a number recorded inside the token contract, associated with your Ethereum address.
At a high level, an ERC-20 token contract typically supports:
- Supply and balances: `totalSupply()` reports how many tokens exist, and `balanceOf(address)` returns how many tokens a given address owns.
- Direct transfers: `transfer(to, amount)` moves tokens from the caller’s address to another address.
- Delegated transfers (allowances): `approve(spender, amount)` sets an allowance so another address (often a dApp) can spend up to a limit, and `transferFrom(from, to, amount)` lets that approved spender move tokens on the owner’s behalf.
- Events for tracking: `Transfer` and `Approval` events are emitted so wallets, explorers, and dApps can detect activity without constantly polling state.
A step-by-step example makes the “allowance” model clearer:
1. You want to swap Token A for Token B on a decentralized exchange (DEX). 2. The DEX’s smart contract needs permission to move your Token A. 3. You call `approve(DEX_contract, 100)` on Token A, granting the DEX contract an allowance of 100 tokens. 4. When you execute the swap, the DEX contract calls `transferFrom(your_address, pool_address, amount)` to pull the approved Token A and complete the trade.
A simple analogy: ERC-20 is like a universal plug shape for token contracts. If every appliance (token) uses the same plug standard, any outlet (wallet, exchange, dApp) can support it without rewiring for each new device.
ERC-20 in Practice
ERC-20 is widely used across Ethereum’s application layer because it enables composability—protocols can “stack” together. Stablecoins such as USDC and DAI are commonly used as ERC-20 tokens in DeFi, allowing them to be deposited into lending markets, used as collateral, or traded on automated market makers.
Governance tokens are another common ERC-20 use case. Many protocols issue ERC-20 tokens that let holders vote on parameters like fee levels, collateral types, or treasury spending. Because the token follows a standard interface, governance systems, voting dashboards, and custody solutions can integrate more quickly.
ERC-20 also underpins tokenized representations of assets and positions. For example, some protocols issue ERC-20 “receipt tokens” that represent a claim on deposited funds or a share of a pool. These receipt tokens can sometimes be used elsewhere in DeFi, extending the idea of “money legos” where one protocol’s output becomes another protocol’s input.
Why ERC-20 Matters
ERC-20 matters because it dramatically reduces integration friction. Without a shared token interface, every wallet, exchange, and dApp would need bespoke support for each new token—slowing innovation and increasing the risk of implementation mistakes. Standardization makes the ecosystem more interoperable: tools like block explorers, portfolio trackers, custody systems, and DeFi protocols can support thousands of tokens with a consistent set of calls and events.
It also improves liquidity and distribution. When a token is ERC-20 compliant, it is easier to list on exchanges, add to wallets, and plug into DeFi markets—helping it reach users and enabling broader utility. While ERC-20 doesn’t guarantee a token is safe or well-designed, it provides a predictable baseline that the rest of Ethereum’s infrastructure can build around.
Frequently Asked Questions
What does ERC-20 stand for?
ERC stands for “Ethereum Request for Comment,” and “20” is the identifier number of the proposal. It refers to a standard interface for fungible tokens on Ethereum.
How does an ERC-20 token transfer work?
A transfer updates balances inside the token’s smart contract, moving an amount from one address to another. The contract typically emits a Transfer event so wallets and apps can track the movement.
What is the difference between transfer and transferFrom in ERC-20?
`transfer` sends tokens directly from the caller to a recipient. `transferFrom` allows an approved third party (like a dApp) to move tokens from an owner’s address using an allowance set via `approve`.
Are ERC-20 tokens the same as ETH?
No. ETH is Ethereum’s native asset used for gas fees and value transfer at the protocol level, while ERC-20 tokens are smart contracts that track balances and transfers on top of Ethereum.
Is every Ethereum token ERC-20?
No. Fungible tokens often use ERC-20, but NFTs typically use ERC-721 or ERC-1155, and some tokens use newer or specialized standards. A token can also be non-standard, which may limit wallet and dApp compatibility.