Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
LABS
Glossary

IERC20

IERC20 is the formal Solidity interface that defines the mandatory functions and events a smart contract must implement to be an ERC-20 compliant fungible token on Ethereum and EVM-compatible blockchains.
Chainscore © 2026
definition
TOKEN STANDARD

What is IERC20?

IERC20 is the foundational interface that defines the standard functions and events for fungible tokens on the Ethereum blockchain.

IERC20 is the canonical interface specification, defined in Ethereum Improvement Proposal 20 (EIP-20), that establishes a standard API for fungible tokens. This ensures that any token contract implementing IERC20 will have a predictable set of methods—like transfer, balanceOf, and approve—and events, enabling wallets, exchanges, and decentralized applications (dApps) to interact with all such tokens in a uniform way. The "I" prefix denotes it as an interface, a contract type in Solidity that declares function signatures without implementation.

The core functions mandated by the IERC20 interface govern token transfers and allowances. The transfer and transferFrom functions move tokens between addresses, while approve and allowance enable the delegated transfer mechanism essential for decentralized exchanges and smart contract interactions. This allows a user to grant a smart contract (like a DEX router) permission to spend a specific amount of tokens on their behalf, a pattern critical for composability within DeFi. Events like Transfer and Approval provide a standardized log for off-chain systems to track state changes.

For developers, implementing IERC20 involves writing a concrete smart contract that provides the logic for each function, typically managing an internal mapping of addresses to balances. Widely adopted implementations include OpenZeppelin's audited ERC20 contract, which provides secure, battle-tested base code. It's crucial to distinguish IERC20 (the interface) from ERC20 (a full implementation). While IERC20 defines what functions exist, an ERC20 contract defines how they work, handling details like minting, burning, and often incorporating extensions like ERC20Burnable or ERC20Snapshot.

etymology
TOKEN STANDARD

Etymology and Origin

The IERC20 interface is the foundational technical specification for fungible tokens on the Ethereum blockchain, establishing a common language for wallets and decentralized applications.

The term IERC20 is a portmanteau of I (for Interface) and ERC20, which stands for Ethereum Request for Comments 20. This naming convention follows a long-standing practice in software engineering and internet standards, where an "I" prefix denotes an interface—a contract that defines function signatures without implementation. The ERC20 portion refers to the specific proposal number in the Ethereum Improvement Proposal (EIP) process. The interface was formally defined in EIP-20, authored by Fabian Vogelsteller and Vitalik Buterin in November 2015, which standardized a set of six mandatory and three optional functions for tokens.

The creation of IERC20 solved a critical interoperability problem in Ethereum's early ecosystem. Before its adoption, each new token project implemented its own custom API, requiring exchanges, wallets, and other smart contracts to write unique integration code for every token. The IERC20 interface provided a universal blueprint, ensuring that any compliant token—from a stablecoin like USDC to a governance token like UNI—exposes the same core methods for querying balances (balanceOf), transferring value (transfer), and authorizing third-party spending (approve, transferFrom). This standardization is analogous to the USB standard for hardware, enabling seamless connectivity between diverse applications.

The I in IERC20 is semantically crucial. In Solidity, an interface is a specific type of contract that cannot hold state or implement logic; it only declares function signatures that implementing contracts must define. This abstraction allows developers to write code that interacts with the interface rather than a specific contract, enabling greater flexibility and security. For example, a decentralized exchange's smart contract can be programmed to accept any token that conforms to the IERC20 interface, future-proofing it against new token launches. This design pattern is a cornerstone of Ethereum's composability, allowing decentralized finance (DeFi) protocols to build upon each other like financial Lego bricks.

The widespread adoption of IERC20 has made it the most successful and influential token standard in blockchain history, serving as the direct inspiration for similar standards on other smart contract platforms like BNB Smart Chain, Polygon, and Avalanche. Its legacy extends beyond simple transfers, as its approval mechanism became the foundational security model for decentralized exchanges and lending protocols. However, its design also introduced well-documented challenges, such as the approve race condition and the inability to handle non-fungible assets or batch operations, which later standards like ERC721 (for NFTs) and ERC1155 (multi-token) were created to address.

