I'm working on a NFT project using ERC721 smart contract (with ERC721URIStorage extension) where user can mint unique NFTs.
I have uploaded NFT's json metadata's (used for TokenURIs) to IPFS.
In the dapp (using react), there will be a mint button where the user clicks on it to mint a random NFT.
I'm struggling though with developing the logic of minting random NFT.
I have uploaded to IPFS a text file containing all the TokenURIs, and then reading this file in the mint function in my dapp where a random TokenURI is fetched and then minted.
The issue here is that I couldn't find a way to put a flag on the selected TokenURI on IPFS so next time mint function is called it will not get this TokenURI at all.
I'm not sure if this is the right way to accomplish what I need (mint unique NFTs)
Any help or hint here will be much appreciated.
Tokens are traditionally minted sequentially, so from 0, 1, 2 to 10,000 for example. Many people simply append the tokenId to a baseURI that points to a folder or IPFS folder. So your tokens would be ipfs://<CID>/0, ipfs://<CID>/1, ipfs://<CID>/2, and so on.
This way, you don't need to flag each 'used' tokenURI.
Related
I have to develop an NFT minting contract with a whitelist system where we can set a variable amount of mint allowance per address.
It would be easy to achieve by setting manually in the contract with something like:
mapping(address => uint) allowancePerAddress
But as it's on Ethereum this solution would not be very cost efficient as we would need to store a couple hundreds of entries manually.
Is there another way, through signature for example to achieve this so it would be cost efficient for both the project and the minter ?
Signatures serve for checking the integrity of a message and also validate the emitter of the message, so Im not sure how would you accomplish using signatures, mainly because you'll need to set a value for each address, and keep track of them in the contract.
What you can do is create a constant that would be the default allowance, and when someone mints their first token you can update their allowance value during that transaction.
Yet, if what you want is to set up a custom value for each address, and you have a high amount of them, you can either do it on deploy, on the constructor or create a function that receives an array of Struct {address, allowance}, and set every address on a loop.
I am planning to issue erc20 token on ethereum and I want to use it as a payment for dapps on polygon.
How may I estublish the interaction between the contracts? A potential answer to that question might be bridging. But I tried to look for every platform to understand, how can I use my coin tokens after bridging, but failed to find any definite answer.
so my question is, if two contracts are on the same chain-
IERC20 token = IERC20(some_address);
We use the above line to call our coin token from our dapp. Since, our coin token is on different ethereum chain, after bridging, how do we call it feom a contract that will be deployed on polygon?
Will the above line of code work? Will I get a new address on polygon for my token contract?
(Recently I have seen a technique, but couldn't understand the underlying mechanism. So, there is a website called Coinvise, they let you deploy your coin airdrop contract on polygon and let you set the nft address (to know if user holds that particular nft) as eligibility condition that is deployed on ethereum. They do it on chain using something called 'sub-graph'. I do not know what this is but I'd like to know if it helps in my case.)
I am new to blockchain, please help
I have some questions regarding NFT and hope someone can clarify it for me:
Here are what I have done so far: I've successfully run through the whole process of
Uploading an image to IPFS,
Deployed a ERC1155 contract in remix,
Mint an NFT and
Successfully showed it in opensea.io
Here are my questions:
What does it truly mean by "Minting an NFT"? As far as I know, does it mean I create a token (NFT) that represents that uploaded image?
What is the role of "Minting an NFT"?
What are the differences between "Minting an NFT using smart contract" vs "Uploading an image to opensea.io and sell it"?
It seems to me that they are the same. When I mint an NFT using smart contract, opensea.io will create a new collection for me with that contract, and the result is the same when I create a collection manually and upload an image to sell.
When I create an image and upload to IPFS, I also tried manually creating a metadata.json file to describe that file and upload it to my Google drive, which is accessible via URL.
Then when I run the smart contract, I use that meta file link as a parameter to mint an NFT.
My question is: the whole process actually did not mention "opensea.io", why opensea.io knows that I am running a smart contract and create a collection for me? '
Hope someone can help clarify that for me.
Thank you very much in advance for all your help.
What does it truly mean by "Minting an NFT"? As far as I know, does it mean I create a token (NFT) that represents that uploaded image?
Correct. Minting a token is a term used for creating the token.
What are the differences between "Minting an NFT using smart contract" vs "Uploading an image to opensea.io and sell it"?
When you upload an image to OpenSea a create a new sell order, they can currently do one of two things depending on the options you chose:
Mint a token in their own collection contract right away
OR
Mint a token in their own collection contract when the sale is successful
why opensea.io knows that I am running a smart contract and create a collection for me?
They are listening to Transfer() events on collection addresses registered in their system. Or query the historic events when you add the address later.
When the event is emitted, they can create a record in their own database pointing to your token in your collection contract, effectively creating an OpenSea collection page (not a collection contract) and filling it with your token details.
I do not have much experience with Solidity programming. I want to create a smart contract for a new digital asset, say Cryptodoggies. I want to know if there is a way to prevent users from being able to resell/transfer their cryptodoggies.
You could have a variable (boolean I think would be more suitable) on your contract and use it in an access modifier for the transfer function so that the transfer function would require for this variable to be true. Then by making this variable false (by a function accessible only to you) you can stop users from transferring coins. Of course, this modifier would have to be used for every function that enables users to transfer tokens.
It would be something like that pausable ERC-20 from openzeppelin. You can find it here.
How can I get lists of ERC20, ERC721 and ERC827 tokens in a particular Ethereum wallet address? Also I would like to be able to get the name, symbol, logo, and balance from the main net.
ERC-721 includes an optional interface (optional means the contract implementor can choose if they want to implement it) to enumerate tokens owned by a specific account.
Su Squares implements this feature, but few other contracts do it.
You can use tools like Etherscan, Enjinx Blockchain Explorer or write your own interface to a Ethereum JSON RPC host to collect the data.
I don't think you can do a total data dive per address. I think you have to go the other way around, meaning looking if a contract contains a certain token. For the major tokens like EOS, this should be easy with MEW.
But if you're looking for some obscure tokens such as the ones below, you probably have to add them to MEW manually to check:
Crap Coin (CRP)
Ingrid Is a Horrible Human Coin (iHH)
Banana Coin