DEV Community

Cover image for Generate NFT Metadata (JSON) using Python - Much Exclusive Doge Yacht Club Collection - Part IV

Posted on


Generate NFT Metadata (JSON) using Python - Much Exclusive Doge Yacht Club Collection - Part IV

In the last tutorial, we generated our NFT collection by using a Python library.

We will pick up from there and generate the respective metadata for the NFT collection by using our Python library once again.

The first thing we want to do is locate the images folder that contains our NFTs.

Right click on the images folder in Visual Studio Code and click on Reveal in Finder to see where the folder is located.

Image description

Have this folder at hand, we will come back to it.

In the meantime, go to Pinata and create an account.

Pinata is the service that will use to host our NFT data.

After creating an account, login with you credentials.

Image description

On the Pinata dashboard, go to Upload > Folder

Image description

Click on Select and upload the images folder that we located earlier on.

Image description

Give a name to the folder and click Upload.

Image description

The folder will appear on your dashboard once the upload is complete.

Copy the CID for the folder.

Image description

Open Visual Studio Code and go to the file.

Locate lines 16 - 25 in the file.

Image description

In line 17, paste the CID that you copied from Pinata. Make sure you pasted the CID correctly. It must go after the double forward slashes ( // ).

In line 18, choose a display name for the NFTs. In my case, I chose "Doge #", so when I generate the metadata, I will get something like "Doge #1" for the first NFT. "Doge #2" for the second one and so for and so on.

In line 22, add a description for your collection. It can be anything. Tell others about your collection.

Image description

Save the file.

Open a terminal, make sure you are in the generative-art-nft folder, and run the following command.

Enter fullscreen mode Exit fullscreen mode

You will be prompted to enter the name of your edition.

Enter edition you want to generate metadata for: 
Much Wow Doge Club
Enter fullscreen mode Exit fullscreen mode

Enter the name of you NFT collection and press enter.

The command above will generate the respective JSON data for the NFT collection.

You will see a new folder on the left side of Visual Studio Code named json with the metadata for each NFT.

Image description

Feel free to explore the files in the json folder. These files are a description of each NFT. They contain the name of each NFT and its properties.

However, you might notice that the files in the json folder don't have the .json extension. This seems to be a problem with the library itself.

What you can do is open the json folder and add the .json extension to all the files manually.

You can do this by selecting all files and renaming them in batch. You can do this on Mac and Windows.

Image description

After adding the .json extension to the files, you should see them show up with the right extension on the left side of Visual Studio Code.

Image description

Finally, go to Pinata again and upload the json folder in the same way that we did with the images folder in the beginning of this tutorial.

In the end, your Pinata dashboard should have two folders; one for the images and one for the json files.

Image description

In the next tutorial, we will need the CID of the json folder, so keep that in mind.

This is where we end this tutorial, but in the next one, we will be deploying our NFT collection on OpenSea.

If you can't wait to finish this series, you can check out the entire NFT video series which is already out on Youtube.

Don't forget to subscribe!! :)





MEDYC Collection

Top comments (0)

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<