By: Ermos Kyriakides
Let’s cut to the chase… There’s a new Ethereum Standard Proposal around the corner that could change the face of Ethereum Smart Contracts forever.
In this blog post I’ll give a primer on Ethereum and its smart contracts (and tokens), the current standards that are in place and what the new standard proposal by Witek Radomski is and how it will change Ethereum forever.
Before moving on to more advanced topics, I would like to get the basics and a few terminologies out of the way, in order for everyone to be able to follow this post.
- Smart Contract — A smart contract is a set of terms and conditionsdescribing a relationship between two or more parties, enforceable by programmatic code.
- Token — This is a smart contract coded in such way to represent a digital asset. Each token has properties and functions geared towards its intended use; for example, one token can be created to pay access to a network and another can be created to represent real assets such as equity. Tokens can have either a fixed supply, or variable supply (inflationary, deflationary, etc.).
- Ethereum — Is a platform that can be used to create any arbitrary smart contract. These smart contracts are stored on the network, thus making them distributed and decentralized. In addition, smart contracts on Ethereum are immutable and tamper-proof.
- ERC — This stands for Ethereum Request for Comments. It is the official protocol for proposing improvements to the Ethereum network. Usually there is a number attached to ‘ERC’ (i.e. ERC-20) and that is just a unique proposal ID number.
- Fungibility — The property of a good or a commodity whose individual units are essentially interchangeable.
What is ERC-20?
ERC-20 is a standard interface for tokens which was proposed by Vitalik Buterin and Fabian Vogelsteller in November, 2015. This standard “allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges.”
In order for a token to be ERC-20 compliant and allow seamless interaction with other smart contracts and decentralized applications (dApps), they need to support the following functionality:
- Retrieve the total amount of tokens that will ever exist also known as the total token supply
- Retrieve the number of tokens a certain Ethereum address holds
- Transfer tokens between two parties
- Approve the use of the token as a monetary asset
ERC-20 is geared towards representing Fungible Tokens. A fungible token is not unique and is interchangeable with another identical token. The importance of fungibility will come into play later in the post.
An example of an ERC-20 token is the Enjin Coin (ENJ). For gamers, it is a common currency between multiple ENJ-implemented games. It will also provide portability and transferability of virtual goods and digital assets. You can find more information about ENJ, in one of my previous blog posts, here.
What is ERC-721?
ERC-721 is standard interface for Non-Fungible Tokens (NFT) and was proposed by Dieter Shirley in September, 2017. The proposal was accepted as an official ERC-721 interface in March, 2018.
NFTs are unique in nature and each can be uniquely identified from each other. They can represent ownership over digital or physical assets. NFTs can represent a diverse universe of assets, including:
- Physical property — houses, unique artwork
- Virtual collectables — unique pictures of kittens, collectable cards
- “Negative value” assets — loans, burdens and other responsibilities
In general, all houses are distinct and no two kittens are alike. NFTs are distinguishable and you must track the ownership of each one separately.
The motivation behind ERC-721 was the fact that ERC-20 is insufficient for tracking NFTs because each asset is distinct (non-fungible) whereas each of a quantity of tokens is identical (fungible).
An existing example of such ERC-721 NFT are the ‘Kitties’ in the hugely popular CryptoKitties game. Each CryptoKitty is unique in nature and uniquely identified. No two CryptoKitties can ever be the same.
What is ERC-1155?
ERC-1155 is a standard interface for multiple item/token definitions in a single deployed contract proposed by Witek Radomski (Enjin Co-Founder & CTO) in June 2018. Witek created the code for the first non-
fungible token in June 2017, which inspired the creation of ERC-721.
The main motivation behind the ERC-1155 proposal, was the fact that ERC-20 and ERC-721 require a separate contract to be deployed for each fungible or NFT token/collection. As you can imagine, this is highly inefficient and “limits certain functionality by the nature of separating each token contract into its own permissioned address”.
The ERC-1155 proposal comes with a host of advantages over ERC-20 and ERC-721, including:
- Modular Plug & Play Contracts — As mentioned above, ERC-20 and ERC-721 require a separate contract to be deployed for each and this causes a massive amount of repetitious code thus ‘polluting’ the Ethereum blockchain. ERC-1155 proposes that the ‘common’ code across tokens is stored in a central smart contract and given a unique identifier. This unique identifier can then be referenced by other smart contracts which require the central smart contract’s code. This basically provides the ability for smart contracts to ‘re-use’ code from a central smart contract without the need to copy, thus saving storage space, processing power and electricity.
- Atomic Swaps of Bundled Tokens — An Atomic swap “is a smart contract technology that enables exchange of one cryptocurrency for another without using centralized intermediaries, such as exchanges”. Using the current standards, if Alice wanted to exchange Token A and Token B with Bob for Token C and Token B, that would require a minimum of four separate steps (Figure A). ERC-1155 solves this inefficiency by grouping multiple tokens together, regardless of have many tokens need to be swapped, and bundles everything together in a two-step process (Figure B).
- Multiple Complex Operations in One — ERC-1155 will allow you to perform multiple complex operations in a single transaction which will make the transaction ‘lighter’ and cheaper (Figure C).
- Fungibility Singularity — I have already talked about how ERC-20 caters for fungible tokens and how ERC-721 caters for non-fungible ones. “With ERC-1155, developers will now have increased power of choice, as each token can be either mass-produced or created singularly and either contain unique metadata or be fully fungible”.
How can ERC-1155 be used in reality?
As an ode to the Enjin team (and their CTO who proposed ERC-1155) I will be using games to present an example. Games have become highly sophisticated… Characters have different skins, can load different weapons, use different potions, etc.
I will be using World of Warcraft as a case study and put points across as if it were to launch on the Ethereum blockchain. At the time of writing, World of Warcraft has a mind-boggling 109,429 items! Some of these items are uniquely identifiable and some are not. For example, a Chromatic Sword is uniquely identifiable (with a limited number in existence) whereas an Ancient Healing Potion is not. Taking current standards, each Chromatic Sword would need to be represented using an ERC-721 token and an Ancient Healing Potion would be represented with an ERC-20 token.
Unfortunately, these two token types don’t play very well together. Additionally, the ERC-721 standard would require each and every one of the non-fungible items, to have a separate contract. More often than not, the code powering these items would look almost identical with some minor alterations, however, the current standards don’t cater for code re-use. In essence, these would need to be individually stored on the blockchain, polluting it with duplicate code. For example, if 100 Chromatic Swordsexisted, each and every one of them would require a separate ERC-721 token.
With ERC-1155 you can have the best of both worlds; a Fungibility Singularity (I’ll take credit for this catchphrase). Depending on the game mechanics, you could create thousands of different item types; some of them being uniquely identifiable whilst others being fungible. You could represent unique Chromatic Swords and fungible Ancient Healing Potions with the same standard.
Going a step further, ERC-1155 could treat NFTs in a group, thus retaining some fungibility. For example, you would be able to tell that your token is a Chromatic Sword with a unique identifier of it being the first that was ever created.
Finally, trading between two parties can now contain a basket of fungible and non-fungible items. For example, Alice could trade her Chromatic Sword and 10 Ancient Healing Potions for Bob’s Poseidus and 5 Astral Mana Potions, in a single transaction.
To conclude, I firmly believe the ERC-1155 proposal is a step in the right direction. ERC-20 and ERC-721 have served the Ethereum network well, however, ERC-1155 will take us to a whole new level giving the ability to developers to represent their fungible and non-fungible tokens under a single standard whilst also making transactions cheaper and lighter.
Link to original blog.