ERC-20 is an official Ethereum Request for Comments (ERC) that defines a common set of rules for creating and managing fungible tokens on the Ethereum Virtual Machine (EVM). This standard specifies six mandatory functions—including totalSupply, balanceOf, transfer, transferFrom, approve, and allowance—that a smart contract must implement, ensuring all ERC-20 tokens behave in a predictable way. By providing this universal interface, ERC-20 guarantees that any token, from a stablecoin like USDC to a governance token like Uniswap's UNI, can be seamlessly integrated into wallets, decentralized exchanges (DEXs), and other decentralized applications (dApps) without custom code.
ERC-20
What is ERC-20?
The foundational technical standard for fungible tokens on the Ethereum blockchain, enabling interoperability between applications.
The standard's core innovation is interoperability. Before ERC-20, each token project used a unique smart contract interface, forcing every new wallet or exchange to write custom support for each token. ERC-20 solved this by creating a universal blueprint. This allowed for the explosive growth of the Initial Coin Offering (ICO) era and remains the backbone of the DeFi (Decentralized Finance) ecosystem. Key technical behaviors defined by the standard include how tokens are transferred between addresses, how third-party contracts (like a DEX) can be approved to spend tokens on a user's behalf, and how to query an address's token balance.
While revolutionary, the ERC-20 standard has known limitations that led to the creation of subsequent standards. Notably, it lacks native support for safety features like preventing accidental transfers to non-receiving contracts, an issue addressed by ERC-223 and ERC-777. Furthermore, it cannot handle non-fungible tokens (NFTs), which are governed by standards like ERC-721 and ERC-1155. Despite these newer alternatives, ERC-20's simplicity and first-mover advantage have cemented its position as the most widely adopted token standard, serving as the primary model for fungible digital assets across the entire EVM-compatible blockchain landscape, including Polygon, Avalanche, and BNB Chain.
Etymology and Origin
The history and naming of the ERC-20 standard, which became the foundational blueprint for fungible tokens on Ethereum.
The term ERC-20 originates from Ethereum Request for Comments 20, a formal proposal submitted to the Ethereum developer community in late 2015 by Fabian Vogelsteller and Vitalik Buterin. The naming follows a convention common in internet engineering, where RFCs (Request for Comments) are documents that describe methods and behaviors for internet standards. In the Ethereum ecosystem, an ERC (Ethereum Request for Comments) serves the same purpose: it is a design document proposing a new feature or standard for the network, open for discussion and refinement by developers before potential adoption.
The number 20 is simply the sequential identifier assigned to this specific proposal. It was not the first token standard proposed—earlier attempts existed—but it was the one that achieved critical consensus due to its elegant simplicity and practical utility. The proposal outlined a minimal, mandatory interface—a set of six functions and two events—that any smart contract must implement to be recognized as a standard fungible token. This included functions like totalSupply(), balanceOf(), and transfer(), which became the universal language for token interactions.
The adoption of ERC-20 was a watershed moment, solving a critical interoperability problem. Before its widespread acceptance, each new token project created its own unique smart contract interface, meaning wallets and exchanges had to write custom code to support each one. By providing a common blueprint, ERC-20 allowed developers to build universal tools—wallets like MetaMask and decentralized exchanges—that could automatically interact with any compliant token, creating a powerful network effect and laying the groundwork for the 2017 Initial Coin Offering (ICO) boom.
Key Features
The ERC-20 standard defines a common set of rules for fungible tokens on the Ethereum blockchain, enabling seamless interoperability between applications like wallets and decentralized exchanges.
Standardized Interface
ERC-20 specifies a mandatory set of six functions and two optional events that a token contract must implement. This includes:
totalSupply(): Returns the total token supply.balanceOf(address): Returns the token balance of a given account.transfer(address, uint256): Transfers tokens to a specified address.transferFrom(address, address, uint256): Transfers tokens on behalf of an owner (used with allowances).approve(address, uint256): Authorizes a spender to withdraw a set number of tokens.allowance(address, address): Returns the remaining number of tokens a spender is approved to withdraw. This common interface allows wallets and exchanges to interact with any ERC-20 token automatically.
Fungibility & Interoperability
Every unit of an ERC-20 token is identical and interchangeable, making it ideal for currencies, voting rights, or staking tokens. Its primary technical achievement is interoperability. Because all tokens follow the same rules, they can be listed on decentralized exchanges (DEXs) like Uniswap, stored in wallets like MetaMask, and integrated into DeFi protocols (e.g., Aave, Compound) without requiring custom code for each new token. This created a massive network effect, turning Ethereum into a platform for programmable money.
Transfer & Approval Mechanism
ERC-20 uses a two-step process for delegated transfers, which is fundamental to DeFi. The flow is:
- Approval: A token holder calls
approve(spender, amount)to grant a smart contract (like a DEX or lending protocol) permission to move a specificamountof their tokens. - TransferFrom: The approved contract later calls
transferFrom(owner, recipient, amount)to execute the transfer. This mechanism enables non-custodial trading, lending, and other complex financial interactions without users surrendering direct control of their assets to a central party.
Events: Transfer & Approval
The standard defines two key events that contracts must emit to log state changes for external applications to track.
Transfer(address indexed from, address indexed to, uint256 value): Emitted when tokens are moved (viatransferortransferFrom).Approval(address indexed owner, address indexed spender, uint256 value): Emitted when an approval is set (viaapprove). These indexed parameters allow blockchain explorers, wallets, and subgraph services to efficiently filter and query all token transactions and approvals for specific addresses, providing essential transparency.
Common Extensions & Behaviors
While the core standard is minimal, common patterns and extensions have emerged:
- Decimals: The optional
decimalsfunction specifies how divisible the token is (e.g., 18 decimals is the common standard, like ETH). - Name & Symbol: The optional
nameandsymbolfunctions provide human-readable identifiers. - Minting & Burning: The standard does not define minting (creating) or burning (destroying) tokens. These are implemented as additional functions (e.g.,
mintandburn) in many popular tokens like USDC or DAI, allowing for controlled supply changes.
Limitations & Successor Standards
ERC-20's simplicity led to notable limitations, prompting new standards:
- Lack of Native Asset Handling: Sending tokens to a contract address that cannot handle them (like a simple multisig) results in permanent loss, as the
transferfunction does not notify the recipient. This led to ERC-223 and thetransferAndCallpattern. - No Batch Operations: Transferring to multiple addresses requires multiple transactions, increasing cost. ERC-1155 addresses this for both fungible and non-fungible tokens.
- No Metadata Standard: Token data (name, symbol, decimals) is not guaranteed. ERC-20 remains dominant, but these limitations are addressed in newer, more complex standards for specific use cases.
How ERC-20 Works
A technical breakdown of the rules and functions that define the most common token standard on the Ethereum blockchain.
The ERC-20 standard is a technical specification, defined by Ethereum Improvement Proposal 20, that establishes a common set of rules for creating fungible tokens on the Ethereum blockchain. These rules are implemented as a set of six mandatory functions and three optional ones within a smart contract. The mandatory functions enable basic token operations: totalSupply() returns the total token count, balanceOf(address) checks a user's holdings, transfer(address, uint256) moves tokens, transferFrom(address, address, uint256) allows delegated transfers, approve(address, uint256) grants spending allowances, and allowance(address, address) checks remaining allowances. This standardization ensures all ERC-20 tokens can interact seamlessly with wallets, exchanges, and other smart contracts.
A core mechanism of ERC-20 is its allowance system, which enables secure, non-custodial interactions with decentralized applications (dApps). Instead of transferring tokens directly to a dApp's contract—a risky operation—a user first approves the contract to spend a specific amount of their tokens. This creates an on-chain allowance. Later, when the user interacts with the dApp, the contract can execute a transferFrom function, moving the approved tokens from the user's wallet to the required destination. This two-step process is fundamental to decentralized exchanges (like Uniswap) and lending protocols (like Aave), where contracts must manage user funds without taking direct custody.
The standard also defines optional metadata functions for name, symbol, and decimals, which provide human-readable information about the token. While seemingly simple, the widespread adoption of ERC-20 has created a highly interoperable ecosystem. Because every wallet and exchange knows how to interact with the standard interface, new tokens are instantly compatible with existing infrastructure. However, the standard has known limitations, such as the inability to handle native asset transfers or non-fungible tokens, leading to the creation of subsequent standards like ERC-777 for enhanced functionality and ERC-1155 for multi-token contracts.
Code Example
A practical demonstration of an ERC-20 token contract, showcasing the required functions and events defined by the standard.
The following is a minimal, non-production-ready example of an ERC-20 token contract written in Solidity. It implements the six mandatory functions and two events specified by EIP-20. The totalSupply variable tracks the fixed number of tokens in existence, while the balanceOf mapping records individual holdings. The transfer, approve, and transferFrom functions enable the core token transfer logic, and the allowance mapping facilitates delegated spending via the approval mechanism.
This contract uses a simplified constructor that mints the entire initial supply to the deploying address. In a real deployment, minting logic is often more complex and may include access controls, vesting schedules, or a minting cap. The Transfer and Approval events are emitted on state changes, allowing external applications like wallets and block explorers to efficiently track token movements and permission updates without scanning all transactions.
To interact with this token, a user would call transfer(recipient, amount) to send tokens from their own balance. For a decentralized exchange or smart contract to move tokens on a user's behalf, the user must first call approve(spender, amount). The spender can then call transferFrom(sender, recipient, amount), provided the approved allowance is sufficient. This two-step pattern is fundamental to DeFi composability, enabling tokens to be used within other protocols.
Developers extending this base implementation must consider critical security practices. These include using the Checks-Effects-Interactions pattern to prevent reentrancy attacks, implementing proper access control for any mint or burn functions, and ensuring arithmetic operations are safe from overflows and underflows (often handled by using Solidity 0.8.x or libraries like OpenZeppelin's SafeMath). The OpenZeppelin Contracts library provides a widely-audited and feature-rich ERC20.sol implementation that serves as the industry standard foundation.
Ecosystem Usage
The ERC-20 standard defines a common interface for fungible tokens on Ethereum, enabling seamless interoperability across wallets, exchanges, and decentralized applications.
Wallet & Exchange Integration
The standard interface ensures universal compatibility. Any wallet (e.g., MetaMask, Ledger) or centralized exchange (e.g., Coinbase, Binance) that supports ERC-20 can automatically interact with all compliant tokens. This simplifies:
- User deposits and withdrawals
- Balance queries
- Transaction signing
- Portfolio tracking across thousands of assets.
DAO Governance & Utility
Many Decentralized Autonomous Organizations (DAOs) issue ERC-20 tokens for governance. Token holders can:
- Vote on proposals using standards like Snapshot or on-chain voting
- Delegate voting power
- Access gated services within an ecosystem Examples include UNI (Uniswap), MKR (MakerDAO), and AAVE (Aave Protocol).
NFT & Multi-Token Ecosystems
ERC-20 tokens often function as the economic layer for NFT projects and complex dApps. Common patterns include:
- Utility tokens for in-game economies or metaverse platforms
- Reward tokens for staking NFTs or providing liquidity
- Payment tokens for minting NFTs or paying fees
- Fractionalized NFT (F-NFT) shares represented as ERC-20 tokens.
Comparison with Other Token Standards
A technical comparison of the ERC-20 standard against other major fungible and multi-token standards on Ethereum.
| Feature / Attribute | ERC-20 | ERC-777 | ERC-1155 |
|---|---|---|---|
Primary Use Case | Standard fungible tokens | Advanced fungible tokens with hooks | Multi-token (fungible & non-fungible) |
Token Type | Fungible | Fungible | Fungible, Non-Fungible, Semi-Fungible |
Transaction Hooks | |||
Batch Transfers | |||
Approval Mechanism | per-spender allowance | per-spender allowance & operators | single operator per contract |
Backwards Compatibility | N/A (base standard) | ERC-20 compatible | Not directly ERC-20 compatible |
Gas Efficiency for Batch Ops | Low | Low | High |
Standard Interface ID | 0x36372b07 | 0xffffffff | 0xd9b67a26 |
Security Considerations
While the ERC-20 standard provides a blueprint for fungible tokens, its design and implementation introduce several critical security risks that developers and users must understand.
Approval Vulnerabilities
The approve and transferFrom functions enable token delegation but are a major attack vector. Common risks include:
- Incorrect allowance handling: Setting an allowance to a non-zero value before changing it can be exploited via a front-running attack.
- Overly permissive approvals: Granting unlimited (
type(uint256).max) or large allowances to untrusted contracts can lead to total fund loss. - Race conditions: The standard's allowance model is susceptible to front-running, partially addressed by ERC-2612's permit or using
increaseAllowance/decreaseAllowancefunctions.
Integer Overflow/Underflow
Before Solidity 0.8.x, arithmetic operations were unchecked, making ERC-20 logic vulnerable to integer overflows (exceeding uint256 max) and underflows (subtracting more than available). This could artificially inflate token balances or bypass checks. While modern compilers have built-in checks, legacy tokens and custom math libraries still require explicit use of SafeMath or unchecked blocks.
Lack of Event Emission on Transfer
The standard mandates emitting a Transfer event. Failure to emit this event for state-changing transfers breaks off-chain tracking and wallet displays, as indexers and UIs rely on these logs. Malicious contracts can mimic token behavior without emitting events, creating confusion. Always verify event emission matches the logic in transfer and transferFrom.
Return Value Mismatch
The original ERC-20 specification had an ambiguity around return values for transfer and transferFrom. Some tokens return a bool, while others (like USDT) return nothing. Contracts that assume a boolean return will fail when interacting with non-compliant tokens, potentially locking funds. Use safeTransfer wrappers or check the target token's ABI.
Proxy & Upgradeability Risks
Many ERC-20 tokens use proxy patterns (e.g., Transparent or UUPS) for upgradeability. This introduces risks:
- Storage collisions: Improperly aligned storage between logic and proxy contracts can corrupt data.
- Malicious implementation upgrades: If admin keys are compromised, the logic can be changed to steal funds.
- Function clashing: In Transparent Proxies, confusion between admin and user calls can be exploited.
Centralization & Admin Key Risks
Many ERC-20 tokens have centralized control points that contradict their decentralized appearance. Critical functions to monitor include:
- Minting/Burning: An owner or minter role can create or destroy tokens arbitrarily.
- Pausing: A
pausefunction can freeze all transfers, locking user funds. - Blacklisting: Some tokens (e.g., USDC) allow an admin to freeze individual addresses. Users must audit the token's privilege model.
Evolution and Extensions
The ERC-20 standard, while foundational, has well-documented limitations. This section explores the ecosystem of subsequent token standards that have evolved to address these shortcomings, enabling new functionalities like governance, non-fungibility, and advanced financial logic.
The ERC-20 standard's simplicity, while key to its adoption, created clear limitations that spurred the development of new token standards. Its inability to handle non-fungible assets led to ERC-721, which assigns a unique identifier to each token, enabling digital collectibles and provable ownership of distinct items. For semi-fungible use cases, such as event tickets or in-game items with varying attributes, ERC-1155 emerged as a multi-token standard that can efficiently manage both fungible and non-fungible tokens within a single smart contract, reducing gas costs and complexity for applications like gaming platforms.
To address the static nature of ERC-20 tokens, standards like ERC-777 and ERC-1363 introduced advanced transaction handling. ERC-777 added "hooks" that allow tokens to notify a receiving contract of an incoming transfer, enabling more complex interactions without requiring a separate approve transaction. Similarly, ERC-1363 defines a transferAndCall function, allowing a token transfer to trigger a specific function in a recipient contract atomically. This is crucial for seamless integrations in decentralized finance (DeFi), where a single transaction can deposit tokens into a lending protocol or swap them on a decentralized exchange.
For governance and utility, the ERC-20Votes extension became a critical evolution. It provides a standardized way for ERC-20 tokens to track historical voting power, which is essential for secure, snapshot-based delegated voting in Decentralized Autonomous Organizations (DAOs). This prevents manipulation through "vote dumping" by locking historical balances at the time a proposal is created. Furthermore, standards like ERC-4626 for yield-bearing vaults and ERC-6909 for minimal modular interfaces represent the ongoing specialization of token standards to optimize for specific, high-value use cases in the modern blockchain ecosystem.
Common Misconceptions
The ERC-20 standard is foundational to the Ethereum ecosystem, yet its technical nuances are often misunderstood. This section clarifies frequent points of confusion regarding token functionality, security, and interoperability.
No, an ERC-20 token is not the same as Ether (ETH). Ether is the native cryptocurrency of the Ethereum blockchain, used to pay for transaction fees (gas) and as a base currency. An ERC-20 token is a smart contract built on top of the Ethereum network that follows a specific set of rules, enabling it to represent a fungible asset. While both use the same underlying blockchain, ETH is the "fuel," and ERC-20 tokens are the "cargo" being transported and managed by it. You must always hold ETH in your wallet to pay for the gas required to interact with any ERC-20 token contract.
Frequently Asked Questions
Essential questions and answers about the ERC-20 standard, the foundational protocol for creating fungible tokens on the Ethereum blockchain.
An ERC-20 token is a technical standard for creating fungible tokens on the Ethereum blockchain, defining a common set of rules that all Ethereum-based tokens must follow. It works by implementing a smart contract with six mandatory functions (totalSupply, balanceOf, transfer, transferFrom, approve, allowance) and optional metadata like name, symbol, and decimals. These functions allow wallets and exchanges to track token balances, enable users to send tokens, and permit third-party applications (like decentralized exchanges) to spend tokens on a user's behalf. This standardization ensures interoperability, meaning any ERC-20 token can be seamlessly integrated with wallets, dApps, and other smart contracts that support the standard.
Get In Touch
today.
Our experts will offer a free quote and a 30min call to discuss your project.