Find out what goes into the minting process

It’s NFTs and DeFi season. In case you are living under a rock, you need to read more about NFTs and DeFi using the following links.
Now that you understand the terminology, let’s understand how NFTs are poured. The NFT market is definitely going from a few mints to tools and technologies for content creators to the NFT version on their own.
Below are the basic steps in minting an NFT.
- You need to upload the image/artwork/clip to IPFS. You can use any IPFS client that allows you to upload and install the asset, making the asset available to anyone to access through a link. I am using Pinata Cloud for IPFS.
- You need some test ethers on your Metamask wallet. Once the Metamask Google Extension is installed, load the test ether using the Rinkeby faucet. Also, upload some LINK to your Rinkeby testnet address.
I built these APIs on top of the existing repo by Patrick Collins. Check out the repo in this GitHub link.
ye The example above deals with minting a set of “Dungeons & Dragons” into Rinkeby. It contains the following main steps.
Step 1:
truffle migrate --reset --network rinkeby
Step 2:
truffle exec scripts/fund-contract.js --network rinkeby
Step 3:
truffle exec scripts/generate-character.js --network rinkeby
The fourth step:
truffle exec scripts/get-character.js --network rinkeby
Fifth step:
truffle exec scripts/set-token-uri.js --network rinkeby
Steps 1 and 2 deal with setting up the Rinkeby connection and migrating the contracts related to the creation of the NFT to the Rinkeby Testnet.
Steps 3, 4 and 5 involve implementing the appropriate functions on the migrated nodes to randomly select characters and preparing a URI for the NFT metadata.
Please go through README.md
From the above repo to understand other setup details.
The idea is to build a NodeJS application that uses the above steps. We can use Node’s Child Process to execute truffle commands on the CLI. Below is an example to finish the first step in calling the child process.
Just like the above model, we can generate code to perform the remaining steps mentioned above to complete the minting process. Before performing these steps, we need to create the required nodes and migrate them to Rinkeby testnet.
We can also create the necessary nodes to mint an NFT using file manipulation in NodeJS. We are making changes to template
Contract quickly using NodeJS fs library and then execute contract migration truffle commands.
Here is the sample code for creating contracts:
after copying sample.sol
to contracts
The folder with the requested name, we selectively replace the contents of the newly created contract based on the request received in the express API call. The NFTs minted through the above process can be viewed at the Open Rinkeby Test Network Gallery.
As discussed above, before we get ready to mint, we need to mount the image/artwork to IPFS.
We can build APIs to upload and mount the image to IPFS using Pinata, and there are other ways as well. Please review their docs to identify the image upload and install APIs.
Once the image has been uploaded successfully, the Pinata APIs return a CID which is a unique identifier for the uploaded file/image.
https://ipfs.io/ipfs/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?filename=filename.png
The final URI looks similar to the above.
“XXX” is where the unique customer identification number will be. We need to include the image URI inside the metadata JSON file before uploading the JSON file to IPFS.
Please see the metadata folder in the Dungeon and Dragons GitHub repo for more details on what a metadata JSON file should look like.
Here is the sample code to upload the file to IPFS using Pinata:
Apart from the above, you can also add the marketplace from Opensea using Opensea API. Below is sample ReactJS code to fetch NFTs from Opensea and display them in the NFT Gallery.
Here is the code to extract NFTs from Opensea and display them as an NFT gallery:
This approach gives a better understanding of what goes into the NFT minting. This is definitely not production ready code. So, we may have to get rid of the truffle and build with web3js.
Happy sk!!