ERC1155 is more than just an NFT token standard. It sets the stage for multi-token management and transactions. With ERC1155, single deployed contracts can include varied combinations of non-fungible, fungible, and semi-fungible tokens.
Originated by the Enjin team, this ERC1155 token standard drew ideas from token standards like ERC20 and ERC721 token. It also introduced improvements of its own. Previously, under ERC-20 or ERC-721, you had to deploy a separate contract for each fungible or non-fungible token. This causes Ethereum’s blockchain to be riddled with redundant bytecode. Also, by separating each contract into individual addresses, the older standards limited certain functionalities.
Semi-Fungible Tokens with ERC1155
ERC1155 is a new way to create semi-fungible tokens. However, what are semi-fungible tokens? These are new types of tokens that merge different properties of the token standards that came before them. Think of it as having the best of both worlds. Let’s take this useful analogy: you’re able to create a store coupon – thus a fungible token – which holds the value until you redeem it. After redeeming the coupon, it has zero dollar value and you can not trade it as a regular fungible token. Therefore, the redeemed coupon, with altered properties, becomes unique with information about the item redeemed, the customer, the price, and so on. Hence, it becomes non-fungible. However, a semi-fungible token standard such as ERC1155 is capable of representing both attributes.
According to the Enjin blog, ERC1155 is a novel approach to defining tokens. Multiple items can be stored in a single contract with the least amount of data necessary to distinguish them from the others. Furthermore, Enjin writes that “the contract state contains configuration data per token ID and all the behavior governing the collection.”
Therefore, this new token standard lets you create utility tokens such as BNB, for example, and NFTs such as CryptoPunks or CryptoKitties. Its optimizations also make transactions more efficient and safer. Unlike in ERC-721, ERC1155 bundles transactions together, thus reducing gas fees. Furthermore, its ability to create efficient NFTs and fungible tokens at the same time shows that it is an evolution from both ERC-20 and ERC-721.
ERC1155 Contracts
With ERC1155 contracts, it is now possible to transfer multiple types of tokens at the same time. You can build multiple functionalities such as atomic swaps and escrows (useful in trading) of various tokens on top of the ERC1155 standard. With this, you eliminate the need to authorize individual token contracts separately, as done with ERC-721. Moreover, as mentioned, you can combine several NFT and fungible token types in one ERC1155 contract.
In this simple diagram created by Enjin, you can see how this new standard simplifies a token swap of any number of tokens (such as different kinds of NFTs representing unique items), a use case that is valuable in gaming:
Atomic Swap of Multiple Tokens
As you can see, the entire batch is get approval and transacts in two simple steps, which is proof that ERC1155 contracts can save you on Ethereum gas fees.
ERC1155 contracts also allow you to send many items to multiple recipients in one go. This type of ERC1155 transaction is easily comprehensible in the following diagram, also created by Enjin:
Moving Multiple Tokens to Different Accounts in a Single Transfer
As you can see, transferring different types of items to multiple users only takes one contract and one transaction. ERC1155 is light, efficient and it removes redundancies. Moreover, from this illustration, you now understand that ERC1155 is fungibility-agnostic.