Check out our step-by-step guide on earning interest from DeFi to learn more about commonly used DeFi Apps, notable stablecoins, a...
Here’s a cool guide by Chief R&D Officer at 482.solutions Alexander Ivanov about both: classic and most popular ERC token standards.
Why do we need token standards? In short, Ethereum is a decentralized platform on which smart contracts have been successfully operating since 2015, and their algorithms are written in the Solidity programming language. Ethereum Platform became a springboard for the blockchain industry development because it has given life to thousands of new projects and decentralized applications with their tokens.
ERC (Ethereum Request for Comments) token standards are designed to achieve specific goals in specific application types. Each of them has its own characteristics, functionality, and capabilities. ERC-20 has become a classic of its kind, and the ERC-223, ERC-721, ERC-777 and ERC-1155 standards are also very popular. In this article, we will deal with each of them, learn their features and scope.
It is worth starting with ERC-20, of course, because it is the first of its kind and it was implemented in thousands of various projects tokens.
It should be noted that this standard has six parameters for each smart contract and they are required. There are also three additional parameters that can be used at your discretion. Their use, though not mandatory, but you should pay attention to them.
Required parameters perform equally important roles, as they are used to define tokens and their transfer.
The ERC-20 standard is easily implemented and is ideal for attracting investment campaigns since the “totalSupply” function determines the total number of tokens.
In order for users who bought tokens to operate with them, “transfer” and “transferFrom” are used. “Transfer” transfers tokens from the campaign owner address to investors, but the “transferFrom” function is needed, to transfer by one address tokens that are in the possession of another address.
Consider “transferFrom” on an example where:
P – the address of the campaign owner;
K – campaign address;
C – address to which funds are to be transferred.
Using transferFrom, P indicates that he wants to send K tokens to account C. This function also checks whether the account K has allowed account P to manage its tokens and in what quantity.
With the following parameters, “approve” and “allowance” we also take a look at the example above.
“Approve” is used to allow account P to use the specified number of tokens on account K. For example, K allows P to use 300 tokens of his account. In turn, “allowance” displays the number of tokens allowed for use by another account. In practice, if you call a function for K and P, then the answer should be 300 (based on the data presented above).
Another parameter, “balance0f”, displays the balance at the requested address.
Thanks to such an optimized approach that takes into account each parameter, it was possible to create a whole ecosystem in which various tokens can easily interact with each other.
According to tradition, the first technologies are not always perfect, and the ERC-20 isn`t exception.
The main ERC-20 problem is the lack of tools for processing transactions.
For example, a project accepts only BTC, and the investor, inattentively reading the instructions for depositing funds, sends an equivalent amount in ERC-20 tokens to the project address instead of Bitcoin. As a result, the funds will not reach the investor, despite the fact that they will be written off from the sender’s address. Unfortunately, the tokens that fall under the ERC-20 parameter sanctions cannot be returned and they forever remain unclaimed.
Because of this vulnerability, more than $ 3 000 000 have become stuck and can never be used again.
Since it is not too difficult to write a smart contract, even a 14-year-old schoolboy will be able to release his token after reading a few topics on BitcoinTalk.
As a result, the contract is deployed, it receives funds and eventually, the contract is hacked, because all the so-called “schoolboys” do not worry about security at all, without checking smart contracts before launching or giving them to third-party audits. That is why it is always worth spending time but make sure the security, the reliability of the contract and the correctness of the code.
Implementation ease attracts also scammers to the ERC-20, who can create a website in a week, release their token, paint the “advantages” of a new asset and, after collecting investments, escape.
ERC-20 tokens are smart contracts that cannot be modified after they are launched. A prime example of this vulnerability consequences is the DAO project, in the code of which an error was detected and the network has undergone a massive hacking. Since it was impossible to eliminate the error, the developers had to conduct a hard fork in the Ethereum network.
ERC-223 is the next generation standard and fixes Problem 1, which is ERC-20 tokens characteristic. This standard functionality allows transferring tokens to smart contracts and wallets by one parameter, which also saves investors money on paying GAS when making a transaction.
The ERC-223 creators have thought over the moment with the ERC-20 tokens compatibility, which means that ERC-223 is also easy to implement and it is suitable for simply creating a digital asset. However, this is the only thing that positively distinguishes it from its predecessor. All other problems (Problem 2, Problem 3) remained unresolved.
ERC-721 tokens have many differences from their older brothers, but for the first time, they thundered on the entire community at the end of 2017 thanks to the cute CryptoKitties, who paralyzed the entire Ethereum network for some time. Tokens, smart contracts of which are written on the ERC-721 standard, can also be called uniqueness assets since within one project you can set different costs on them.
These tokens are called NFT (Non-Fungible Tokens) and they are able to permanently gain a foothold in the real sector. NFT-tokens are perfect not only for animals tokenization in games but also will be useful in the world of art, real estate and even in the document circulation processes. In fact, ERC-721 will find application in the area where authenticity is important.
ERC-777 is a bit like ERC-223, its developers also wanted to improve the classic ERC-20. Of course, these standards tokens are compatible with each other and problems with sending funds in the other assets form should not arise. However, the ERC-777 has several unique differences in the form of various transaction processing mechanisms.
For a complete the current picture understanding let`s consider the ERC-820 standard. According to this standard, the central registry of smart contracts operates in the Ethereum network, using it, anyone can check the address of the smart contract and find out what features it supports.
In the ERC-777, such a registry is also present, but the developers have significantly simplified the transferring tokens process. For example, instead of the usual “transfer” and “approve” parameters in the ERC-20, the send parameter appeared, which task is to transfer the usual ETHs. Moreover, in ERC-777, the term “approved operator” is used, which means a trust relationship to the smart contracts in the form of tokens transfer on their behalf.
Thus, ERC-777 offers new usage possibilities: for example, as a case for this standard implementation, we can consider the contract mixer creation, which will intermix transactions to achieve greater confidentiality. It also provides the ability to implement the function of restoring private keys and passwords in an emergency case. Another important ERC-777 function is the tokens burning by “approved operators”, it can be also very useful.
Separate attention deserves the latest Ethereum ERC-1155 token standard. The fact is that this standard was created to solve a variety of problems faced by both developers and users of blockchain games.
First of all, it solves the main issues of online games – secure items purchase/sale/exchange and uniqueness.
As an example, to prove the necessity of applying this standard, you can imagine a game where you are an elf, but you have found a very valuable item, for example, a warrior’s weapon. If this weapon is a blockchain asset, then you have the opportunity to exchange this item in another game that supports the ERC-1155 standard.
Thus, any game item can have its own characteristics in the form of damage, resilience, protection, etc., and also have their own value (like ERC20 tokens).
ERC-1155 also simplified the items sending, as it allows the simultaneous transaction of several digital items.
Thanks to ERC-1155, the gaming industry sees a safe future on the horizon, where players can conveniently, quickly, and honestly transfer and sell their digital assets.
An interesting question is maturing: can this standard come in handy in a different, non-gaming environment?
Theoretically, the ERC-1155 functions could be great for trading when there are many different products with different characteristics involved in the process.
However, before that, ERC-1155 should be run-in in the virtual world, and most game dev representatives have no doubt about it since its possibilities are capable of reshaping the relations between the parties that don`t trust each other and help to forget about the deceptions that are now often found in MMO games.
The Ethereum Platform is constantly growing and evolving. Every month developers from around the world post new smart contract codes describing thousands of new tokens on GitHub. Nobody can say that they are all good, however, by separating the wheat from the chaff, ERCs are able to pump our world.