key-features
ERC-20 STANDARD

Key Features of the IERC20 Interface

The IERC20 interface defines the core functions and events required for a fungible token contract on Ethereum and other EVM-compatible blockchains, ensuring interoperability across wallets, exchanges, and decentralized applications.

01

Core Transfer Functions

The interface mandates three essential functions for moving tokens:

  • transfer(address to, uint256 amount): Sends amount of tokens from the caller's balance to address to.
  • transferFrom(address from, address to, uint256 amount): Moves amount of tokens from address from to address to, enabled by a prior approve call.
  • approve(address spender, uint256 amount): Authorizes a spender (e.g., a DEX contract) to withdraw up to amount tokens from the caller's account.
02

Balance & Allowance Getters

Two view functions provide critical on-chain state information:

  • balanceOf(address account): Returns the token balance of a specific account. This is the fundamental query for wallets and explorers.
  • allowance(address owner, address spender): Returns the remaining number of tokens that spender is allowed to withdraw from owner. This enables secure delegated spending patterns.
03

Standardized Events

IERC20 specifies two events that contracts must emit to log state changes for off-chain systems:

  • Transfer(address indexed from, address indexed to, uint256 value): Emitted on any successful token transfer.
  • Approval(address indexed owner, address indexed spender, uint256 value): Emitted when an approval is successfully called. These indexed events are essential for block explorers, analytics dashboards, and indexers like The Graph.
04

Total Supply

The totalSupply() function returns the total amount of tokens in existence. This is a key metric for tokenomics and market capitalization calculations. It can represent:

  • A fixed supply (e.g., 21 million BTC, simulated in ERC-20).
  • An inflationary or deflationary supply that changes via minting and burning mechanisms implemented in the full contract.
05

Decimals & Token Units

While not part of the core IERC20 interface, the related decimals() function (often defined in an extension) is critical for proper display. It returns a uint8 (typically 18) indicating how many decimal places the token uses. For example, a balance of 1000000000000000000 with decimals = 18 represents 1.0 token. Wallets and UIs use this to convert the raw uint256 balance into a human-readable format.

06

Security Considerations & Extensions

