The ERC-20 token is a generalized protocol that allows other tokens to be created “on top of” the blockchain. Tokens that meet these specifications are known as ERC-20 tokens (ERC stands for “Request for Comments” from Ethereum), and they are the most widely used standard in the cryptocurrency industry today for creating new tokens.
Why is the ERC-20 standard needed?
Before the ERC-20 standard, there were many compatibility issues between different forms of Ethereum tokens. Each token had a single smart contract. The platform had to write entirely new code for each transaction and wallet to add the new token to its network. Supporting a growing set of tokens was becoming overly problematic and time-consuming. As a solution, the platform offered a standard protocol for all the following tokens, now known as ERC-20.
What are the main benefits of ERC-20?
Time and resource savings. Tokens created using the ERC-20 standard benefit from the existing Ethereum infrastructure instead of having to create an entirely new blockchain for them;
Security. Creating new tokens increases the demand for Ether, which makes the entire network even more secure, i.e., less susceptible to a potential 51% Attack;
Compatibility. If all tokens created on the Ethereum network use the same standard, these tokens will be easily interchangeable and can easily work with other applications in the same ecosystem;
Greater liquidity. ERC-20 tokens are used as a working basis for most projects.
The ERC20 standard is defined by the following factors:
- name – used to give contracts and external applications the name of the token;
- totalSupply – this function indicates the total number of tokens in the blockchain;
- balanceOf – uses this function to find the number of tokens that have a set address;
- transfer – makes it possible to transfer token to other participants;
- transferFrom – transfers the number of tokens from one address to another;
- takeOwnership – this method is a withdrawal function that can be used when a user has received a certain amount of tokens and wants to remove them from another user’s balance. It specifies which account currently owns the token and which other account may take possession in the future;
- It allows the sender to withdraw amounts from their account more than once. That is, it is a confirmation;
- allowance – Returns the amount that the sender is still allowed to withdraw.
In addition to standard methods, ERC-20 tokens can be configured to include the following features
Automatic Buy and Sell. It becomes possible to link the value of a token to the price of another token, creating a fund that automatically buys or sells tokens to maintain a balance.
Automatic replenishment of the balance. Transactions in the Ethereum blockchain require payments to miners. It is possible to program your token to automatically recharge for future transactions if it falls below a certain level.
Freezing tokens. You can freeze tokens belonging to the user and unfreeze them if necessary.
Since most new projects use this standard, most wallets support ERC-20 standard. The set of features and events of the ERC-20 standard ensures that tokens of different types will function normally in the same way anywhere in the Ethereum system. This means that almost all wallets that support Ether are also compatible with ERC-20.