This page may contain legacy content

To get our most up-to-date content please access our documentation

November 9, 2021

ERC20 – Exploring the ERC-20 Token Standard

Table of Contents

Thanks to the popularity and programmability of the Ethereum chain, we’ve seen countless tokens emerge based on the ERC-20 token standard. As such, there are currently over 450,000 ERC20 token contracts, according to Etherscan. We must agree that this number is totally insane; however, you should also keep in mind that new tokens are still created daily. The increase of ERC20 tokens is not a surprise as numerous programmers are converting to Ethereum development. Therefore, for those who just started their blockchain journey and would like to explore the ERC-20 token standard further, this article will prove to be beneficial as it will expand your ERC20 knowledge.

If you’ve been wondering what ERC20 exactly means, you came to the right place. Herein, we will explore the ERC-20 token standard in depth. As such, we will answer, “what is ERC20?”, “what does ERC20 stand for?” and even “how to create an ERC20 token?”. When it comes to the latter, the quickest and by far the simplest way becomes available when you create your free Moralis account. Since Moralis is the ultimate Web3 development platform, creating ERC20 tokens is just the beginning.

For instance, with Moralis Speedy Nodes, Moralis’ SDK, and its ultimate Ethereum API, the process of deploying tokens, including NFTs (ERC721 and ERC1155), and development of all sorts of cross-chain operable dApps become straightforward. Moreover, Moralis’ platform is essentially Firebase for crypto, meaning that it provides all the necessary tools needed to create phenomenal dApps (decentralized applications). Furthermore, you may also use the best Ethereum dApp boilerplate and have your next dApp ready in record time.  

Exploring the ERC-20 Token Standard – Prerequisites 

Before we can discuss the ERC-20 token standard, we need to cover some basics. As such, let’s answer the question of “what are crypto tokens?” first. For one, these days, we have fungible and non-fungible tokens. As these two economic terms depict, fungible tokens are the ones that are interchangeable. Thus, one token of the same kind is essentially the same as the other token. On the other hand, non-fungible tokens, or NFTs, incorporate uniqueness, which means that there are no two or more tokens alike. 

Furthermore, crypto tokens can represent all sorts of things, both from the digital and physical world, and can be assigned with different kinds of functionalities. Essentially, they are digital assets, also known as cryptocurrencies. Moreover, we must point out that while most people refer to all cryptocurrencies as tokens, this is not technically correct. For instance, cryptocurrencies such as ETH, BTC, AVAX, SOL, just to name a few, are native currencies to their respective blockchains and are known as coins or as native tokens.

However, cryptocurrencies created on top of those blockchains (projects that do not have their own blockchain) are referred to as tokens. As you can imagine, it is a lot easier to create a token on an existing blockchain than to create a native crypto coin. The latter would evidently require you to develop your own blockchain or at least fork an existing one, which requires a lot more advanced blockchain development skills.

What is ERC20?

ERC20 is the most popular token standard. It is a standard for fungible tokens, ensuring that all tokens have the exact same qualities. Essentially, all ERC20 tokens follow ETH’s native token (or coin) specifics on the Ethereum chain. Moreover, thanks to their fungible nature, one particular ERC20 token will always have the same standards as all other ERC20 tokens of the same kind (using the same contract address). 

The ERC20 standard is also referred to as the “ERC20 contract”. That’s because this technical standard is implemented by smart contracts. As such, the ERC20 smart contract standard is used for all smart contracts on the Ethereum chain for fungible token implementation. Moreover, since smart contracts are essentially predetermined conditions or rules that must be obeyed for a certain action to take place, the ERC20 contract standard ensures that proper rules are imposed when ERC20 tokens are created. Furthermore, as long as a smart contract implements the rules or methods required by the ERC20 standard, it essentially is an ERC20 contract.

