What is ERC20? A Guide to the Ethereum token standard
An overview of ERC20, the token standard that promotes interoperability across the Ethereum blockchain network and its many applications.
By Corey Barchat
Since its inception in 2015, the Ethereum blockchain has been a pioneer in decentralized applications (dApps) and smart contracts.
At the heart of this diverse Ethereum ecosystem of dApps, digital tokens, and wallets lies the ERC-20 token standard, dictating how fungible Ethereum tokens operate, interact, and facilitate the growth of the Ethereum network.
It's little exaggeration to say that this achievement has revolutionized the creation and management of tokens on the Ethereum blockchain. But what is the ERC-20 standard and how does it work?
In this comprehensive guide, we will examine what ERC20 is, how it works, its benefits and risks, and even how to create ERC20 contracts.
What is ERC20?
ERC20 is a standard for fungible tokens on the Ethereum blockchain. Short for Ethereum Request for Comments 20, ERC20 defines a set of rules and functions that Ethereum-based tokens must adhere to, ensuring interoperability and compatibility with the various applications, wallets, crypto exchanges, and smart contracts across the Ethereum ecosystem.
Origins of ERC20
The ERC token standard was officially proposed by developer Fabian Vogelsteller in 2015, and formalized into Ethereum Improvement Proposal 20 (EIP-20) in 2017. But why was it proposed in the first place?
Prior to ERC20, there were issues with creating, using, and exchanging different tokens on the Ethereum blockchain due to a lack of standardization. ERC20 was designed as the technical standard for fungible tokens on the Ethereum network, making each token within a set identical to the others.
Ever since cementing itself as the standard for creating fungible tokens, ERC-20 has become a cornerstone of the Ethereum blockchain ecosystem, enabling developers to create innovative solutions and drive growth on the platform.
Just as with traditional Ether tokens, all transactions involving ERC20 tokens are recorded on the Ethereum blockchain, providing traceability of all token transfers and operations on the network.
How does the ERC-20 standard work?
At its core, the ERC20 standard outlines the functions that a token contract must implement to be considered ERC20 compliant. These functions play crucial roles in the operation of ERC20 tokens, from keeping track of the total supply of tokens to managing how tokens are transferred between addresses.
By following these guidelines, developers can create tokens that seamlessly interact with other Ethereum-based applications, fostering a vibrant ecosystem of decentralized finance (DeFi).
Main ERC-20 functions
The ERC20 standard requires that tokens must implement six mandatory functions:
- totalSupply: The total supply of ERC-20 tokens
- balanceOf: The balance of ERC-20 tokens held by a single wallet address
- transfer: Allows one wallet address to send an ERC20 token to another
- approve: Gives permission for one address to spend tokens on behalf of another
- transferFrom: Allows one address to send tokens from an approved address
- allowance: The amount of tokens an approved address can spend on behalf of another
Some of these ERC20 smart contract functions are included for security purposes. They perform checks on the sender’s balance and approvals before moving tokens. This helps to enforce proper permissions, ensure transaction legitimacy, and prevent unauthorized transactions.
There are also some optional functions that can developers can program into the contracts of ERC-20 tokens via Solidity:
- name: The name of the ERC-20 token
- symbol: The ticker display of the ERC-20 token
- decimals: The maximum number of decimal places that a token can be divided
Although not mandatory, these three functions may be useful to users and developers alike that may interact with the specific coin. For example, the name and symbol can help identify the token so users don’t accidentally buy or send the wrong one.
Benefits of ERC-20 tokens
The ERC20 standard has ushered in plenty of benefits for the Ethereum ecosystem and the broader blockchain and DeFi spaces:
Interoperability
ERC-20 tokens can be easily traded, exchanged, and integrated into various Ethereum-based applications, enhancing usability and interoperability between dApps.
Standardized framework
The standardized interface simplifies Ethereum-based token development, auditing, and integration. Token standards like ERC-20 also help to reduce the barrier to entry for developers and promote innovation.
Accessibility
ERC-20 tokens can be stored and managed using a wide range of Ethereum wallets, ensuring easy access for users across different platforms and device types.
Liquidity
The proliferation of ERC20 tokens has contributed much-needed liquidity to the Ethereum ecosystem, fueling the growth of applications like decentralized exchanges (DEXs) and liquidity pools.
Scalability
By leveraging Ethereum's robust infrastructure, an ERC20 token inherits the scalability and security features of the Ethereum blockchain, facilitating efficient transactions and smart contract execution.
Examples of ERC-20 tokens
Numerous ERC20 tokens have gained widespread adoption and recognition within the crypto community. Here are some notable examples:
Tether (USDT)
USDT is a stablecoin whose value is pegged to the US dollar. Tether (USDT) is widely used in many decentralized applications, such as DEXs and liquidity pools.
USD Coin (USDC)
USDC is another stablecoin tied to the US dollar, USD Coin (USDC) is known for its greater transparency and regulatory compliance than USDT.
Chainlink (LINK)
LINK is a cryptocurrency that enables decentralized oracle networks to connect smart contracts with external data sources.
Uniswap (UNI)
UNI is the native token of the Uniswap decentralized exchange. It also serves as a governance token that enables users to participate in protocol governance.
Wrapped Bitcoin (WBTC)
WBTC is an ERC-20 token pegged to the value of Bitcoin, allowing users to access Bitcoin liquidity on the Ethereum blockchain.
Shiba Inu (SHIB)
SHIB started as a meme coin that was inspired by Dogecoin (DOGE). Shiba Inu (SHIB) now has its own ecosystem of tokens and DeFi applications.
Additional ERC-20 tokens include Compound (COMP), Basic Attention Token (BAT), Polygon (MATIC), The Sandbox (SAND), Immutable (IMX), Wrapped Ethereum (WETH), and Pepe (PEPE). These examples of ERC-20 tokens represent just a fraction of the diverse ecosystem of Ethereum-based tokens, each serving unique purposes and catering to various use cases within the DeFi ecosystem.
Challenges and limitations of ERC-20 tokens
Despite their numerous advantages, ERC-20 tokens are not without their risks and drawbacks:
Security vulnerabilities
Malicious actors can exploit vulnerabilities in ERC20 smart contracts, leading to security breaches and token theft.
Scalability issues
The increasing demand for Ethereum transactions has led to network congestion and high gas fees, hindering the scalability and potential usage of ERC20 tokens.
Regulatory uncertainty
The regulatory landscape surrounding ERC-20 tokens remains uncertain, with some regulatory bodies yet to define their classification and oversight.
Smart contract risks
Errors or vulnerabilities in smart contract code can result in irreversible losses of funds or unexpected behavior, highlighting the importance of rigorous auditing and testing.
Other risks
There are also additional security threats involved in ERC20 tokens like exploitation of backdoors in token functions, bugs and vulnerabilities due to inadequate testing and auditing, pump and dump schemes (due to the low entry barrier for creating tokens), as well as phishing and other cryptocurrency scams.
Other Ethereum token standards
ERC20 is not the only Ethereum token standard, and it has opened the path for the creation of other token standards:
ERC-721
ERC-721 introduced the concept of non-fungible tokens (NFTs) with unique identifiers for each token. NFTs support complex ownership structures for use cases like virtual worlds, art, ticketing, collectibles, and more.
ERC-1155
ERC-1155 expanded utility further by allowing a combination of fungible and non-fungible tokens within a single contract, enhancing use cases in areas like gaming with diverse assets like in-game items and usable digital currencies.
ERC-404
ERC-404 further built on the concept of semi-fungible tokens that enables fractionalized ownership for users in areas like real estate, DeFi, gaming, and more.
The Ethereum community, powered by the Ethereum Virtual Machine (EVM), continues to innovate with new tokens and newer standards such as ERC-1400 and ERC-998. showing a commitment to adapt to the diverse and evolving needs of token users and creators.
The future of the ERC-20 standard
The inception and broad acceptance of ERC20 has deeply impacted the cryptocurrency landscape. It has helped to establish a foundational standard for token interoperability, enhancing efficiency and accessibility for decentralized applications and exchanges.
This accessibility has helped accelerate the Ethereum network’s growth, driving innovation and expanding the blockchain’s capabilities. Despite inherent risks and challenges, the ERC20 standard continues to evolve, with ongoing efforts to address scalability, security, and regulatory concerns.
As the decentralized finance space continues to mature and attract mainstream adoption, ERC-20 tokens are poised to play a pivotal role in shaping the future of finance, offering potentially greater accessibility, liquidity, and innovation.
Frequently asked questions about ERC-20 tokens (FAQs)
What are ERC-20 tokens used for?
Ethereum Request for Comments 20 (ERC-20) tokens are commonly used in the decentralized finance (DeFi) space, for various purposes like governance tokens in decentralized autonomous organizations (DAOs), liquidity tokens, stablecoins, and utility tokens within decentralized applications (dApps).
ERC20 tokens contribute to the functionality of platforms such as Uniswap’s decentralized exchange and the Maker Protocol’s lending system, and also enable use cases such as incentivizing user interactions within the Brave browser ecosystem with BAT.
Is ERC-20 the same as ETH?
No. ETH is the native cryptocurrency of the Ethereum blockchain, serving network operations and used to pay for transaction fees. ERC-20 tokens, on the other hand, are distinct tokens following the ERC-20 standard on the Ethereum network.
Where to buy ERC-20 tokens?
MoonPay offers an easy and fast way to buy, sell, and manage ERC-20 tokens using fiat currency.
To get started, just top up your wallet in euros, pounds, or dollars and use your MoonPay Balance to buy ERC-20 tokens like Tether, USDC, and SHIB. Then, simply transact for cheaper and faster transactions with higher approval rates. Plus, enjoy zero-fee withdrawals directly to your bank account when you decide to cash out.
How to store and send ERC20 tokens
Storing and sending ERC20 tokens can be done through Ethereum wallets like MetaMask and Ledger. These cryptocurrency wallets allow users to add ERC20 tokens from any other Ethereum wallet by transferring tokens to the corresponding wallet address.
Note: Some cryptocurrency tokens like USDT and USDC can be created on multiple blockchains. If you're sending cryptocurrency to an Ethereum wallet, be sure to check that it is an ERC-20 token and use an Ethereum wallet address.
What are the gas fees for ERC-20 token transactions?
Gas fees are the transaction fees users pay when sending ERC-20 tokens or interacting with smart contracts on the Ethereum blockchain. These fees are paid in Ether (ETH), the native cryptocurrency of the Ethereum network. Gas fees can fluctuate based on network congestion and the complexity of the transaction. For instance, high traffic or complex smart contracts can lead to users paying higher fees.
How are ERC-20 tokens created?
Developers can create ERC-20 tokens by deploying smart contracts on the Ethereum network. These smart contracts define the token’s properties, including the token’s name, symbol, supply, and rules for transferring tokens between accounts.
Are ERC20 tokens safe?
Like any cryptocurrency, ERC-20 tokens are not immune from security breaches. To protect users, developers should enforce access controls to prevent unauthorized use of sensitive functions, conduct thorough contract audits, initiate bug bounty programs, and deploy tokens on testnets to identify bugs.
Create ERC-20 contracts with MoonPay
MoonPay offers powerful tools that simplify the creation and deployment of ERC20 tokens, allowing developers to unleash their creativity and bring their token ideas to life. With MoonPay's Web3 platform, you can effortlessly generate ERC20 smart contracts, customize token parameters such as name, symbol, and supply, to deploy your tokens on the Ethereum blockchain in just a few clicks.
Whether you're launching a new utility token, conducting a tokenized campaign, or experimenting with tokenized assets, we provide all the tools and infrastructure you need to succeed in the rapidly evolving world of Web3.