Tutorial Link: https://docs.alchemy.com/docs/how-to-develop-an-nft-smart-contract-erc721-with-alchemy
Side Note: I didn't follow the tutorial exactly but I achieved the same outcome, I modified it to deploy on Polygon & used Hardhat instead of Remix.
View My Minted NFT: https://testnets.opensea.io/assets/mumbai/0x9708005b48b05022293daa6ed5d8b551eebefbf1/1
Interact with my smart contract here: https://mumbai.polygonscan.com/address/0x8542dDdd46b9557CFE3b89075a8c202E48e1ac0b#writeContract
- What was the biggest lesson from this challenge?
- The biggest lesson for me was learning that an NFTs metadata isn't stored on-chain. I used to think only the image was stored on IPFS but I didn't know that the metadata was stored on IPFS too.
- What did you like/dislike about this challenge? Why?
- It was super cool learning how NFTs work & creating metadata that adheres to OpenSea's metadata standard! :)
- What do you want to build next?
- Dynamic NFTs!
- A UI for Minting NFTs.
- NFTs that you can stake.
- First, I used OpenZepplin's Smart Contract Wizard to create my ERC21 Smart Contract. see here
- Then, I added code to only allow 1 mint per user and set the total NFT supply to 10. see here
- I deployed my contract to Polygon Mumbai & then verified my contract.
- Verifying your contract is important because it allows you to interact with your contract directly from PolygonScan! Once your contract is verified, PolygonScan provides a simple UI for read/write functions.
- See below for how to verify your contract on PolygonScan from the Command Line.
- After verifying my contract, I uploaded my image for my NFT to Filebase. Then, I created my metadata file according to OpenSea's metadata standard. see here
- Filebase Website for hosting NFT metadata/images on IPFS.
- You can view the associated metadata for my NFT in the
metadata1.json
file. It follows OpenSea's metadata standard.
- I then connected my wallet & called the
safeMint()
function with my address & the link to my metadata stored on IPFS.
yarn compile
yarn deploy
Using address 0xC0c630f5c9A78A75a92617852AD0F4E80BF252Cf
Wallet balance 0.7624262968620278
Deploying contract...
Awaiting confirmations
Completed!
Contract deployed to: 0x9708005B48B05022293Daa6ED5D8b551eEBefbF1
yarn hardhat verify <YOU-CONTRACT-ADDRESS-HERE> --network mumbai
Successfully submitted source code for contract
contracts/MintNFT.sol:HelloWorld at 0x9708005B48B05022293Daa6ED5D8b551eEBefbF1
for verification on the block explorer. Waiting for verification result...
Successfully verified contract HelloWorld on Etherscan.
https://mumbai.polygonscan.com/address/0x9708005B48B05022293Daa6ED5D8b551eEBefbF1#code
```# mintNFT