ERC-20 Tokens Explained: The Complete Guide

ERC-20 tokens are cryptocurrencies on the Ethereum blockchain that follow a specific set of rules and standards. Think of them like apps designed for iPhones; they are built to work seamlessly on the Ethereum network, just like iPhone apps are made to work on iOS.

DeFi, or decentralized finance, is a fast-growing alternative to traditional finance, offering many of the same services like lending, borrowing, and trading, but without the middlemen. 

As of 2024, DeFi’s market size is over $46 billion and growing at 10.98% annually. A big part of DeFi relies on ERC-20 tokens, which allow users to easily use different apps and services across platforms. 

But how do they do that?

In this guide, we’ll explain what these tokens are, how they work, their benefits, limitations, and so much more. 

What are ERC-20 Tokens?

Created by Fabian Vogelsteller and Vitalik Buterin in 2015, ERC-20 became official in 2017, right when Initial Coin Offerings (ICOs) were booming. 

ERC-20 tokens are a type of cryptocurrency built using a set of rules on the Ethereum blockchain. This standard, called “Ethereum Request for Comment 20,” outlines how these tokens should work, covering transfers, transaction approvals, and data access. 

This standard helped the surge of new cryptocurrencies by providing a clear framework, making sure they work well within the Ethereum ecosystem. 

In simple terms, ERC-20 tokens let developers easily create and use fungible tokens, making the Ethereum ecosystem more connected (interoperability) and flexible. 

Examples of Popular ERC-20 Tokens

  • Chainlink (LINK): A decentralized oracle network that gives smart contracts access to real-world data, making them more functional by letting them interact with external sources.
  • Uniswap (UNI): The governance token for one of the most popular decentralized exchanges, enabling users to vote on key decisions and updates. 
  • Tether (USDT): A stablecoin pegged to the US dollar, used for trading and as a store of value, providing stability in the volatile crypto market and making value transfers easier.

How Do ERC-20 Tokens Work?

ERC-20 tokens work on the Ethereum blockchain and use smart contracts to manage their activities. Each token is a digital asset you can exchange and use within the Ethereum ecosystem. They follow specific rules, called “standards,” to make sure they work smoothly with other tokens and services on Ethereum.

Smart contracts are the backbone of these tokens. They handle the creation, transfer, and management of ERC-20 tokens, ensuring that all transactions are transparent, secure, and tamper-proof. 

The ERC-20 standard includes six must-have functions and three optional ones. The following are the required ones: 

  • totalSupply: Shows the total number of tokens.
  • balanceOf: Displays how many tokens an account has.
  • transfer: Moves tokens to another address.
  • approve: Allows a spender to withdraw a set number of tokens from an account.
  • transferFrom: Transfers tokens from one account to another.
  • allowance: Shows the remaining tokens that a spender can withdraw.

These functions make sure tokens can be moved, tracked, and used in a predictable manner. This makes ERC-20 tokens compatible with decentralized apps (dApps), wallets, and exchanges.

While ERC-20 tokens are fungible (each token is the same as another), like regular money, there are other token standards for different uses. For example, ERC-721 tokens are non-fungible tokens (NFTs) used for unique items like digital art. Each ERC-721 token is unique and can’t be swapped one for one with another. ERC-1155 tokens, on the other hand, support both fungible and non-fungible tokens in one contract, offering more flexibility.

In short, ERC-20 tokens are essential for creating and managing digital assets on Ethereum, making the blockchain more versatile and efficient.

Benefits of ERC-20 Tokens

ERC-20 tokens offer several useful benefits that make them better and stand out among the thousands of other cryptocurrencies. Here are some of them:

Benefits of ERC-20 Tokens

Interoperability

One major benefit of ERC-20 tokens is their ability to work seamlessly within the Ethereum ecosystem. Because they all follow the same standards, they easily interact with decentralized apps (dApps), wallets, and exchanges. For example, platforms like Uniswap and MetaMask support ERC-20 tokens, making it easy for users to trade and manage their tokens. 

Security

ERC-20 tokens benefit from the robust security features of the Ethereum blockchain. The most apparent reason is Ethereum’s decentralized nature, making it tough for criminals to hack or commit fraud. During the 2020 DeFi boom, the security of ERC-20 tokens was a key reason for their popularity. Moreover, smart contracts add extra security by automatically enforcing rules and conditions, reducing the risk of errors and attacks. 

