Table of contents
ERC-1155, in simple terms, is the combination of the ERC-20 and ERC-721 standards. It gave birth to the multi-token.
But it is so much more than that.❤️
The most common standards are the ERC-20 and ERC-721 standards, but the ERC-1155 standard is the one that you need to know about.
This post will dive deeper into each of these standards and understand the problems that the ERC-1155 token solves.
This topic can include many web3 terms, so I have included a small glossary below.
Non-Fungible Token (NFT): Each Token can have a different value to another token even if it is from the same smart contract
ERC: “Ethereum request for comment.”
EIP: “Ethereum improvement protocol.”
ERC-20: The standard for fungible tokens, proposed by Fabian Vogelsteller in November 2015
ERC-721: The standard for NFTs, proposed by William Entriken, Dieter Shirley, Jacob Evans, and Nastassia Sachs in January 2018.
ERC-1155: The standard for the Multi-Token.
Now let's move on to a quick summary of the ERC-1155 token✨
What is ERC-1155?
ERC-1155 is a multi-token that can create fungible tokens, offering another form of utility.
The multi-token aims to provide an intelligent contract interface that stores and controls various token types like an ERC-20 token or an ERC-721 token.
This means that an ERC-1155 token can perform both ERC-20 and the ERC-721 token functions. This combination means that the ERC-1155 can act as a semi fungible token, which we will look at later.
Both the ERC-20 and ERC-721 token contracts were so different that it would have been highly inefficient to create some form of functionality that linked the two contracts together. If a connection had been made, there could be a high risk of failure, costs, and network disruption.
Imagine GWEI being higher than it already is. It’s already a nightmare.👹
Not only does this make ERC-1155 more efficient compared to the previous standards, but it provides an opportunity to correct issues in the other token standards.
Next, we will dive deeper into the other token standards to understand their work and limitations.
ERC-20 is the most commonly used standard in the Ethereum ecosystem. It was released in 2015 and was the first standard developed in the Ethereum network.
The ERC-20 standard made it easy for people to develop their fungible tokens on the Ethereum blockchain, but it had limited functions.
The ERC-20 standard has six functions:
totalSupply: determines the total number of tokens;
Balance0f: shows the balance on the account of a certain address specified by the address _owner parameter, where _owner is the desired address;
transferfunction: transfers tokens from the primary address (DAO/ICO) to a user address.
- transferFrom` function: used to send tokens from one user to another;
approvefunction: Checks the number of tokens that are in the smart contract and allows fund withdrawal from the account up to the maximum allowed amount, which is specified as a parameter of the function;
allowancefunction: guarantees that there are enough tokens at the sender’s address for sending them to the recipient’s address.
ERC-20 also has two events:
- transfer — the event of transferring tokens between accounts;
- approval — the event is initiated when the approve function described above is successfully executed.
As you can see, ERC-20 provided the bare basics for creating a token. It focused on creating a token and being able to send them around.
It was nothing more complicated than that.
Blockchain was still in its early time when the ERC-20 token standard was introduced in 2015. Not many people had use-cases for Ethereum yet. That was until Dapper Labs introduced the ERC-721 token standard in 2017.
The ERC-721 token standard is for NFTs. Non-Fungible Tokens are everything people talk about right now.
Monkeys are selling for millions of dollars, and it's ordinary in web3.💰
An NFT can be used in various ways, but it is mainly used for digital artwork. Like art in the real world, each piece of art can have a different value. That value just depends on the buyer.
I can value X piece for $2000, whereas someone else might value it for $5000. Art is subjective, and NFTs possess the technicality that it can have a different value even if you are selling the same piece of art from the same smart contract. I have shown an example below using Amrit Singh's work.
There are 30 owners of this NFT. Each can sell it at whatever value they wish, whether 0.5 ETH or 2.5 ETH.
I have talked about the history of NFTs and technicalities here, but in summary, NFTs possess a unique tokenid which makes them unique.
ERC-721 also had additional functions such as:
- It allows you to transfer NFTs between accounts, allowing NFTs to be traded for other currencies.
- It allows you to identify the total supply of a set of NFTs on the network.
- It allows you to query for the owners of a specific asset.
However, as the blockchain space moves forward, numerous issues were identified in the technicalities in ERC-721 that spawned ERC-1155.
One key issue is that each NFT has to be sent in its own individual transaction, making it very costly. Inefficiencies such as these would be improved on in ERC-1155.
ERC-1155 and its improvements🛠️
There are a variety of ways that the ERC-1155 token was more technically advanced compared to the former tokens, such as:
- Semi-fungible tokens
- Transactions are more efficient and secure.
- Transactions could be bundled within ERC-1155, lowering the cost of transferring tokens.
- ERC-1155 tokens are interchangeable, making them more efficient and valuable.
- Secure token transfer using SafeTransferForm
- Reduced deployment costs and complexity.
- Prevent double-spend attacks.
How do some of these implementations work❓
ERC-1155 token, as we mentioned before, has the capabilities to represent both fungible tokens and non-fungible tokens.
It can support both states within the same contract, fungible and non-fungible. This makes it extremely useful in the blockchain gaming world. It is common to have a currency in games such as gold (fungible token) and items (non-fungible tokens).
Running this example through an ERC-1155 contract allows this to happen. Otherwise, we would have to link the ERC-20 contract to an ERC-721 contract, which means a lot more effort for the developer and inefficiencies within the game.
Semi-fungible tokens can act as both fungible and non-fungible tokens. Initially, a token can be given out as a fungible token, but once it is redeemed, it will become an NFT.
See it as unlocking a treasure chest which is a fungible token. All the treasure chests have the same value. Once you open the treasure chest and find out what is inside, your reward (i.e., a sword) is now an NFT.
This is all possible within the ERC-1155 contract, and it seems very simple looking at it. However, things are much easier said than done.
This combination means that NFTs have the power to be transferred in one transaction rather than multiple transactions, which requires each NFT to have its transaction if it was through the ERC-721 token.
Imagine when blockchain games are more common, and you want to transfer items from your account to another or your friend's account. If this were on the ERC-721 token standard, this would require an individual transaction for each NFT, making the game too costly to play due to gas costs.
If the game used an ERC-1155 token contract, you could batch all the game items into one transaction and send them to another account.
This is a win for both the blockchain and the user. It means the network will be less congested and a reduced cost for the user.
If a transaction is not completed successfully, the tokens involved will be returned to the original owner. It was common for some people to send their tokens to their incorrect address and lose lots of money in the past.
This is a feature that the blockchain world needs for the everyday user, as an incident such as losing your tokens to the void can give a wrong impression.
As an example, the Golem contract currently holds over 350k GNT tokens worth multiple tens of thousands of dollars, and lacks methods to get them out of there. This has happened to virtually every ERC20-backed project, usually due to user error.
Double spend attacks
A double-spend is when a user will commit a transaction and then duplicate the first one. A user would duplicate the original transaction to make it look natural and then use the copy while deleting the original transaction.
For example, if a user commits 2 BTC in an exchange transaction then duplicates the transaction, they would have “spent” 2 BTC and received the product for free.
There are a variety of ways to commit a double-spend attack.
The ERC-1155 standard prevents a double-spend attack as the code is stricter, and certain conditions have to be met before a transaction can be committed to the blockchain.
The stricter rules in ERC-1155 prevent people from exploiting others like the loopholes found in ERC-20.
The ERC-1155 token solves the current problems we faced with the ERC-20 and ERC-721 tokens. It tackles the root causes and manages to improve a lot of inefficiencies within the previous tokens and make them more secure.
These improvements came through innovation in the blockchain space. It’s essential to recognize that we are still early in this space, and there will continue to be issues such as the ones found in the ERC-20 and ERC-721 standards.
We currently know that the ERC-1155 is an excellent token for current use-cases and tackles many issues that we now face. However, does this not mean that it will not need improvement too.
There might be another ERC that will improve upon ERC-1155 and so forth in the future.