Step 2: Upload metadata
We need to create the metadata file for every image inside the images folder, so in our case that's a total of three metadata files.
Every image in the collection is described by its metadata file, and the metadata file has to be named the same way as the image it describes. So for image "0.jpg" we will create a file named "0", for image "1.jpg" we will create a file named "1" and so on. These files have no extension in the file name and will be stored in the separate folder. I'm going to name the folder "metadata", but the folder name as in the step before is irrelevant.
The metadata files are standardized across the NFT space and they're used to fully describe collection items. Some of the possibilities for the metadata file are outlined here. You will be able to find your NFT on any popular marketplace if you define the metadata files correctly.
We uploaded three images for our test collection, so we need to create three metadata files. In your case, numbers might be different. Here's the example of how our file "0" looks like:
The image field is very important here. Note that we have used the CID from the previous step to build the image URL. It always starts with:
ipfs://
Then goes the CID value from the step 1 (Upload assets chapter). In our case, that's:
QmT8kRCYyZ4VUFd2r3xYZj81uyE7M2S4RYgVp5vcqcr32W
and finally the concrete image name described by the metadata file, in this case it's:
/0.jpg
Combining all of these together, you get the full link pointing to the image 0, which is:
ipfs://QmT8kRCYyZ4VUFd2r3xYZj81uyE7M2S4RYgVp5vcqcr32W/0.jpg
The name and the description values in the metadata file are arbitrary, and you can put any text there. For more customization options, check the docs where you can find detailed information on all the properties which you can use to describe your items in more detail.
The rest of the metadata files are built the same way, by creating the files "1", "2" and so on. The image URL will be different in these new files. Depending on the concrete metadata file, the image URL will have /1.jpg or /2.jpg
and so on, depending on the metadata file and the collection item you're describing.
We've created three item descriptions for our test collection, using the text editor of choice: Visual Studio Code - but you can use whatever text editor you're comfortable with. All the files are in the same folder, which we named: "metadata". Files with their content are shown below (all of them opened in different tabs for you to see everything at once):
Once you've created your own metadata files, you have to upload the folder to the IPFS the same way we did in the step before. We'll do this again using the Pinata service, and this step is shown in the short video below:
The result of the upload process is the CID hash of the uploaded metadata folder. In our case, the value is
QmYimyZwYP43qWeqj27UiSgZRQLErcCkdt94MEPhDALvko
This is the main hash describing our test NFT collection, and we are going to use it in the next step to actually deploy the smart contracts and connect them with the hash above.
Last updated