Ethereum is known for its Tokens designed to facilitate the deployment of smart contracts associated with them and their functionalities, and one of the most recent standards in that sense is the ERC-1155.
Like the standards ERC-20 y ERC-721 Of which we have already discussed, ERC-1155 is a basic formulation designed to create useful tokens that make life easier for developers, all while offering them a powerful and dynamic tool to work with.
But what exactly is ERC-1155? Why was it created? What functions does it fulfill or what improvements does it include? Well, this and more we will see below.
Do you want to start enjoying the world of cryptocurrencies? Then it is time to open your Bit2Me user account. It is very easy to do and, in addition, following this link You will get € 5 totally free on your first purchase at Bit2Me.
ERC-1155, a standard for handling tokens with multiple functions
The ERC-1155 token is a type of standard token that has the ability to store under its control, tokens that can act as if they were an ERC-20 or ERC-721 token, or both at the same time under the same address.
The idea is simple and seeks to create a smart contract interface that can represent and control any number of fungible and non-fungible token types. In this way, the ERC-1155 token can do the same functions as an ERC-20 and ERC-721 token, and even both at the same time. And best of all, improving the functionality of both standards, making it more efficient and correcting obvious implementation errors on the ERC-20 and ERC-721 standards. This standard was developed by Witek Radomski, Andrew Cooke, Philippe Castonguay, James Therien, Eric Binet, and Ronan Sandford.
The ERC-1155 token is fully described in a EIP (Ethereum Improvement Proposal), more specifically in the EIP-1155, from which it derives its name.
Why were ERC-1155s created?
To understand why ERC-1155 tokens were created, it is necessary to examine some intermediate points that will give us a better understanding of this point. Among those points we can mention:
The limitations of the ERC-20 token
The ERC-20 (for fungible tokens) and ERC-721 (for non-fungible, NFT) tokens of Ethereum are widely used within the ecosystem. Just take a look at Etherscan to see the enormous number of tokens of this type that exist. However, both tokens have limitations, some of them quite severe.
For example, in the ERC-20 token, a major limitation of it is the lack of a way to “react” to ERC-20 transfer events. This results in ERC-20 tokens being trapped forever in contracts when users accidentally sent tokens to the wrong address. In this way, if you transfer to an incorrect ERC-20 address, what you have transferred is lost forever.
The limitations of the ERC-721 token
For their part, ERC-721 tokens also have their own limitations. For example, obtaining a token identifier directly is impossible, and this makes transactions with these tokens difficult. In fact, if, for example, you have a set of 10 NFTs that you want to transfer to another person, that transfer will require you to carry out 10 different transactions, with their corresponding commission charge and that greatly increases the cost of this simple operation, as well as the load operations of the network, having a tremendous impact on the usability of the Ethereum network. In these scenarios you will have to transfer token by token, being impossible to transfer all 10 at the same time, something quite absurd actually.
Another problem is traversing the ERC-721 tokens. This requires that all tokens within the contract be traversed for the purposes of providing a response to the DApp and the user in question. Imagine for a moment that an ERC-721 contract has under its registration 1 million tokens, that means that, if a person wants to know the status of their tokens, they must send a transaction to the network which will go through this million tokens, it will match them with the user's addresses and then deliver the response. That is the greatest demonstration of inefficiency that can be had in a system of this type.
Incompatibility between ERC-20 and ERC-721 tokens
Along with this, the ERC-20 and ERC-721 tokens are incompatible with each other. In fact, the contracts are so different that creating additional functionality that links the two is a daunting task, and would likely have a heavy impact on the network, potential failures, and high commission costs.
This is especially important because many DApps make use of both types of tokens, and due to this limitation, the logic of their operation becomes more complex. If a single smart contract could be used to handle everything, it would be much easier to program, as well as being more secure and less complex to design.
A more efficient way to use resources and schedule
Against this background, ERC-1155 has been created in order to unite both worlds under the same contract, overcoming the limitations already described and making their management more efficient. Not only that, this solution would even avoid the enormous fragmentation of tokens that exists today, allowing the same type of contract to control both types of tokens.
This, for example, would allow a DApp developer to use ERC-1155 so that its users can register fungible tokens (tokens that can be used as payment currencies) and non-fungible tokens (collectibles, exchangeable elements within the DApp or game) using the same contract, the same address and simplifying the logic of the DApps and the associated smart contracts. Without a doubt, it is a more efficient use of resources, something that would not come more in blockchains like Ethereum and its limited resources.
New functions and possibilities of the ERC-1155 token
A moment ago we talked about the ERC-20 and ERC-721 tokens having limitations to be overcome and that ERC-1155 was the answer to it. At this point you will wonder What can you really do with an ERC-1155? Well, these are some of the possibilities:
Mass transfers as standard
The ERC-1155 standard allows to make massive transfers natively of the tokens included in a smart contract. In this way, if, for example, we have a series of NFT tokens or fungible tokens (or both), we can transfer several of these tokens in the same operation, making a single operation make this transfer effective.
In this way, it is possible to save on transaction costs, minimize the impact on the network, and enable a trading system (escrow/atomic swap) using said tokens much more easily.
Multiple tokens in the same contract
In addition to this, an ERC-1155 can describe the existence and operation of multiple tokens at the same time. That is, an ERC-1155 can create one or more fungible tokens (like ERC-20) and can also describe one or more non-fungible tokens (like ERC-721) all within the same contract, facilitating deployment and programming. thereof.
Integrated token type detection
Another functionality within the ERC-1155 token is the ability to integrate the functionality of the ERC-165 (known as, Standard Detection Interface), all within the same system. In this way, the ERC-1155 token is able to detect the interface of the token and adapt its behavior depending on it. This is especially useful due to the multitoken nature of the ERC-1155 and simplifies application design.
Secure token transfer
Perhaps one of the most promising features of the ERC-1155 token is the secure token transfer. To do this, the ERC-1155 standard smart contract includes a function that verifies that the transaction has been carried out, and if not, reverts it to return control of the tokens to its issuer.
This is especially useful when we make a mistake in the transcription or copy of addresses and instead send our tokens to the wrong address unable to process our transaction. In that case, the transfer is void, and the issuer recovers the tokens, allowing it to verify the address again and retry the operation. To avoid attacks from double spending, there are a number of rules described that prevent this behavior, making it safe against these types of attacks and other traps.