I have been trying to figure out how ERC1155 "helps" with NFT marketplaces like Opensea and Rarible implement "gas free minting". Here's an excerpt from Opensea's blog:
NFTs made with the Collection Manager follow the ERC-1155 standard, partly to help with gas-free minting and partly to help us add exciting features in the near future…
You can read more here: https://blog.opensea.io/announcements/introducing-the-collection-manager/
I understand how ERC1155 works and have even implemented and deployed a couple, but I still don't understand how ERC1155 helps with gas free minting. I looked up all over the Internet and people talk about it as if it's an obvious thing, but I don't know how "gas free minting" (also known as lazy minting, which basically means the tokens are not on chain until later) has anything to do with ERC1155.
Also many say ERC1155 "saves gas" on NFT trading, which I also cannot understand, because NFTs (unless they're talking about the fungible parts of the ERC1155) get traded one at a time. How can ERC1155 help with low gas fees?
Can someone please enlighten me? Thank you!
Best Answer
Lazy minting or "Gas Free" minting can be done using both the ERC1155 standard or the ERC721 standard. There is certainly nothing preventing OpenSea and other marketplaces from using an ERC721 for lazy minting.
The reason ERC1155 is becoming the popular choice for lazy minting is because:
uri()
function. This allows for easy linkage to the metadata with just the tokenId which makes it easier to lazy mint.Using the two basic examples below from OpenZeppelin we can see the gas savings:
ERC1155 helps with low gas fees even with basic transfer transactions because it stores data more efficiently inside the contract. If you look inside the OpenZeppelin ERC1155 contract you will see that you only need to update two mappings to transfer the token.
But for the ERC721 you have to update 3 mappings which raises the gas cost