ERC-1155: The Final Token Standard on Ethereum
Exactly one year after its introduction, ERC-1155 has become an official Ethereum token standard and is available to be used by the entire Ethereum development community.
Exactly one year ago on June 17, 2018, I pushed the first version of the ERC-1155 Multi Token Standard to Ethereum’s Github repository and opened an issue for comments and feedback.
Since then, the standard has received an incredible amount of support with more than 50 revisions and 400 comments from the community, who have provided invaluable input and helped shape ERC-1155 into the most powerful Ethereum token standard ever written.
Today, I am proud to share that ERC-1155 has progressed to Final status and has become an official Ethereum token standard.
Now that it has been sealed as “final” by the Ethereum community, there are no more changes to be made to ERC-1155. It is the new accepted standard for minting fungible and non-fungible assets, and the development community can start building applications that integrate ERC-1155 assets with full confidence that the current standard is future-proof.
ERC-1155 is here to stay.
Ethereum Improvement Proposals
A few years ago, the Ethereum community agreed on a process for introducing new improvement proposals to the Ethereum ecosystem. An issue is raised by a community member on the Ethereum GitHub page and describes a new feature, process, or standard that benefits the blockchain and its surrounding neighborhood.
At Enjin, we had been building something that we called the “Monolithic Token Contract” internally since 2017. We realized that the existing ERC-20 and ERC-721 token standards were not flexible enough for the kinds of game items we envisioned.
Eventually, we realized that this structure had some incredible benefits and use cases for both gaming and other industries, and if we wanted these new tokens to become a reality, we had to standardize it.
Creating a standard meant that the larger Ethereum community would begin to support this new kind of token, and it would pave the way for quicker adoption in wallets, exchanges, games, and new projects using tokenized blockchain assets.
One Smart Contract, Many Tokens
While ERC-20 and ERC-721 tokens required a new smart contract deployed for each new “class” of token, the core concept behind ERC-1155 is that a single smart contract can govern an infinite number of tokens.
Think of this like a vending machine that holds a wide variety of soda, juices, and even snacks. A customer interacts with the machine using a single secure interface (inserting a coin, pressing a button), and the machine dispenses the goodies they have selected. In the same way, an ERC-1155 contract made for a game could contain a wide variety of items, from weapons and armor to health potions, magic scrolls, and more.
Each of these items could be “fungible,” having more than one copy available. Fungible tokens are used for divisible currencies (most ERC-20 tokens), and they’re also very useful for stackable items that don’t need to be differentiated, like a bundle of arrows for a bow.
One-of-a-kind tokens are called non-fungible tokens (NFTs). This structure allows every token to have its own unique parameters, history, and mirrors the real world. A pet dragon in a video game could be an NFT and have a unique name of its own, a power level, and a rich history in the game.
Batch Transfers
With ERC-1155, multiple tokens can be sent in a single transaction — offering significant savings on gas costs and preventing the need to wait for each block in single transfers.
Projects using ERC-1155 can also build Atomic Swaps with the same basic design, allowing users to exchange one kind of token for another with absolute security from fraud and no intermediate party involved.
Further Optimizations
Further experimentation by some of the authors has led to even more optimizations and dramatic gas improvements!
The Sandbox developer Ronan Sandford was able to mint more than 1,500 tokens in a block while preserving true ownership with their ERC-1155 implementation.
Horizon Games developer Phillippe Castonguay was able to use a technique called Balance Packing (storing 16 lower-resolution tokens in a single ID) to achieve 80–90% gas savings compared to regular transfers.
Phillippe was also able to achieve a transfer speed of over 155 assets per second with their ERC-1155 tokens!
Data Economy
The main characteristic of the ERC-1155 Multi Token Standard is multiple tokens instantiated in a single smart contract. This means that “creating” a new token type can be as simple as calling a function that adds a new ID to the pool of tokens available.
In comparison, creating a new token type with the ERC-20 and 721 standards means editing code and deploying an entirely new contract to an address on the Ethereum blockchain. Deploying a contract costs an enormous amount of gas (ETH) because data storage is naturally expensive on a blockchain shared by the world. Most ERC-20 contracts are based on the exact same code, with a couple of lines edited, making the rest of the code unnecessary. That means every single one of Ethereum’s 25,000+ nodes becomes cluttered with redundant code that will remain there for eternity!
There’s also the operational overhead of needing to be notified of each new ERC-20 or ERC-721 contract address every time a new token is launched. One hundred new tokens would mean 100 new contracts to watch — for every wallet and every piece of software that must be made aware of the token even existing.
Therefore, while the previous two standards are good for narrow use cases — either a single currency or a single class of NFT — the vast majority of creators will benefit from ERC-1155’s ability to create new tokens on the fly and represent more than a single “type” without the duplication of identical contracts.
Strict Rules Make Tokens Reliable
An incredible feature of the ERC-1155 token standard is made possible by the strict set of rules a token must follow.
ERC-1155 tokens are the first type of token that can execute a deterministic smart contract function by simply sending a token to an address.
This is huge.
By simply sending a token to a DEX exchange address, the exchange could immediately return another token back to the sender’s address. Similarly, a blockchain game could perform a game function as soon as it receives an ERC-1155 token from a user. Tokens could be wrapped, converted, crafted, or escrowed with no need to access ABIs or interact with the smart contract directly.
This type of functionality was initially proposed in ERC-223, but the standard failed to catch on. ERC-721 also implemented “safeTransferFrom” but has the fatal problem of not strictly requiring this for all transfers, meaning that users can permanently lose their tokens and contract authors can’t rely on guaranteed execution when sending a token.
The decision to make this strict in ERC-1155 means that reliable networks of smart contracts and tokens can now begin to build upon this powerful functionality. All the user needs to do is send their token to an address to trigger an awesome chain of events.
Metadata
One of the major updates to the ERC-1155 standard in the last year was the decision to move all metadata about a token to an external JSON file. This was heavily inspired by the ERC-721 Metadata Extension, but we added some improvements.
No More Legacy Metadata
Symbol: (found in the ERC-20 and ERC-721 standards) was not included as this wasn’t a relevant piece of data for virtual items/assets. These 3-letter symbols are normally only used in tickers and for currency trading, but they aren’t as useful when you are tokenizing more general items.
Name: was also removed from the core standard. Why? In many use-cases, storing a name on the blockchain would be overkill. Instead, each token’s name can now be defined in the JSON Metadata Standard.
ID Substitution
By using the substitution string “{id},” an ERC-1155 contract can now point to an infinite number of token URIs without storing any additional data on-chain. This can even be used to point to a web service that hosts dynamically generated token JSON for each token in a database. The {id} string can also be used inside the JSON itself to automatically link to imagery for each token. This significantly reduces the overhead that’s required for developers to display metadata for large collections of tokens.
Localization
Since token information is defined in JSON format, localization is now possible for multiple languages using {locale}. Wallets and software that supports multiple languages can display alternate versions of token names, images, and any other data.
Guaranteed Log Trace
As the Ethereum ecosystem continues to grow, many dapps are relying on traditional databases and explorer API services to retrieve and categorize data. The ERC-1155 standard guarantees that event logs emitted by the smart contract will provide enough data to create an accurate record of all current token balances. A database or explorer may listen to events and be able to provide indexed and categorized searches of every ERC-1155 token in the contract.
Smart contracts no longer need to maintain indexes of every token ID, and IDs don’t need to be sequential in any way.
This is a radical departure from enumeration (the ability to browse through all tokens on-chain), but it brings a significant benefit in efficiency and even allows for an entire standardized record of every token mint, burn, and transfer. This has not been possible in a standardized way until today and will permit cool ecosystem benefits like deep data analytics on tokens and rich token explorers.
Imagine being able to rewind and fast-forward through time and analyze usage patterns and life cycles of completely different ERC-1155 tokens, regardless of which smart contract is being analyzed.
Token owners will be able to learn more about their assets, such as exactly when their particular token was minted, and in the future, tools may be developed which would provide useful insights for companies building on this technology.
Conclusion
The ERC-1155 standard is the culmination of a year of hard work by the blockchain community. If you are planning on implementing ERC-1155, you can view the entire standard, as well as the rationale behind each decision here.
You can also visit the original issue thread to see the discussion history:
To create an ERC-1155 token contract of your own, Enjin’s official reference implementation is open-source on GitHub:
You can use this code as a starting point for your own smart contract. You might also consider using the Enjin Platform, the most feature-rich set of blockchain development tools for developers and non-developers alike.
The Creators
The following authors were involved in making ERC-1155 a reality:
- Witek Radomski
- Andrew Cooke
- Eric Binet
- James Therien
- Philippe Castonguay
- Ronan Sandford
These amazing people each made significant contributions and improvements to the Multi Token Standard EIP specification, and my genuine appreciation goes out to each author for their help and dedication to making ERC-1155 more powerful and future-proof than we ever thought possible.
Finally, we’d all like to extend our gratitude to the amazing Ethereum community and thank everyone who participated with their feedback to finalize the new ERC-1155 Multi Token Standard!