Hi bob, thank you for this video. I have a question. You pass the tokenURI as an argument to the mint function. This is of course very practical, but only in the case if you, the contract owner, mints all the NFTs beforehand. In case where we would like a non-sequential (ipfs hash based) token-idx sequence to be minted by external addresses, your solution would not really make sense because 1. the onlyOwner modifier would need to be disabled and 2. users/hackers could inject their own tokenURI into the smart contract and thus change the NFT content. I need the users to be able to mint so I think my only solution would be to work with a classic tokenId -> string mapping. Thank you!!
@@mertsargin3060 although admittedly since the only time the tokenURI data could be altered is at the time of minting so why would anyone spending money on an NFT (initial user or after account is hacked) be incentivised to change the tokenURI? But it could be possible.
hey bob! thank you for such usefull videos, i have a question (might be a stupid one i'm sorry i'm a beginner hahaha).. my question is how can i access some fields on metadata? for example my metadata contains a field called X and i wanna specify in my smart contract that the mint price is equals to 0.01 ether * X, how do i get that X ?
So there is completely no need for this addon using IPFS. More detailed use cases would be beneficial. It's cool that you can change the token URI for single NFT tho it won't be possible with the folder usage. IPNS on the other hand is super slow. But then you could implement setBaseURI inside the contract and just swap the folder for every NFT even with single NFT update :)
Hey Bob, nice video . Earned a subscriber . I have a question related to my project. I am making an nft contract and it can be minted only when you have X tokens A or X tokens B or some ether written in the contract . I am unable to find implementation regarding X token A . How can I implement that my mint function can run when msg.sender address contains X token A .?
You can check the ether in a balance using address(this).balance or address.balance. To count the number of ERC20/ERC721 tokens owned by an address, you first need a reference to the ERC20/ERC721 contract. Then you call the ERC20.balanceOf or ERC721.balanceOf methods This link may help. ethereum.stackexchange.com/questions/21448/how-to-get-a-contracts-balance-in-solidity I will also soon have a video about decentralized exchanges in which the DEX contract is counting the number of ERC20 tokens of an ERC20 contract, so that will likely be helpful too. Lmk if any additional questions =)
Pls help. I am a beginner , I made voting dapp , but storing candidate name and other voter details in blockchain is costly . pls advice me on storing data without compromising blockchain principles
Excellent question, Pankaj! People are trying to scale with a variety of layer 2 approaches. I would suggest reading more about them at ethereum.org/en/developers/docs/scaling. For voting, a common approach used by many DAOs is Snapshot decrypt.co/resources/what-is-snapshot-the-decentralized-voting-system. They use IPFS to avoid storing votes on-chain, which avoids most of the gas fees. Depending on what kind of voting needs you have, it may be easier to use an existing voting platform (such as Snapshot) instead of creating your own voting contract.
Dude. Just found this channel! Great intructive content!
Nice video dude,Thanks
Hi bob, thank you for this video. I have a question. You pass the tokenURI as an argument to the mint function. This is of course very practical, but only in the case if you, the contract owner, mints all the NFTs beforehand. In case where we would like a non-sequential (ipfs hash based) token-idx sequence to be minted by external addresses, your solution would not really make sense because 1. the onlyOwner modifier would need to be disabled and 2. users/hackers could inject their own tokenURI into the smart contract and thus change the NFT content. I need the users to be able to mint so I think my only solution would be to work with a classic tokenId -> string mapping. Thank you!!
Thank you, was just thinking the same
@@mertsargin3060 although admittedly since the only time the tokenURI data could be altered is at the time of minting so why would anyone spending money on an NFT (initial user or after account is hacked) be incentivised to change the tokenURI? But it could be possible.
hey bob! thank you for such usefull videos, i have a question (might be a stupid one i'm sorry i'm a beginner hahaha).. my question is how can i access some fields on metadata? for example my metadata contains a field called X and i wanna specify in my smart contract that the mint price is equals to 0.01 ether * X, how do i get that X ?
So there is completely no need for this addon using IPFS. More detailed use cases would be beneficial. It's cool that you can change the token URI for single NFT tho it won't be possible with the folder usage. IPNS on the other hand is super slow. But then you could implement setBaseURI inside the contract and just swap the folder for every NFT even with single NFT update :)
Hey Bob, nice video . Earned a subscriber .
I have a question related to my project.
I am making an nft contract and it can be minted only when you have X tokens A or X tokens B or some ether written in the contract . I am unable to find implementation regarding X token A . How can I implement that my mint function can run when msg.sender address contains X token A .?
You can check the ether in a balance using address(this).balance or address.balance.
To count the number of ERC20/ERC721 tokens owned by an address, you first need a reference to the ERC20/ERC721 contract.
Then you call the ERC20.balanceOf or ERC721.balanceOf methods
This link may help.
ethereum.stackexchange.com/questions/21448/how-to-get-a-contracts-balance-in-solidity
I will also soon have a video about decentralized exchanges in which the DEX contract is counting the number of ERC20 tokens of an ERC20 contract, so that will likely be helpful too.
Lmk if any additional questions =)
do you have a discord channel?
Pls help. I am a beginner , I made voting dapp , but storing candidate name and other voter details in blockchain is costly . pls advice me on storing data without compromising blockchain principles
Excellent question, Pankaj!
People are trying to scale with a variety of layer 2 approaches. I would suggest reading more about them at ethereum.org/en/developers/docs/scaling.
For voting, a common approach used by many DAOs is Snapshot decrypt.co/resources/what-is-snapshot-the-decentralized-voting-system. They use IPFS to avoid storing votes on-chain, which avoids most of the gas fees. Depending on what kind of voting needs you have, it may be easier to use an existing voting platform (such as Snapshot) instead of creating your own voting contract.
@@BlockchainBob Thank you