If you are following Ethereum, you might have heard about “ERC20.” The ecosystem of Ethereum blockchain is on the basis of tokens where you can sell, buy and even trade them. Among them, ERC20 tokens are one of the popular ones. In today’s article, we will focus on answering one of the famous questions, “What is ERC20.”
Startups, especially, are taking advantage of the ERC20 token. Many startups are also successful in raising millions of dollars through token sale. However, that’s not the focus of our article. We are here to understand how ERC20 works and its role in the Ethereum blockchain.
Enroll Now: Ethereum Development Fundamentals Course
What Is ERC20?
Well, one of the significant Ethereum based tokens is the ERC20. Not only is it a token form, but it also represents a set of standards for digital tokens. Mostly, this token is for smart contract implementation and covers a set of rules that all Ethereum based platforms need to follow.
In simple terms, it’s a bit similar to other cryptocurrencies such as Bitcoin, Ether etc. However, you need to understand Ether and ERC20 are not the same things. In reality, Ether is the native currency of the Ethereum platform, but ERC20 is a standard for a specific token type. So, others can use this standard to create more ERC20 tokens, and they will all have different token names.
More so, in order to use ERC20 tokens, your platform needs to have an Ethereum base. So, you can’t use this token in another platform such as Hyperledger Fabric as you can only issue it on Ethereum.
Also, this token standard is specifically for Fungible Tokens; it won’t offer any non-fungible tokens standards. Therefore, you can exchange one unit of ERC20 token with another ERC20 token.
On the other hand, ERC20 smart contract will use this token to initiate the payment. Therefore, you will get paid in ERC20 in any smart contract.
The Co-Relation to HTTP Protocol
ERC20 is neither software, a solution or code. It is a standard protocol, just like HTTP. It governs the tokenization and ensures that the technical specification of the tokens is meet. If a token doesn’t meet standardization, it won’t be called an ERC20 token. If it does, it can be termed as “ERC20 token.”
To ensure that it works as intended, it contains basic functions. If the essential features are not implemented, they will not pass the standardization test. This will mean that it cannot be traded or listed on exchanges as well.
All the tokens that are created don’t need to have their blockchain. They can thrive on the Ethereum blockchain, and this is what makes ERC20 so promising and useful.
ERC20 Standard Rules
If any smart contract wants to use the ERC20 token, then it needs to follow some rules or ERC standards accordingly. In other cases, if you don’t follow the rules, then it won’t be suitable to call it an ERC 20 token. At present, there is a total of 9 rules, where 6 rules are mandatory, and the other 3 are optional rules.
Therefore, for an ERC20 contract, you need to follow at least 6 mandatory rules. Let’s see what these are –
- Token Name
- Decimal (Max: 18)
The Optional Standards
Let’s start with the optional standards. Usually, when you create your very own ERC20 token list, you’ll see that it’s quite important to have a name or identity associated with that token. However, it’s not necessary for you to name them, still associating identity with any token is great for using it within a community.
So, this is where “Token Name” rules come into play.
Next, we have divisibility. In reality, it’s actually quite important as it will ensure the lowest value for your token. If the divisibility is 0, then it will mean 1; if it’s 2, then the lowest value will be 0.01. Here, you are allowed to go up to 18 decimal places. So, in times of tokenization you need to remember this attribute for it.
Lastly, we have the symbol. Well, it’s mostly for creating a brand value using catchy symbols. For example, DogeCoin has the symbol “DOGE,” but mostly, it’s popular with DogeCoin. So, you see, you may not always need a symbol for your coin.
The Mandatory Standards
Well, the totalSupply mainly outlines the overall number of ERC20 tokens you want to create. In order to create the token, you first have to determine the total amount of supply of this token. By no chance can you just make up your own token on the go because that will significantly affect the value of these tokens.
The approve function helps to get rid of any counterfeiting of tokens. Here, once the contract owner checks the balance, he/she can approve the contract to collect the money. This approve function will also check whether the number is correct compared to the total supply of tokens. So that, it’s impossible to ever counterfeit tokens. If this function finds any discriminates within the numbers, then it will discard the payment and the smart contract.
This function is specifically for returning the total number of tokens any address has. In reality, it acts as user info, so if you have initially created some token and send it to other addresses, you can use this to check how many tokens you have left.
This transfer function is basically for automating certain transactions. For example, maybe you have to pay someone every month the same amount or pay rent and bills. Therefore, you can use transferFrom to automate these payments at a certain date and time.
The next function is transfer. After checking whether the user has enough token to transfer, the owner can use this function to send the tokens to another address. More so, this acts like a typical crypto transaction in other blockchain platforms.
The allowance function is the most important one. In reality, when the contract wants to carry out a transaction, it needs to see the balance of the Ethereum smart contract to understand whether the user has the minimum balance for that. Using the allowance function, the contract can carry out the transaction or even cancel it.
Here’s a comparison of ERC 20 vs ERC 223 vs ERC 777 standards to help you understand their differences.
If you want to use ERC20 tokens, then you need to know about ERC20 wallets as well. In reality, these are digital wallets that will store and keep all of your tokens. Obviously, you don’t want anyone getting access to the tokens, so using a wallet is always the best practice here. More so, you can also use ERC20 wallet to connect to other platforms and buy and sell items where blockchain is supported.
But before setting up an account in the wallet, you need to make sure that the ERC20 wallet supports your tokens. There are many wallets that developed just to store these tokens. Some of these are –
- Mist Wallet
- Trust Wallet
- Coinbase Wallet
More importantly, you can also use these wallets to store NFTs, as many of them support storing non-fungible tokens or digital assets.
ERC20 Wallet Address
While using this token, many are often confused about the wallet address. Typically, the ERC20 wallet address is an Ethereum address. More so, all Ethereum addresses are compatible with storing ERC20. Also, all Ethereum wallets are actually connected to the Ethereum blockchain.
Therefore, the ERC20 address will mean an address in the Ethereum platform. But do remember that the wallet provider needs to ask for permission in order to access or even check your balance from your wallet. On the other hand, sometimes, the ERC20 address will only support this type of token. It’s best not to limit yourself with one particular token.
If you really want to have a wallet that will keep all of your tokens safe, then create choose a wallet that supports other types of tokens as well. In reality, it will give you the option to convert your tokens with other ones.
Also, this wallet and ERC20 address are solely your custody, which means that you will have to keep it safe. In most cases, every wallet gives random special words for you to use in case you have lost your password. You need to store it somewhere safe.
Benefits of ERC20 Standard
There are many benefits of the ERC20 standard. It makes it possible for developers to develop DApps on the Ethereum blockchain. It also helps streamline the whole standardized process. To get a better view, let’s list the benefits below.
- Token implementation becomes easy for blockchain developers.
- There is a standard protocol to maintain and follow.
- ERC20 tokens offer high liquidity.
- Smart contracts ensure that transactions are risk-free.
Flaws of ERC20 Standard
transfer Function Bug
Well, these tokens have their fair share of positive qualities, but they also have some critical bugs that you need to know about. Usually, in Ethereum, there are 2 types of accounts contract accounts and externally owned accounts. So, when you are trying to interact with another externally owned account, you can simply use the transfer function to send tokens. But when its contract account using the transfer function doesn’t work accordingly, and you may likely lose money.
But how? Well, when you are using this blockchain protocol to send money to a contract, the recipient isn’t notified of the funds. So, they can’t recognize it, and it will lead to the token being stuck within the contract where no one can use it. That’s why you need to use approval + transferFrom functions. But, using these two can also lead to double-spending.
Low Entry Point
Well, anyone can make tokens using these standards. There is no restriction on who can make it and who can’t. As a result, many people are creating needless tokens that are flooding the market unnecessarily, and in many cases, creates scam token to raise money.
ERC20 is one of the best blockchain protocols. It governs thousands of tokens on the Ethereum blockchain. Also, it is developer-friendly. Anyone can create an ERC20 token and release it on the blockchain. ERC20 can also be defined as a way to develop utility tokens for a DApp. All these dynamics lead to issues if you are an investor and are looking to hold tokens for yourself. So, we recommend you be cautious while investing in any tokens. Also, you can enroll in our Ethereum development course to further understand these tokens. Proper research can save you a heartache later on!