ERC777 — Is the new token standard replacing the ERC20?5th June 2019
E X P L A I N E D
ERC777 — Is the new token standard replacing the ERC20?
The Ethereum ERC777 standard is ready to replace the ERC20 standard. What is the ERC777 and what are its advantages and disadvantages compared to the ERC20?
The ERC20 token standard is probably the most common and best known Ethereum technology standard. But now the ERC20 standard gets competition. The new ERC777 should solve the biggest problems of the ERC20. What is behind it?
Origin of the ERC20 standard
The acronym ERC stands for Ethereum Request for Comments. It is a topic within the Ethereum Improvement Proposals (EIP) repository, a collection point for improvement proposals.
This collection point is located on the Ethereum Foundation’s Github account.
Github is a web-based online service that allows developers from all over the world to work together on software projects.
ERC20 is the result of the twentieth improvement suggestion in the “EIP” repository. This was proposed on November 19, 2015, by Fabian Vogelsteller and Vitalik Buterin.
Due to the ERC20’s ability to quickly and easily create its own tokens based on the Ethereum blockchain, the ERC20 became the most popular and popular token standard in the following years. It contributed significantly to the Ethereum and ICO boom.
With more than 500 different Ethereum tokens using this standard, the cumulative market value is around 25 billion US dollars (as of 2018).
How does the ERC20 token work?
Basically, ERC20 is a template or standard for a Smart Contract on the Ethereum Blockchain, which stores addresses and the corresponding account balances.
In other words, the ERC20 token standard defines a list of basic functions and events that a token programmed on this standard must implement.
The developers of the token can use the standardized program functions and make their tokens transferable and usable.
The smart contract of this token standard usually defines the following details, which should inform the user about the token:
- The token name under which the token contract is stored.
- The token abbreviation, which mostly consists of 3–4 letters.
- The number of decimal places in which the token is stored.
- A list of the token holders and their token balances
- This standard specifies that the contract manufacturer can issue his own standardized tokens.
The total amount of available tokens is derived from the sum of the account balances.
The possibility to increase or decrease this amount is given by the token standard:
Either by the Smart Contract distributing new tokens (mint) or by the Smart Contract taking the tokens from the balance sheets and destroying them (burn). However, this depends on the code and rules defined in the smart contract.
The disadvantage of the ERC20 standard
The ERC20 tokens can be moved between the different Ethereum addresses. However, there is a fundamental difference to regular ether transactions on the Ethereum blockchain, because:
An ether transfer consists of a transaction field for the transaction amount and a field for additional data, the information field.
In the token transaction, however, the information about the number of tokens to be sent is in the second field. For this reason, transfers between the addresses of two parties are possible, but using the token as a trigger for a function of another Smart Contract does not work.
If a user sends a transaction to a Smart Contract and this is not recognized by the Smart Contract, the ethers from the transaction are irrevocably lost in this way.
The solution proposed by ERC20
The ERC20 tries to work around the problem of sending information in addition to the token transfer by splitting the process into two steps.
The first step is the approval ( ) function. With this, the user gives the ERC20 contract permission for a certain number of tokens to be debited from his address.
After the user has granted this permission, he can request another contract to execute the desired function. In return, the Smart Contract with the transferFrom( ) function asks the ERC20 token contract to transfer a specified payment from the user’s address to its own address.
It can, therefore, be seen that two transactions of the user are required. A clear inefficiency of the ERC20 token standard.
ERC777: An Advanced Token Standard
Although there are already attempts to resolve this inefficiency with the ERC223 and ERC677, none of the proposals are particularly successful.
The ERC777 proposal a new advanced token standard #777, made by Jordi Baylina, Jacques Dafflon, and Thomas Shababi, should now offer a new possibility to interact with a token contract. At the same time, the backward compatibility with an ERC20 Smart Contract shall be preserved.
Token like ether transfer
The first important innovation is the definition of a send() function. The token transaction now consists of an amount field and a data bit field and a similar operatorData field. Thus the parameters can be freely selected again by the token user and the token operator in order to forward data to the recipient.
The token can thus be used as the original ether.
ERC777 introduces Smart Contract Operators EIn
Furthermore, the ERC777 introduces “operators” instead of the allowance mechanisms.
“Operators” are trustworthy Smart Contracts, which can move amounts in the name of the user. They can be authorized or canceled by the users of the ERC777. Thus the token contracts can be improved afterward. This makes it possible to give the token system additional properties at a later date. These can be e.g. check processor, recovery services or membership payment manager.
Hook prevents lock-up
Using a tokenReceived Hook, it is now possible to control contracts as well as addresses for the receipt of tokens and to reject them if necessary. It enables the token recipient to automatically execute a code when a token arrives. If, for example, you accidentally send tokens to a Smart Contract address, they are not lost but can be automatically returned by the Smart Contract. This prevents the aforementioned inefficiency of the ERC20, where two transactions (approve / transferFrom) are required to send tokens to a contract.
Although the ERC777 replaces the functions transfer ( ) and transferFrom( ) with the functions send and operatorSend, all ERC20 functions (transfer, transferFrom, approve and allowance) can still be used.
Decimal places can also be implemented. Even if this is no longer mandatory in the ERC777, a token contract can implement both ERC20 and ERC777 in parallel. The read-only functions of both token standards also overlap without any problems.
ERC777 disadvantage: rising transaction costs
However, the gas costs are a small shortcoming. Jordi Baylina said on the DAppCon 2018 that these will probably be a little higher than with the ERC20. For him, however, this surcharge is marginal, considering all the additional functions and possibilities.
This statement has to be viewed with skepticism. After all, an increase in gas costs also leads to an increase in the transaction costs of simple token transfers. These currently account for the majority of all smart contract operations.
Currently, the ERC777 is in the last call and should be finalized in August 2018. After finalization, the creation of new token smart contracts according to the ERC777 token standard can begin. It remains to be seen whether the ERC777 will be able to replace the obsolete ERC20 as the most widely used token standard in order to herald a new era in the Ethereum universe.
ERC777 — Is the new token standard replacing the ERC20? was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.