Understanding Ethereum Token Formats

Over time, blockchain increasingly penetrates into our lives, and it becomes necessary to understand its main technologies, including the work of decentralized applications (dApps). Most dApps are currently created on Ethereum, the capabilities of which are much more flexible than issuing the usual ERC20 tokens.



Why standards are needed



Inside the smart contract ( what is it? ), You can write the unique mechanics of the token. It will work, but other developers (and smart contracts) will not be able to access it using generic logic.



Example: you created a token for a game item (decentralized gaming is actively developing now) and you want it to be able to trade on marketplaces for in-game items (something like that ). But marketplaces don't know how to access functions within your contract, they need a separate smart contract to support your token.



Standards come to the rescue. Knowing how to interact with them, the creators of other dApps have put in the code everything you need to work with a token on a certain standard.



How standards come about



Ethereum is an open-source project (by the way, ERC is Ethereum Request for Comments), so it is logical that any user can propose a new token standard. If the standard solves some important problem, then it can become the official Ethereum standard (that is, get on this list) .



Fungible and non-fungible tokens



The starting point for classifying token standards is their interchangeability or lack thereof. Fungible tokens are equal to each other and can be used as currency. Semi-fungible (half-fungible) tokens are almost indistinguishable from each other, but still unique (for example: tickets in a cinema, the cost may be one, but each has a unique place) . Non-fungible (non-fungible) tokens are completely unique, a tokenized object in a single copy (example: copyright objects) .

image

If you don't recognize the kitten, then this is one of the first games on Ethereum (and the ERC-721 standard), CryptoKitties .



ERC-20



The most famous standard for fungible tokens is ERC20, which was proposed by the author of the Ethereum idea Vitalik Buterin back in 2015. This token is widely used for various types of initial offering (first proposal). I avoid the terms ICO and IEO, because now these are far from the only ways to conduct a public offering of tokens (but this article is not about that).



Specificity: an interchangeable standard, there is a ticker for exchanges, divisible (the number of decimal places is determined by the creator of the smart contract), must have a total supply (the number of tokens that cannot be issued more).



A lot has already been written about ERC-20 ( habr ), I'm moving on to other standards.



ERC-721



This standard is widely used to create unique tokens. Land in Decentraland , Binance Collectibles , here are examples of ERC-721.



ERC-721 was proposed as an EIP (Ethereum Improvement Proposal) by Dieter Shirley in 2017, became official in 2018.



Specifics: not an interchangeable standard, no ticker, indivisible, necessarily exists only in a single copy.



ERC-721, like ERC-20, is widespread, so I will not dwell on it.



ERC-777



This format is an "improvement" of the familiar ERC-20. It is backward compatible with ERC-20, but has several advantages:



  • when exchanging tokens, it uses one transaction instead of two in ERC-20;
  • automatically cancels transactions for incompatible contracts;
  • the ability to mark unreliable addresses;
  • the ability to appoint operators (addresses that have the right to send tokens from another address);
  • accelerated transactions.




ERC-223



Also an "enhancement" to ERC-20, preventing the sending of transactions to random contracts. If the smart contract does not have functions for working with tokens, then they are returned to the sender.



picture: mywishplatform



ERC-1155



The idea for this standard was proposed by the developers of the Enjin project in 2018. Enjin is a project that aims to simplify the creation of games on Ethereum. Therefore, the standard proposed by them should first be considered as a game standard, although its application is not limited to this.



Specificity:



  • allows you to issue multiple tokens in one contract;
  • tokens in one contract can be fungible and non-fungible at the same time;
  • supports atomic swaps;
  • supports "batch" transactions;
  • not all transactions need to wait for the end of the block.


If the first two points are clear, then the third and fourth can raise questions. First, let's take a look at atomic swaps.



Atomic swaps



One of the reasons for the rejection of the blockchain everywhere is the inability to quickly and efficiently (in terms of fees) exchange one token for another (and the number of different tokens is increasing all the time). The solution to the problem has already been created - these are atomic swaps. Usually, Atomic swaps are understood as the technology of decentralized exchange between cryptocurrencies of different independent blockchains ( it is well written about this on BitcoinWiki ). But it is also worth considering atomic swaps in the context of exchanging tokens within a smart contract.



An image from the Enjin blog illustrates a multiple token swap using the ERC-1155 standard.

Photo from Enjin blog



And batch transactions, although they do not save time, but they save gas ( what is this? ) By writing several transactions to the network as one.

Photo from Enjin blog



It is worth mentioning that although ERC-1155 has become more widespread, it borrowed a lot from the ERC875, which appeared a few months earlier. ERC-875 offered the same functionality besides supporting fungible tokens.



ERC-865



A standard similar to ERC-20, but uses not gas for commissions, but the tokens themselves. Due to the complex gas commission payment system (the gas price is chosen independently), and sometimes the unpredictability of the commission size, such an improvement can be very useful for accepting tokens on Ethereum.



Links



I have not considered all the standards, but if we talk about all ERCs, then they are mostly similar to each other, and offer either a solution to ERC-20 problems, or an application in some separate niche. If you want to read the code in detail: Github EIPs , Github OpenZeppelin . Ethereum.org .



All Articles