In recent times, I spend most of my personal coding time with Smart Contracts. One useful resource on the internet is Road to Web3 course from folks at Alchemy.
You can follow their tutorial here to create your first smart contract and mint an NFT with it.
I am outlining the steps in this post — I suggest you to use this as a guide to using the tutorial from Web3 University.
- Setup your MetaMask wallet and ensure a test account is setup (the tutorial uses Rinkeby network)
- Add some ETH to your Rinkeby test account using Rinkeby Faucet. This will give us enough gas to deploy smart contract to Ethereum network and mint it
- Create an account in OpenSea Testnet using the MetaMask wallet (Rinkeby account). This is where the NFT will be deployed
- Create a Filebase account which will host your NFT (an image for example) using IPFS
Steps to mint your first NFT
- Create your first ERC721 (NFT standard) smart contract in Solidity using OpenZeppelin wizard. Keep the default code, it is good enough for the test deployment
- Open the smart contract in Remix and understand what each section of the code does (tutorial from Web3 University guys help with it)
- Compile the smart contract and ensure there are no errors
- Deploy the smart contract using the Rinkeby test account you setup earlier in MetaMask wallet. Some ETH will be used as gas for this deployment
- Once the deployment of smart contract to Ethereum network is successful, focus on uploading the NFT digital asset to your Filebase bucket
- Go to Filebase console, create a bucket and upload the NFT + metadata.json to it (again use the tutorial to understand how to create the metadata.json file)
- Copy the IPFS CID for metadata.json file. We will use this to mint the NFT from the smart contract
- Go back to Remix and mint the NFT using the safeMint() method, which takes in 2 arguments — IPFS CID (from Filebase) and Account ID (from MetaMask wallet)
- Again, the minting process will use a small amount of gas. Ensure your see a success message in Remix console
- Go to OpenSea Testnet and login with your MetaMask wallet, using your Rinkeby test account
- If all went well, you should see the NFT hosted in OpenSea, with all the metadata setup using metadata.json
Congratulations on minting your first NFT using smart contract!
Here’s the link to my NFT — this is an art work by my daughter!
Leave a Reply