Token Standards

in #bankex7 years ago


A lot of blockchain companies issue tokens with different functions which depend on the token standard. In this article, we will explain what token standards are and how they differ from each other.

What is an ERC-token standard?

Tokens are issued under different standards, such as ERC-20, ERC-223, ERC-621, ERC-721, ERC-827, among many others. ERC stands for Ethereum Request for Comments. Request for Comments (RFC) is a directive that contains technical and organizational information about the Internet. It follows that ERC is the Ethereum adaptation of the original RFC. ERC standards are created by the Ethereum community to define the rules of interaction between the users of the Ethereum ecosystem. From time to time developers create new ERC standards which need to be approved by the Ethereum community.v

ERC-20

ERC-20 is the most common and well-known Ethereum standard. The development of ERC-20 began in 2015, and by September 2017 was completely formalized. Tokens issued under the ERC-20 standard can be transferred to different addresses and exchanged for other currencies. It even allows tracking of the token owner and the number of tokens.

The ERC-20 standard facilitates the compatibility of tokens with new products and services, and even provides the ability to vote.

Here is an interface and functions of the ERC-20 token standard:
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
Here are the primary functions which must be implemented in every ERC-20 compatible functions:

— function totalSupply() shows total token amount;

— function balanceOf(address tokenOwner) shows the balance of token owner’s account;

— function allowance(address tokenOwner, address spender) public constant returns (uint remaining) shows the amount which address spender still can withdraw from the tokenOwner;

— function transfer(address to, uint tokens) transfers an amount of tokens to address;

— function approve(address spender, uint tokens) public returns (bool success) allows address spender to withdraw some tokens;

— function transferFrom(address from, address to, uint tokens) public returns (bool success) transfers a value from one address to another address.

These last two functions trigger two events: event Transfer and event Approval.

If contract contains all necessary functions it is called ERC-20 compatible. But actual realizations could be extended.

The example of such extention is ERC-223.

ERC-223

The ERC-223 token standard was created in March of 2017, and works correctly with every ERC-20 function, contract, and service. It’s an upgraded version of ERC-20 that addresses the most significant ERC-20 disadvantages.

For example, if you mistype an address and transfer your ERC-20 tokens to a contract address that is unaware of or doesn’t work with sent tokens, your tokens will be lost forever. The ERC-223 standard prevents this, while consuming half of the gas of ERC-20 transfers.

ERC-621

ERC-621 was proposed in May of 2017 and is another upgrade to the ERC-20 token standard.

https://github.com/ethereum/EIPs/pull/621

ERC-20 does not allow token supply amount to be changed, but ERC-621 solves this issue by enabling changes with the help of two additional functions: increaseSupply and decreaseSupply.

ERC-827

Another expansion to the ERC-20 token standard is ERC-827 which was proposed in January 2018.

https://github.com/ethereum/EIPs/issues/827

If we imagine ERC-20 as the Bitcoin among token standards then ERC-827 acts as an Ethereum. It took only 30 lines of code to improve ERC-20 and create the ERC-827 token standard. Now, with the help of ERC-827, it is possible to transfer values, data and let third parties spend tokens with the holder’s permission. Here is the code which makes ERC-827 one of the most advanced token standards:

ERC-721

In contrast to the ERC-20, ERC-223, and ERC-621 standards, we have the ERC-721 standard, proposed in September 2017. Tokens issued under ERC-20, ERC-223 and ERC-621 standards are fungible. This means that they are of the same type and are interchangeable during their exchange or utilization. But tokens issued under ERC-721 standard are non-fungible. They are distinct, and every ERC-721 token even has unique attributes.

ERC-721 token standard reminds one of the CryptoKitties game, where players buy, sell, trade and breed electronic cats. Each cat has a specific value in cryptocurrency, which depends on the cat’s particular characteristics. The ERC-721 token is tradeable on any exchange, but its value is calculated by its exclusiveness, just like the crypto kittens.

Here is the code of ERC-721 token standard:

https://github.com/ethereum/eips/issues/721

In the end, the best practice is to follow the reference implementations of contrancts:

https://github.com/OpenZeppelin/openzeppelin-solidity

which are constantly subjected to audits. Ill-considered extension of contracts may result in unfortunate consequences. For example, the recent case of the BEC token shows how the addition of just one untested function led to disaster:

https://medium.com/@peckshield/alert-new-batchoverflow-bug-in-multiple-erc20-smart-contracts-cve-2018-10299-511067db6536

In this article we identified the most popular token standards: ERC-20, ERC-223, ERC-621, ERC-827 and ERC-721. The majority of them are upgrades to the ERC-20 token standard, and only ERC-721 has a different structure.

BANKEX is available at:

Website — Telegram — Twitter — Facebook — Bitcointalk — Youtube — LinkedIn — Reddit — GitHub — Steemit

Coin Marketplace

STEEM 0.21
TRX 0.26
JST 0.040
BTC 101120.17
ETH 3683.12
USDT 1.00
SBD 3.16