24 July 2020
Ethereum has different tokens to make transactions in the Ethereum network. These tokens represent digital assets or tangible objects through its Smart Contracts. The developers have created an ecosystem with mechanisms to optimize every single task. One of those mechanisms has created the possibility of a new token.
Those are the ERC-20 tokens.
What is an ERC-20 token?
ERC-20 tokens are blockchain-based assets. They are one of the most important tokens in the Ethereum ecosystem. They were proposed by Fabian Volgester and Vitalik Buterin in 2015.
ERC-20 tokens are Smart Contracts that are executed on the Ethereum blockchain. Its primary purpose is to ease sales, purchases, and exchanges in the Ethereum network.
Upon its conception, Ethereum developers were looking for a tool that would allow them to create a multi-capacity system. To do so, they would need a standard interface to continue adding new functions to the network. This is where ERC-20 tokens entered the game.
Ethereum’s flexibility and interoperability allowed for the creation of new tokens, which are highly compatible with the Ethereum network. Also, it reduced the complexity of programming since they support various programming languages such as Java, Solidity, and Python.
How do ERC-20 tokens work?
As previously stated, ERC-20 tokens are Smart Contracts. They work within a programmatic framework that the Ethereum developers set. All this is done without interrupting the blockchain. Its main use is to standardize the interface for creating and issuing new tokens on the network.
The ERC-20 command defines a standard list of rules that each Ethereum token needs to follow. This way, developers do not need to worry about changes in the network when a new token project is released.
They will predict the behavior of the new token and continue their work. Also, they offer transparency and security to the user throughout the transaction.
ERC-20 Optional and Mandatory Rules
The ERC-20 standard has a list of rules: 3 optional rules and 6 mandatory rules. The three optional rules are about the identity of the token. Users can choose the token name, its symbol, and the token decimal numbers. With that said, there are 6 mandatory rules that must be followed:
- Total Supply: users need to identify the total number of ERC-20 tokens created. This is how developers can determine how many tokens are in the network.
- Balance of: this function counts the number of tokens that the contract owner has in their account.
- Approve: the contract owner gives their approval to the user. This will give the required number of tokens from the contract’s address. All this is done after verifying the balance. The user ensures that the correct amount of tokens is transferred to the receiving address.
- Transfer: This function works as a conventional cryptocurrency transaction. The contract owner sends the total tokens to the address of the other party in the contract.
- Transfer From: This lets the contract owner automate the payment and send it to a specific address. It serves to avoid problems during the transaction.
- Allowance: This evaluates if the user has enough tokens to perform the transaction. If the user does not have the least required number of tokens, the transaction is canceled.
Pros and Cons of ERC-20
Moreover, users can custom some functions. They can link their native token with others or with other currencies. This allows them to create a buy or sell the funds to keep the balance in the account. Also, users can recharge their “gas”, the miners’ reward. Like with any other invention, ERC-20 has some problems that could lead to the loss of money if the user is not careful.