Skip to main content
LIVE
BTC $—| ETH $—| BNB $—| SOL $—| XRP $— · · · BITAIGEN · · · | | | | · · · BITAIGEN · · ·

What is ERC-20? A clear explanation with examples

Bitaigen Research Bitaigen Research 9 min read

## Introduction

Introduction

ERC‑20 is the most widely adopted token standard on the Ethereum blockchain, defining a common set of functions that any smart‑contract‑based token must implement. By adhering to this interface, tokens become interoperable with wallets, decentralized exchanges (DEXs), and other infrastructure without custom integration work. As of April 2026, more than 300 million ERC‑20 addresses hold a combined market‑cap exceeding $30 billion, illustrating the standard’s dominance. Understanding ERC‑20’s design choices helps developers anticipate both its strengths and its constraints.

工作原理/How it works

At the core of ERC‑20 is a Solidity interface that specifies six mandatory functions—totalSupply, balanceOf, transfer, transferFrom, approve, and allowance—plus two optional events, Transfer and Approval. When a user calls transfer(to, amount), the contract updates two storage slots (the sender’s and the recipient’s balances) and emits a Transfer event, which off‑chain services index to reflect the new state. The allowance mechanism (approve/transferFrom) enables a third party, such as a DEX router, to move up to a pre‑approved token amount on behalf of the token holder, reducing the need for multiple on‑chain approvals. All state changes are recorded in the Ethereum World State, which, after the London hard fork, incurs a base gas cost of 21 000 gwei for a simple ERC‑20 transfer of 1 ETH‑worth of tokens.

常见用例/Common use cases

  1. Initial token offerings – Projects launch utility or governance tokens as ERC‑20 assets because exchanges can list them instantly; the 2023 “GameFi” wave saw 12 000 new ERC‑20 contracts minted within a single month.
  2. Liquidity provisioning – Automated market makers (e.g., Uniswap V3) require ERC‑20 tokens to create pools; a single pool can hold up to 2 048 different token pairs, each tracked by the same standard functions.
  3. Cross‑chain bridges – Wrappers like Polygon’s PoS Bridge lock native ERC‑20 tokens on Ethereum and mint equivalent tokens on side‑chains, relying on the immutable balanceOf query to verify locked amounts.

These patterns thrive because the standard eliminates the need for bespoke adapters, allowing developers to focus on token economics rather than integration plumbing.

常见误解/Pitfalls

A common myth is that ERC‑20 guarantees safety; however, the standard does not enforce checks against integer overflow or re‑entrancy, so poorly written contracts can still be vulnerable—historical incidents such as the 2022 “SushiSwap” exploit resulted from missing require statements in transfer. Another misconception is that approve is a one‑time operation; due to the “race condition” problem, users must first set allowance to zero before changing it, otherwise a malicious spender could front‑run the transaction and drain more tokens. Finally, developers sometimes assume ERC‑20 tokens are indistinguishable from ETH, yet gas fees are always paid in native Ether, and sending ERC‑20 tokens to a contract that does not implement the required interface will cause the transaction to revert, wasting gas.

FAQ

Q1: How does ERC‑20 differ from newer standards like ERC‑777 or ERC‑1155?

A1: ERC‑20 provides only a single‑balance model and lacks built‑in hooks for advanced features; ERC‑777 adds tokensReceived/tokensToSend callbacks for better composability, while ERC‑1155 supports batch transfers of multiple token types, reducing gas when moving heterogeneous assets.

Q2: Can an ERC‑20 token be upgraded after deployment?

A2: The original ERC‑20 specification does not include upgradeability, but developers can implement proxy patterns (e.g., OpenZeppelin’s Transparent Proxy) that separate logic from storage, allowing future contract versions to replace the token’s code while preserving balances.

Q3: What gas cost should I expect for a typical ERC‑20 transfer on mainnet?

A3: As of the current base fee (≈ 30 gwei) and a transaction size of 68 bytes, a plain transfer of 100 tokens typically consumes around 51 000 gas, translating to roughly $0.12 USD at a $2,500 ETH price, though congestion can push the cost higher.

Sign up on Binance – Maximum Fee Discount邀请码 B2345 · Spot fee from 0.075%
Bitaigen Research
About the Author
Bitaigen Research

Bitaigen's editorial team covers blockchain news, market analysis and exchange tutorials.

Join our Telegram Discuss this article
Telegram →

Subscribe to Bitaigen

Weekly crypto news, Bitcoin price analysis delivered to your inbox

🔒 We respect your privacy. No spam, ever.

⚠️ Risk disclaimer: Crypto prices are highly volatile. This article is not investment advice. Invest responsibly at your own risk.