Using ERC20 contracts, developers can accurately predict how their new ERC20 tokens will function within Ethereum’s ecosystem. This makes things a lot simpler for developers, knowing that all tokens they deploy will function as planned as long as they follow those predefined rules. Additionally, due to the nature of smart contracts, those rules will be implemented automatically. Essentially, the ERC20 contract implements an API for fungible tokens on the Ethereum chain.

There are many well-known cryptocurrencies using the ERC20 contract standard. These including “Maker” (MKR), “Basic Attention Token” (BAT), “Augur” (REP), and “OMG Network” (OMG), just to name a few. 

What Does ERC20 Stand For?

If you’ve covered the details of the previous section, you should now be able to answer “what is ERC20?”. However, we still haven’t told you what ERC20 stands for. ERC20 stands for “Ethereum Request for Comments 20”. The latter was proposed by Fabian Vogelsteller back in November 2015. As you can see, going with the abbreviation of “ERC20” is just way more practical than using the full and quite lengthy definition. 

ERC20 Standard Rules

Every ERC20 contract is defined by the contract’s address and the total supply of tokens available to that address. However, it also has some optional components. Therefore, the latter also tends to be provided in order to offer more details to users. The optional components of ERC20 contracts include the name, symbol, and the number of decimals of the token. Let’s sum up the ERC20 details:

  • The contract address (essential).
  • The total supply of tokens (essential).
  • The token name (optional).
  • The token symbol (the ticker [optional]).
  • The number of decimals for the token (optional).

It’s important to keep in mind that there is no “central registry” for token contracts, which means that the uniqueness of a particular token name or symbol is not guaranteed. Moreover, some of the best registries we have are popular sites such as CoinMarketCap, Etherscan, and MyEtherWallet. Thus, users should ask for their token contract to be added to those sites after creating it.

Aside from covering the required and optional details, the ERC20 contract also ensures a set of particular functionalities. Here are the most common functionalities that the ERC20 token contract provides:

  • Transfer tokens between different accounts.
  • Get the current token balance of a particular account.
  • Get the total supply of the token available on the network.
  • Approve whether a third-party account can spend several tokens from a particular account or not.

ERC20 Contract Items

We’ve listed the required and optional details above. Let’s now look into each of the optional items a bit closer. As far as the name and symbol go, things are straightforward; however, proper understanding is quite essential regarding decimals. A decent understanding of these components is important because you cannot change these details once you deploy the token contract.

ERC20 Contract – Name

The name of the token contract is rather straightforward, and it is the long name by which the token contract should be known. For example, let’s say the name of our example ERC20 contract would be “Our Example Token”. As far as the length of the name goes, there are no restrictions. However, developers should keep in mind that many wallet applications will shorten long names. As such, it is better to go with a more concise name.

ERC20 Contract – Symbol

A token contract’s symbol refers to the token’s ticker, similar to a ticker for a stock on Nasdaq, for example. This is what most people will recognize the token by. Following our example name (“Our Example Token”), the symbol that would make the most sense would be “OET”. Just like the name, the symbol also has no restriction on its size; however, most tokens have three or four characters. Even though many projects choose the symbols based on their token name’s initials, there is no rule regarding that matter. As such, the name and symbol can be unrelated.

ERC20 Contract – Decimals

When it comes to decimals with the ERC20 contract, there tends to be a lot of confusion. However, there’s no need for that as the gist of it is pretty easy to understand. All in all, decimals determine how divisible a token can be. This component can be set to zero (not divisible at all) or to eighteen (as divisible as it gets). Moreover, if required, the number of decimals can be even higher than eighteen; however, this is rarely the case. As such, developers must decide in advance how many decimals they want their ERC20 tokens to have. When the latter is considered, it is important to consider the tokens’ use case. 

For instance, let’s say a token will serve as a software license assignment for a particular piece of software. In that case, owning a fraction of that token would mean holding a fraction of a license, which makes no sense. Thus, going with zero decimals would be the way to go for a token of that nature.

