What is ERC-20, what are its main advantages and how to store such coins correctly
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 Ethereum's Request for Comments) and today they are the most widely used standard in the cryptocurrency industry for creating new tokens.
Why do you need the ERC-20 standard?
Before the advent of the ERC-20 standard, there were many compatibility issues between the various forms of Ethereum tokens. Each token had a single smart contract. The platform had to write completely new code for each transaction and wallet in order to add a new token to its network. Maintaining a growing pool of tokens was becoming overly problematic and time-consuming. As a solution, the platform proposed a standard protocol for all the following tokens, which is now known as ERC-20.
What are the main benefits of ERC-20?
- Saving time and resources. ERC-20 tokens benefit from the existing Ethereum infrastructure instead of creating a completely new blockchain for them;
- Security. The creation of new tokens increases the demand for Ether, which makes the entire network even more secure, that is, 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 of the same ecosystem;
- Great liquidity. ERC-20 tokens are used as a working basis for most projects.
The ERC20 standard is determined by the following factors:
- name – used to indicate the name of the token to contracts and external applications;
- symbol – helps ensure its compatibility with the ERC20 standard and provides external programs with its abbreviated name;
- totalSupply – this function indicates the total number of tokens in the blockchain;
- balanceOf – using this function, you can find the number of tokens that have a set address;
- transfer – makes it possible to transfer the 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 is currently owned by the token and which other account may take ownership in the future;
- approve – Allows the sender to withdraw amounts from their account multiple times. That is, it is a confirmation;
- allowance – Returns the amount that the sender is still allowed to withdraw money.
Expansion of functionality
In addition to the standard methods, ERC-20 tokens can be configured to include the following features:
- Automatic buying and selling. It becomes possible to link the value of a token with the price of another token by creating a fund that automatically buys or sells tokens to maintain balance.
- Automatic balance replenishment. Transactions on the Ethereum blockchain require payments to miners. It is possible to program your token to automatically recharge gas for future transactions if it falls below a certain level.
- Freeze tokens. You can freeze tokens owned by a user and unfreeze them if necessary.
Since most new projects use this particular standard, most wallets support the ERC-20 standard. The set of functions and events of the ERC-20 standard ensures that tokens of different types will function normally the same anywhere in the Ethereum system. This means that almost all wallets that support Ether are also ERC-20 compatible.