View Categories

ERC1155

10 articles

What is the difference between fungible and non-fungible token in ERC1155?

Last Updated: July 9, 2023

Technically, there is no difference between minting a fungible and non-fungible token in an ERC1155 contract. Both tokens have the same characteristics – token ID, token amount, token URI and wallet addresses that own them. Surprisingly, you can create more than one token for a non-fungible token in ERC1155. This means setting the token amount to more than 1 when minting. This also means that more than one person or wallet can own the same NFT. The only difference between the two is in their use. You may wish to use a fungible token like a currency in a use case such as a game, a loyalty program, or in a DAO to present something fungible and divisible that you distribute among your members. The NFT in ERC1155 can present game items, access cards, coupons or something else.

Can I create more than one NFT in ERC1155?

Last Updated: July 9, 2023

Yes, you can. You can mint more than one non-fungible token (NFT) in an ERC1155 contract. Which means more than one wallet could own the same NFT.

Can we trade ERC1155 tokens like ERC20?

Last Updated: July 9, 2023

Yes, you may treat ERC1155 fungible tokens like ERC20 except that both are different standards and they are not compatible with one another. However, both are fungible tokens that you can mint, transfer and burn any amount you wish. More crypto exchanges only support ERC20 for trading which is why it’s still rare to see ERC1155 being listed on their dapps. But the future may change, especially when more projects are using ERC1155 standard. One caveat is ERC1155 tokens have no decimal places. As much as they are fungible and divisible, you cannot divide them into fractional pieces.

Does MetaMask support ERC1155?

Last Updated: July 9, 2023

MetaMask partially supports ERC1155. What this means is MetaMask will recognize an ERC1155 token only as an NFT. It will not accept it as ERC20 fungible token like ERC20. You can only add ERC1155 under the NFTs section in MetaMask, as shown below. You can’t add ERC1155 tokens under the Tokens section in MetaMask.

How to display contract name and symbol for ERC1155 on Etherscan?

Last Updated: July 9, 2023

The ERC1155 contract name and symbol will automatically appear on Etherscan if you declare these two variables as public in your contract. See the ERC1155 code sample below. Inside your contract constructor, you should then assign your contract name and symbol to values that represent your contract. Once you assigned them and deployed your contract, this text will appear on Etherscan automatically, as illustrated below by Adidas ERC1155 contract. All of the above is automatically done for you when you create an ERC1155 contract with Mintnite.

What is ERC1155 and what is the use of it?

Last Updated: July 11, 2023

Think of ERC1155 standard as a cross between ERC20 and ERC721. It was given birth because there was a struggle in the Web3 community to create a single token standard that is both fungible and not fungible. ERC20 is only fungible and mostly used as a digital currency like AAVE, or LINK. ERC721, on the other hand, is purely non-fungible which gave rise to NFT art mania. But if you need to use both fungible and non-fungible tokens under one contract instead of managing two contracts – ERC20 and ERC72, you’d use ERC1155. Having said that, most articles out there often use GameFi as a classic use case for ERC1155. Indeed, because ERC1155 was created for the purpose of perpetuating the Web3 gaming industry. But beyond GameFi, there are other potential use cases that are yet to be tapped. ERC1155 can be used to create a loyalty program where an enterprise could mint fungible loyalty tokens (points) and issue non-fungible discount coupons. Members (wallet holders) could earn fungible tokens and use them to redeem for NFT coupons (such as 50% discount vouchers). These NFT coupons can be burned by the contract owner after use. We can up the ante by only issuing soulbound (SBT) coupons that are not transferable between members. One advantage of ERC1155 against ERC20 is its ability to issue new tokens at will – be it fungible or not. We could only issue one standard token from ERC20 but with ERC155 you can create new sets of fungible tokens (with new token IDs) without limits. Meanwhile, ERC721 lacks the bulk transfer feature that ERC1155 thrives on. ERC1155 allows the contract owner to transfer multiple fungible and non-fungible tokens to a wallet address under one transaction. However, the current standard lacks the ability to transfer multiple sets of tokens to multiple wallets at once. But this can be overcome by adding in a new bulk transfer function. Bottomline is, if you’re unsure what the future holds for your Web3 initiative, you may prefer to consider ERC1155 that offers more flexibility. Besides, Web3 is still very much evolving and you don’t wish to be caught off guard.    

Can I add multiple files in one NFT?

Last Updated: July 31, 2023

No, you can’t. You cannot add more than one file in one NFT under the public or private category. If you need to do so, you need to upload multiple files and duplicate the same wallet address on a list when minting as shown below. This will create multiple unique NFTs with different token IDs and all are assigned to the same wallet. 0x8d0CE07483596c76e0C8bB17Eb32e7dA7e3d270c 0x8d0CE07483596c76e0C8bB17Eb32e7dA7e3d270c 0x8d0CE07483596c76e0C8bB17Eb32e7dA7e3d270c 0x8d0CE07483596c76e0C8bB17Eb32e7dA7e3d270c 0x8d0CE07483596c76e0C8bB17Eb32e7dA7e3d270c

What’s the difference between public and private category?

Last Updated: July 31, 2023

Public category is for creating NFTs or SBTs containing files that are visible publicly on the blockchain. Private category only stores the file hash string (such as 4669105d5a7440f09650d63986ccc1161efab6a252a1e5e5ddbb425410252564) in the NFT. Typically, you’d always use the public category. You would only use the private category when you need to notarize a personal file that you do not which the public to access. Thus, the file hash acts as proof of your file’s existence by carrying its hash string on the blockchain.

I’m getting rate limit error when uploading my NFT files

Last Updated: July 31, 2023

Because we use nft.storage to store your NFT files on IPFS, there’s a limit on how many files you can upload at once. Currently, the rate limit will be triggered if the nft.storage API receives more than 30 requests using the same API key within a 10-second window. What you can do is reduce the number of NFTs you wish to mint at once which in effect will reduce the number of files being uploaded to nft.storage at once.

How to get or grant roles in OpenZeppelin Solidity contract code with access control?

Last Updated: August 6, 2023

If you’re using OpenZeppelin smart contract code with access control, you will encounter a function called grantRole (see red box) depicted below on Remix on how to assign a role to a wallet address. The question you might ask is what should I fill in the role parameter. You actually have to fill in the role such as MINTER_ROLE to assign the minting privilege to an address, or DEFAULT_ADMIN_ROLE to assign a wallet to be the admin of the contract. But the parameter only accepts bytes32 input. Thus, to obtain the bytes32 data, scroll down on the list of functions you have and find the variable MINTER_ROLE or DEFAULT_ADMIN_ROLE and click on them, as shown below, in red boxes. And you will get the bytes32 version such as 0x0000000000000000000000000000000000000000000000000000000000000000 for DEFAULT_ADMIN_ROLE and 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6 for MINTER_ROLE. You then just have to copy these data types and paste them on the role parameter in the grantRole function and also include a wallet address. Then, hit the call button.