Efficiency in Transactions

The Ethereum blockchain processes transactions quickly, usually within 15 seconds. This speed allows for quick token transfers. Additionally, smart contracts automate many tasks, cutting down on manual work and lowering transaction costs. This makes using ERC-20 tokens cheaper and faster than many traditional financial systems, and even Bitcoin. Bitcoin transactions can be slower, sometimes taking up to 10 minutes, making ERC-20 tokens more appealing for quick trades.

Widespread Adoption

ERC-20 tokens have seen widespread adoption in the crypto space. They are used in applications from initial coin offerings (ICOs) to decentralized finance (DeFi) platforms and gaming. For example, popular DeFi platforms like Aave and Compound rely heavily on ERC-20 tokens. This broad use has created a lively ecosystem, driving further innovation and development. 

Creating an ERC-20 Token

Step-by-Step Guide

1. Set Up the Development Environment

First, set up your development environment. Install the necessary software like Node.js, npm, and the Truffle framework. You’ll also need an Ethereum wallet, such as MetaMask, to manage your tokens and interact with the blockchain.

2. Write the Smart Contract

Next, write the smart contract. Create a new project using Truffle and write your ERC-20 smart contract in Solidity. Make sure to use predefined templates to comply with the ERC-20 standard and define key functions like totalSupply, balanceOf, transfer, approve, transferFrom, and allowance.

3. Compile and Deploy the Contract

After writing the contract, compile and deploy it. Use Truffle to compile the smart contract, checking for errors and generating the needed bytecode. Deploy the contract to the Ethereum test network, such as Ropsten, for initial testing. Once everything works correctly, deploy it to the main Ethereum network.

4. Test the Contract

Then, test the contract thoroughly. Make sure all functions work as expected, including transferring tokens, checking balances, and approving transactions. Use tools like Remix and Ganache for local testing and debugging.

5. Verify and Publish the Contract

Verify and publish your contract. To increase transparency and trust, verify the smart contract on Etherscan. And lastly, publish the contract address and details so users can interact with your token.

Bonus Tip

As a bonus tip, use ChatGPT for help. If you’re new to programming, ChatGPT can generate boilerplate code for your smart contract, suggest best practices, and help troubleshoot errors in your Solidity code. It can also assist in writing test cases and provide debugging strategies for common issues.

Required Tools and Resources

  • Development Frameworks: Truffle, Hardhat, OpenZeppelin
  • Smart Contract Languages: Solidity
  • Wallets: MetaMask, MyEtherWallet
  • Testing Tools: Ganache, Remix
  • Blockchain Networks: Ethereum mainnet, Ropsten testnet

ERC-20 Token Use Cases

ERC-20 Token Use Cases

Decentralized Finance (DeFi)

ERC-20 tokens are the backbone of decentralized finance (DeFi) in many ways. They power platforms like Aave for lending and Uniswap for trading. 

The Ethereum blockchain, which these tokens use, enables fast transactions, low costs, and smart contract features that make DeFi possible. And DeFi makes financial services more accessible by cutting out middlemen, lowering costs, and opening access to everyone. 

Initial Coin Offerings (ICOs)

When a new blockchain project needs to raise money, it can create its own ERC-20 tokens on the Ethereum blockchain. These tokens represent a share or a utility in the project. Investors buy these tokens using Ethereum, giving the project the funds it needs to develop its product or service. Ethereum itself was funded through an ICO, setting an example for others. This method has raised billions of dollars, helping many startups grow in the industry.

Gaming and NFTs

ERC-20 tokens act as in-game money and digital items in gaming and NFTs, making it easier for users to trade and use these assets across different games and NFT marketplaces. For instance, Decentraland has seen virtual land sell for over $100,000, and NFTs were selling for millions of dollars during the NFT boom in 2021-2022. And this entire booming economy is built on the back of these tokens. 

As blockchain adoption continues to grow, ERC-20 tokens could play a crucial role, with potential uses in finance, supply chain, healthcare, and more, thanks to their interoperability and flexibility. 

How to Store ERC-20 Tokens