On the other hand, let’s consider a token that would represent ownership of physical gold. Furthermore, let’s assume that the token creators decide they want the unit of their token to represent one kilogram of gold. In addition, let’s presume they’d want their token holders to hold and trade no less than one gram equivalent of gold. If that were the case, they’d go with three decimals (1 g = 0.001 kg). 

Considering the two examples, you can see that choosing the number of decimals is easy to determine when considering the unit of the token’s value. If fractions of the unit make sense, it is good to use this as guidance: the higher the value of the unit, the larger the number of decimals.

How to Create an ERC20 Token?

At this point, you know that to create your own ERC20 token, you need to work with a smart contract. Of course, you can always create your own ERC20 contract in alignment with the general guidelines of the ERC20 standard; however, there is a much quicker and simpler way. These days, many open-source platforms provide you with all sorts of code templates, including smart contracts. For instance, you can visit OpenZeppelin to obtain an ERC20-related contract template. You can further simplify things by using a powerful tool such as Remix to deploy your tokens. 

You’ll also need a code editor (such as Visual Studio Code), a node, and a way to authenticate (Ethereum authentication) your on-chain transactions. Fortunately, you get to cover your node needs with Moralis Speedy Nodes. Moreover, authentication is straightforward because Moralis integrates MetaMask by default.

With all these tools at your disposal, you can create your own ERC-20 token in minutes, and the process starts by completing these four steps:

  1. Set up a Moralis Speedy Node.
  2. Import an OpenZeppelin package/add a pragma line.
  3. Create a token contract.
  4. Test if the contract is working correctly.

If you would like to watch an in-depth video showing how to accomplish these steps in detail, make sure to watch the following video:

https://youtu.be/KNBneUpFaGo

ERC20 – Exploring the ERC-20 Token Standard – Summary

Knowledge is power, and you now know more than enough to use ERC20 tokens properly. Throughout this article, you’ve learned the basics of crypto tokens, the difference between tokens and coins, and several details about the ERC20 contract. For instance, you know which details are essential and which aren’t when deploying ERC20 contracts. Moreover, you know that names and symbols of the ERC20 tokens are not essential yet highly recommended. Furthermore, according to your project’s specifics, you’ve learned about decimals and how to set them up properly. In addition, you’ve been given an overview of the steps and tools required to create your own ERC20 token in minutes. With all that, you’re equipped to take on your own Ethereum development projects. 

Aside from creating fungible tokens on several leading chains, including Ethereum, BSC, Avalanche, and Polygon, you can use Moralis to take on all sorts of blockchain development challenges. Since NFTs are all the rage right now, you may want to develop your own NFT marketplace or simply create an OpenSea clone, or learn to generate and mint NFTs. Moreover, the time to build your first dApp has never been better, and with Moralis on your side, you can create a DeFi dashboard in five simple steps. Furthermore, by developing with Moralis’ help, you will not be limited to a single chain as it has cross-chain interoperability built in its foundation. That way, you can start by creating Ethereum dApps first and then deploy them to other chains with a few simple clicks.  

If you want to become a blockchain developer, we recommend checking out the Moralis YouTube channel and the Moralis blog, where you will find a ton of free valuable content. Moreover, you may want to consider enrolling in Moralis Academy

Moralis Money
Stay ahead of the markets with real-time, on-chain data insights. Inform your trades with true market alpha!
Moralis Money
Related Articles
January 29, 2023

Fantom Testnet Faucet – How to Get Testnet FTM from an FTM Faucet

November 5, 2022

Web3 for Business – How and Why You Can Integrate Web3 Into Your Enterprise

November 1, 2022

Web3 Infrastructure – Exploring the Best Solution for Web3 Development

November 11, 2022

WalletConnect Integration – How to Integrate WalletConnect

December 13, 2022

Ethereum Web3 API – Exploring How to Use a Web3 Ethereum JavaScript API

November 7, 2022

Crypto Wallet Integration Using the Best Crypto Wallet API

December 2, 2022

Full Guide: What is Ethers.js?

January 16, 2024

How to Create a BSC Token with Remix IDE