The minimal IERC20 interface has known considerations:

  • The approve/transferFrom race condition where a second approval can be front-run.
  • Lack of native metadata (name, symbol) which is defined in the optional ERC20Detailed extension.
  • No built-in permit function for gasless approvals (EIP-2612). These are addressed by extended standards like ERC-20 (OpenZeppelin's implementation) and EIP-2612.
how-it-works
ERC-20 STANDARD

How the IERC20 Interface Works

The IERC20 interface is the foundational technical specification that defines the standard API for fungible tokens on the Ethereum blockchain, enabling seamless interoperability between tokens, wallets, and decentralized applications.

The IERC20 interface is a set of function signatures and event definitions that a smart contract must implement to be considered an ERC-20 compliant token. This standardization, formalized in Ethereum Improvement Proposal 20 (EIP-20), creates a predictable blueprint for token behavior. It specifies six mandatory functions—totalSupply, balanceOf, transfer, transferFrom, approve, and allowance—and two optional events—Transfer and Approval. By adhering to this interface, any wallet, exchange, or decentralized application (dApp) can interact with a new token without needing custom integration code, as they all share a common set of commands for querying balances and moving value.

The core mechanics revolve around two primary operations: direct transfers and delegated transfers. The transfer function allows a token holder to send tokens directly to another address. For more complex interactions like decentralized exchange trades or automated payments, the approve and transferFrom functions enable a delegated transfer model. A token holder first approves a spender (e.g., a DEX contract) to withdraw a specific allowance from their balance. The spender can then call transferFrom to execute the transfer on the holder's behalf, a pattern essential for Decentralized Finance (DeFi) protocols.

Implementing the interface correctly is critical for security and functionality. Common pitfalls include not emitting the required Transfer event for all state changes or incorrectly updating allowances, which can lead to vulnerabilities like the ERC-20 approval race condition. The balanceOf and totalSupply functions are view functions, meaning they only read the blockchain state and do not cost gas when called externally. Developers often extend the basic IERC20 with additional interfaces (like IERC20Metadata for name and symbol) or wrap it in more feature-rich implementations such as OpenZeppelin's ERC20 contract, which provides a secure, audited base.

code-example
IMPLEMENTATION STANDARD

Code Example: The IERC20 Interface

A practical examination of the canonical interface that defines the core functions and events for fungible tokens on the Ethereum blockchain.

The IERC20 interface is a standardized set of function and event signatures that defines the minimal public API for a fungible token contract on Ethereum and other EVM-compatible blockchains. This interface, formalized in Ethereum Improvement Proposal 20 (EIP-20), ensures interoperability by guaranteeing that all compliant tokens expose the same core methods—such as totalSupply, balanceOf, transfer, approve, and transferFrom—and events like Transfer and Approval. By adhering to this blueprint, developers can create wallets, decentralized exchanges, and other applications that work seamlessly with any token that implements the standard, from stablecoins like USDC to governance tokens.

At its core, the interface manages two fundamental concepts: balances and allowances. The balanceOf function queries the token balance of a specific address, while transfer enables the direct movement of tokens from the sender to a recipient. The approve and transferFrom functions enable the allowance mechanism, which is critical for decentralized finance (DeFi). This mechanism allows a token owner to authorize a third-party contract (like a DEX or lending protocol) to spend a specific amount of tokens on their behalf, enabling complex, non-custodial financial interactions without requiring the owner to sign every transaction.

Examining a code snippet reveals the interface's structure. It begins with the pragma solidity directive and defines the interface using the interface keyword. Key functions are declared without implementation details, specifying only their visibility, parameters, and return types. For example, function transfer(address to, uint256 amount) external returns (bool); mandates that any implementing contract must have a function that accepts a recipient address and an amount, and returns a boolean indicating success. The event Transfer(address indexed from, address indexed to, uint256 value); declaration ensures that token movements are logged on-chain for external applications to monitor.

Implementing the IERC20 interface correctly is crucial for security and compatibility. A common implementation pattern involves an internal _balances mapping and an _allowances nested mapping to track state. The transfer function must deduct from the sender's balance and add to the recipient's, emitting a Transfer event. The approve function sets the allowance, while transferFrom must check that the caller has sufficient allowance, transfer the tokens, and deduct the spent amount from the allowance. Failure to properly update state variables or emit events can lead to tokens being lost or applications failing to recognize transactions.

Beyond the basic functions, the EIP-20 standard also defines optional metadata fields: name, symbol, and decimals. While not required by the core interface, these are almost universally implemented to provide human-readable information about the token. The decimals value is particularly important, as it specifies how many decimal places the token uses, clarifying that a balance of 1000000 for a token with 6 decimals represents 1.000000 tokens. Many development frameworks and tools, like OpenZeppelin's ERC20 contract, provide secure, audited base implementations that handle these details and common extensions, such as the increaseAllowance and decreaseAllowance functions for safer allowance management.

ecosystem-usage
IERC20

Ecosystem Usage and Adoption

The IERC20 interface is the foundational technical standard for fungible tokens on Ethereum and EVM-compatible blockchains, enabling seamless interoperability across wallets, exchanges, and decentralized applications.

01

The Standard Interface

The IERC20 interface defines a mandatory set of six functions (totalSupply, balanceOf, transfer, transferFrom, approve, allowance) and two events (Transfer, Approval) that a smart contract must implement to be recognized as an ERC-20 token. This standardization ensures predictable behavior, allowing wallets, exchanges, and other smart contracts to interact with any token without custom integration code.

02

Core Functions: Transfer & Approval

Two key mechanisms govern token movement:

  • transfer(to, amount): Allows a token holder to send tokens directly to another address.
  • approve(spender, amount) & transferFrom(from, to, amount): Enables delegated transfers. A token holder approves a spender (like a DEX) to withdraw a specific amount from their account, which the spender can then execute via transferFrom. This pattern is essential for decentralized exchanges and lending protocols.
03

Ubiquity in DeFi

IERC20 is the backbone of Decentralized Finance (DeFi). Virtually all liquidity pool tokens (LP tokens), governance tokens, and stablecoins (like DAI and USDC) are ERC-20 compliant. This allows them to be seamlessly used as collateral in lending protocols (Aave, Compound), swapped on automated market makers (Uniswap, SushiSwap), and integrated into yield farming strategies.

04

Wallet & Exchange Integration

Because IERC20 defines a universal API, wallets (MetaMask, Coinbase Wallet) and centralized exchanges (Coinbase, Binance) can automatically support any new ERC-20 token by querying its standard functions. They read balanceOf to display holdings, listen for Transfer events to track transactions, and use the approval system for secure, user-confirmed interactions with dApps.

05

Common Extensions & Limitations

While IERC20 defines core functionality, common extensions address its limitations:

  • ERC-20 Permit (EIP-2612): Enables gasless approvals via off-chain signatures.
  • Missing Decimals: The original IERC20 lacks a decimals field, which is defined in the broader ERC-20 specification.
  • Lack of Metadata: Token name and symbol are not part of the interface, leading to optional, sometimes inconsistent, implementations.
06

Security Considerations

The approve/transferFrom mechanism introduces specific risks:

  • Race Conditions: Changing an approval from 5 to 3 tokens can be front-run, allowing a spender to use the original 5 and the new 3.
  • Infinite Approvals: Users often approve maximum uint256 values for convenience, which poses a risk if the spender contract is compromised. Best practice is to use approvals only for the needed amount and duration, or to use the ERC-20 Permit standard.
security-considerations
IERC20

Security Considerations and Best Practices

The IERC20 interface defines a standard for fungible tokens, but its implementation introduces critical security risks that developers must mitigate. These cards outline essential checks and patterns for secure token interactions.

01

Validate Return Values

The original IERC20 specification does not mandate a return value for transfer and transferFrom. Some tokens (e.g., USDT) return nothing on success, while others return a boolean. To handle this safely:

  • Always use safeTransfer: Use OpenZeppelin's SafeERC20 library which wraps calls in safeTransfer and safeTransferFrom.
  • Check for success: For direct calls, the pattern is require(IERC20(token).transfer(to, amount), "Transfer failed"); but this will revert for non-compliant tokens.
  • Legacy tokens: For tokens like Tether, you must call them without expecting a return value, which requires a different contract interface.
02

Guard Against Reentrancy

The approve and transfer functions can be vectors for reentrancy attacks if not properly sequenced, especially when interacting with external contracts.

  • Use Checks-Effects-Interactions: Update internal state balances before making the external transfer call.
  • Employ Reentrancy Guards: Use modifiers like OpenZeppelin's ReentrancyGuard for functions that perform transfers after external calls.
  • Beware of Callbacks: Some tokens (e.g., ERC-777) have hooks that call back into your contract on transfer. Treat any token transfer as a potential external call.
03

Manage Allowance Correctly

Incorrectly managing the approve function is a common source of vulnerabilities and user frustration.

  • Beware of Front-Running: A classic attack involves changing an approval from 5 to 3, but an attacker front-runs with a transferFrom for 5 before the reduction takes effect. Use increaseAllowance and decreaseAllowance functions from newer standards (ERC20Pausable extensions) to mitigate this.
  • Avoid Infinite Approvals: While convenient, they maximize loss if the spender contract is compromised. Recommend time-bound or periodic allowances.
  • Reset to Zero First: The safe pattern for changing an existing allowance is to first set it to zero, then to the new amount.
04

Verify Token Contract Integrity

Not all contracts claiming IERC20 compliance are safe or even genuine. Always perform due diligence.

  • Check for Proxies/Upgradability: Determine if the token uses a proxy pattern; the implementation could change, altering token behavior.
  • Look for Hidden Fees/Mint Functions: Some malicious tokens override transfer to take unexpected fees or allow arbitrary minting. Review the contract source or audit reports.
  • Use Verified Contracts: Prefer tokens with verified source code on block explorers. Integrate with known token addresses from official registries.
05

Handle Decimals Consistently

The decimals() function is optional in IERC20, leading to integration errors. The ERC20 standard recommends it, but it's not enforced.

  • Never Assume 18 Decimals: Major tokens like USDC use 6 decimals. Your contract must read the decimals() value for accurate calculations.
  • Use Scaling Functions: Always convert user-facing amounts (e.g., "1.5 tokens") to raw units using amount * 10**decimals().
  • Fallback Logic: For non-compliant tokens without a decimals() method, you may need an off-chain registry or default assumption, which is risky.
INTERFACE VS. CONTRACT

Comparison: IERC20 Interface vs. ERC-20 Implementation

A technical breakdown distinguishing the standard interface definition from a concrete, deployable token contract.

Feature / AspectIERC20 InterfaceERC-20 Implementation

Primary Purpose

Defines a standard API

Provides executable logic

State Variables

Function Logic

Deployable

Compiler Target

Interface (.sol)

Contract (.sol)

Inheritance Use

For type safety & declarations

For reusing standard logic

Standard Compliance

Defines the required function signatures

Must implement all required signatures

Gas Cost

0 (abstract, not deployed)

Varies by implementation logic

FAQ

Common Misconceptions About IERC20

Clarifying frequent misunderstandings about the foundational token standard for Ethereum and EVM-compatible blockchains.

No, IERC20 is not a token; it is a smart contract interface. An interface defines a set of function signatures (like transfer, balanceOf) that a token contract must implement to be considered ERC-20 compliant. The actual token is a separate contract that implements this interface. For example, the USDC token contract is an implementation of the IERC20 interface. This distinction is crucial for developers who interact with tokens programmatically, as they use the interface to guarantee a standard set of methods will be available.

ERC-20 STANDARD

Technical Deep Dive

A comprehensive FAQ on the IERC20 interface, the foundational technical standard for fungible tokens on the Ethereum blockchain and EVM-compatible networks.

The IERC20 interface is a standardized set of function signatures and events that define the core behavior of a fungible token on the Ethereum Virtual Machine (EVM). It works by establishing a mandatory contract Application Binary Interface (ABI) that wallets, exchanges, and other smart contracts can reliably interact with, enabling functions like querying balances (balanceOf), transferring tokens (transfer), and approving third-party spending allowances (approve, transferFrom). This standardization ensures interoperability, meaning any application that understands IERC20 can work with all tokens that implement it, from USDC to UNI.

IERC20 STANDARD

Frequently Asked Questions (FAQ)

Common technical questions about the IERC20 interface, the foundational standard for fungible tokens on Ethereum and other EVM-compatible blockchains.

IERC20 is a standardized smart contract interface that defines the mandatory functions and events a token must implement to be considered an ERC-20 token on the Ethereum blockchain. It works by providing a common Application Binary Interface (ABI) that allows wallets, exchanges, and other smart contracts to interact with any compliant token in a predictable way. The core functions include transfer, balanceOf, and approve, which handle sending tokens, checking balances, and enabling delegated spending via transferFrom. By adhering to this interface, token developers ensure interoperability across the entire ecosystem, as any application that understands IERC20 can seamlessly integrate the new token.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected direct pipeline
IERC20: The Ethereum Token Standard Interface | ChainScore Glossary