You would store ERC-20 tokens the same way as you do with any other cryptocurrency. Check out our in-depth guide on protecting your digital assets to learn more. But to quickly go over the basics, here are some common methods and best practices:

Hardware Wallets: Devices like Ledger Nano S, Ledger Nano X, and Trezor store your private keys offline. This keeps them safe from hackers and malware. They offer high security but can be expensive and less handy for frequent transactions.

Check out our complete list of the best crypto hardware wallets.

Software Wallets: Apps like MetaMask, MyEtherWallet, and Trust Wallet store your private keys on your device. These wallets are easy to use and good for daily transactions and using decentralized apps (dApps). However, they are more at risk from malware and phishing attacks.

Check out our complete list of crypto software wallets.

Paper Wallets: This involves printing your private keys and addresses on paper. It keeps them offline and safe from digital attacks but can be damaged or lost. They are not convenient for frequent transactions.

Best Practices:

  • Use strong, unique passwords for your wallets and enable two-factor authentication (2FA) if you can.
  • Keep your private keys secret and never share them.
  • Regularly update your software to protect against security issues.
  • Be careful with phishing attacks and avoid storing private keys online.
  • Always back up your wallet and avoid using public Wi-Fi when accessing it.

Best ERC-20 Tokens to Invest In

  1. Chainlink
  2. Polygon
  3. Uniswap
  4. Filecoin
  5. Wrapped Bitcoin

Check out our full list of best ERC-20 Tokens for more. 

Tax Implications of ERC-20 Tokens

ERC-20 tokens, like any other cryptocurrency, are subject to varying tax laws globally. 

However, they are usually treated as property, so you must pay capital gains tax when you sell or exchange them and make a profit. On the other hand, getting paid in crypto is usually taxed at ordinary income tax rates. To reduce your tax burden, you might consider holding your tokens for more than a year to qualify for lower long-term capital gains rates.

In the U.S. and most other jurisdictions, you must report all transactions involving these tokens, and not doing so can result in penalties. 

Check our in-depth country-wise crypto tax guides to learn about your country’s specific crypto tax laws, grey areas of crypto taxation, and how different transactions are taxed.

FAQ

How to buy an ERC-20 token?

To buy an ERC-20 token, first, set up an Ethereum wallet like MetaMask or Trust Wallet. Next, purchase some Ethereum (ETH) on a cryptocurrency exchange like Coinbase or Binance and transfer it to your wallet. 

Once you have ETH in your wallet, go to a decentralized exchange (DEX) like Uniswap. Connect your wallet to the DEX, select the ERC-20 token you want to buy, and trade your ETH for the token. 

After the transaction, the ERC-20 tokens will appear in your wallet. Always double-check the token’s contract address to avoid scams.

What is the best crypto wallet for ERC-20 tokens?

The best crypto wallet for ERC-20 tokens depends on your needs. 

For high security, hardware wallets like Ledger Nano S, Ledger Nano X, and Trezor are top choices. They keep your private keys offline, protecting them from hacks. 

If you prefer convenience and frequent transactions, software wallets like MetaMask, Trust Wallet, and MyEtherWallet are great options. They are user-friendly and integrate well with decentralized apps (dApps). 

How many ERC-20 tokens are there in total?

There are over 500,000 ERC-20 tokens in existence. 

Is Solana an ERC-20 token?

No, Solana is not an ERC-20 token. Solana is its own blockchain platform with its native cryptocurrency called SOL. 

Is dogecoin an ERC-20 token?

No, Dogecoin is not an ERC-20 token. ERC-20 tokens are specific to the Ethereum network, while Dogecoin has its own native cryptocurrency.

Is Polkadot an ERC-20 token?

No, Polkadot is not an ERC-20 token. Polkadot has its own blockchain, and its native cryptocurrency is called DOT. 

Is XRP an ERC-20 token?

No, XRP is not an ERC-20 token. XRP operates on its own blockchain, known as the XRP Ledger, and is the native cryptocurrency of that network. 

Is BNB an ERC-20 token?

BNB, or Binance Coin, originally started as an ERC-20 token on the Ethereum blockchain. However, it has since moved to its own blockchain, the Binance Chain. Now, BNB operates independently of the Ethereum network and is no longer an ERC-20 token.