Create your first NFT with Smart Contract
Published: 2022-08-29 02:47:18

In recent times, I spend most of my personal coding time with Smart Contracts. One useful resource on the internet is [Road to Web3](https://www.web3.university/tracks/road-to-web3) course from folks at [Alchemy](https://www.alchemy.com/).

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](https://www.web3.university/tracks/road-to-web3).

## Prerequisites

1. Setup your [MetaMask wallet](https://metamask.io/) and ensure a test account is setup (the tutorial uses Rinkeby network)
2. Add some ETH to your Rinkeby test account using [Rinkeby Faucet](https://rinkebyfaucet.com/). This will give us enough gas to deploy smart contract to Ethereum network and mint it
3. Create an account in OpenSea Testnet using the MetaMask wallet (Rinkeby account). This is where the NFT will be deployed
4. Create a [Filebase account](https://console.filebase.com/) which will host your NFT (an image for example) using [IPFS](https://en.wikipedia.org/wiki/InterPlanetary_File_System)

## Steps to mint your first NFT
1. Create your first ERC721 (NFT standard) smart contract in Solidity using [OpenZeppelin wizard](https://docs.openzeppelin.com/contracts/4.x/wizard). Keep the default code, it is good enough for the test deployment
2. Open the smart contract in [Remix](https://remix.ethereum.org/#optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js) and understand what each section of the code does (tutorial from Web3 University guys help with it)
3. Compile the smart contract and ensure there are no errors
4. 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
5. Once the deployment of smart contract to Ethereum network is successful, focus on uploading the NFT digital asset to your Filebase bucket
6. Go to [Filebase console](https://console.filebase.com/), create a bucket and upload the NFT + metadata.json to it (again use the tutorial to understand how to create the _metadata.json_ file)
7. Copy the IPFS CID for metadata.json file. We will use this to mint the NFT from the smart contract
8. 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)_
9. Again, the minting process will use a small amount of gas. Ensure your see a success message in Remix console
10. Go to [OpenSea Testnet](https://testnets.opensea.io/) and login with your _MetaMask wallet_, using your Rinkeby test account
11. 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!_

_This post was originally published by me at [Meet Ashwin](https://meetashwin.net/create-your-first-nft-with-smart-contract-275e4f8c8181)._

> Here’s the [link to my NFT](https://testnets.opensea.io/assets/rinkeby/0x74310472c6961028ff2bf64a8e9a99f8274e4dde/0) — this is an art work by my daughter!