Three years ago, Ethereum brought the very first Turing-complete blockchain virtual machine to developers around the world.
It’s safe to say that a large portion of the smart contracts deployed on Ethereum are tokens. Tokens are the ultimate abstract smart contract — they are the pure crystallization of owning something in the digital space.
Most of these tokens use the ubiquitous ERC-20 Fungible Token Standard which deploys a contract to Ethereum for a single type of token.
In economics, fungibility is the property of a good or a commodity whose individual units are essentially interchangeable.
For example, since one kilogram of pure gold is equivalent to any other kilogram of pure gold, whether in the form of coins, ingots, or in other states, gold is fungible
— Source: Wikipedia
Some new blockchain games are now also using the more recent ERC-721 Non-Fungible Token standard which allows each unit to be a unique collectible item with its own serial number. These have become popular in some early blockchain games because of the success of CryptoKitties.
Mainstream Games Need an Evolved Token
When we started building Enjin Coin one year ago, we realized that the current token standards would not work for the items that mainstream games use. We set out to build a new kind of Ethereum token, the basis of which later inspired ERC-721’s design.
Multiplayer Games Have LOTS of Items
Runescape has 35,000 and World of Warcraft, the king of MMOs has over 100,000 different items! Shooters like Overwatch and Team Fortress 2 each have thousands of skins and items.
The biggest problem with existing token designs is that they require deploying a separate contract to the blockchain for each and every item type!
Think about this for a second…
It’s like being forced to buy a brand new computer for every single app you want to use.
Every blockchain token in existence right now requires the developer to build and deploy a full Smart Contract. These contracts usually contain the same old code that every other token uses, with small tweaks to the token name or number of decimal places.
“The Great Ethereum Garbage Patch”
What does this do to the blockchain?
Every single distributed node will need to keep each token’s code and interface alive for eternity. This is a huge waste of data and state size!
EnjinX, our upcoming blockchain explorer, has logged transfers from over 74,000 different tokens deployed on Ethereum since 2015.
Imagine the impact of even a single “hit” blockchain game with 100,000 items… the sheer cost of deploying this many tokens as contracts would make it practically impossible for any game studio to manage.
ERC-1155 takes a new approach to defining tokens. Items are now stored in a single contract with the minimum possible amount of data needed to distinguish the token from other ones. The contract state contains configuration data per Token ID and all the behavior governing the collection.
Atomic Swaps — Trading Multiple Items
Existing token designs would require a multi-step process to achieve something called an atomic swap, exchanging one kind of token for another without an intermediary.
That’s 4 transactions required to swap 2 tokens. Every additional token type added to the trade would need an additional approval step, since ERC-20 tokens and ERC-721 tokens are all siloed in separate contracts.
The superior design of ERC-1155 Crypto Items allows for a swap of any amount of tokens in only 2 simple steps:
Imagine checking out your groceries at the store and having to buy each item in your cart separately.
Swiping your credit card, bagging a single loaf of bread, receiving a small receipt, before continuing with the apples, getting another receipt, and so on.
This is how ERC-20 and ERC-721 token transfers work, it’s just not efficient.
In ERC-1155, you can send any number of items to one or multiple recipients in a single transaction. This reduces gas and congestion on the Ethereum transaction pool (and saves you money!)
The transfer, approve, melt, and trade functions all take arrays as parameters, which let you perform between 100–200 such operations in a single transaction.
To transfer a single item, just supply each array with a single element. To transfer two items, use two elements, and so on.
Fungible AND Non-Fungible Items
Although recent blockchain games are focused on collectibles, there is a need for both Fungible items and Non-Fungible items in most modern video games.
Think of a typical multiplayer game you’ve played in the past. You might have had items in your inventory like stims, health kits, or stacks of ammunition.
These items make more sense as fungibles, as they are used and traded in large quantities and you don’t necessarily care about individual units.
Even more substantial items like weapons or armor could be designed as a simple fungible type in many games, depending on the mechanics.
When you need to attach unique history, provenance, and identity to every copy of a certain weapon, these would be designed as non-fungible items.
ERC-20 is limited to fungibles, and ERC-721 is limited to contracts with individual unique copies of items. The two token types are not very compatible or mixable.
ERC-1155 Crypto Items improve on this by combining the benefits of both. You may create thousands of different types of items for your game, and depending on the use case, each unit may have a unique index or be fully fungible with the others.
These NFTs may still be treated as a group within the contract, so they retain a sort of fungibility. You’ll be able to know that your token is a “Machine Gun” and also that it’s of the unique serial number “1234”.
Trades and multi-transfers, like we discussed above, can now be done with a mixture of Fungible tokens and Non-Fungible tokens, making this an immensely powerful upgrade compared to existing token standards.
Opening Token Creation to Everyone
You don’t need to be an experienced blockchain developer to make tokens with ERC-1155. Since the smart contract is simply a store of data and behaviors, anyone building an ERC-1155 contract can allow the public to create their own tokens using it, if they wish.
This is how our official Enjin implementation works — anyone can ask the contract for a new token to be created, and it’s immediately available to use and distribute by the creator. You can even use a graphical user interface to design and launch any kind of token.
Removing these barriers for all kinds of creative people opens interesting use-cases in gaming, peer-to-peer content creation, and beyond.
ERC-1155 has been posted to Ethereum’s Github as a discussion thread, where we will be considering any feedback and tweaks before submitting it as a pull request: