Minting NFT’s with attributes on ProtonChain

Thomas
8 min readFeb 4, 2022

--

Hello Protonians! A question I have been asked often lately is how to give an NFT stats, or attributes. I thought it would be helpful to make a guide walking through this process.

Here is an example of an NFT from my Monz collection where the NFT has immutable and mutable stats:

Before we actually get into the step-by-step guide, there are a few concepts important to know. First of all is the structure of an Atomic Asset NFT.

Pink.gg does a great job explaining this in their documentation, using Pokemon as an example. So we will do the same here.

Structure of an AA NFT:

Collection -> Schema -> Template -> Asset

-All NFT’s belong to a Collection. Think of the collection as the universe your NFT resides in (i.e. the entire world of Pokemon)

-Contained in that collection, you have Schemas. Think of Schemas as different categories within the collection. For example, in our Pokemon universe, we can have a Schema for Items and a Schema for the actual Pokemon themselves

-Contained in each Schema are Templates. Think of templates as the broad category for a specific item with in the schema. In our Item schema we can have a template for Healing potions and another template for pokeballs. In our Pokemon Creature template we can have a template for Charmander, and another template for Bulbasaur

-Within each Template are Assets. Assets are probably what you are thinking of when you think of NFT’s. These are what you can list for sale, buy, and trade. Within our Charmander Template, we could have 100 different Charmanders. They are all Charmander, but Charmander 1 might have 10 hp, and Charmander 2 has 5 hp.

Summary of a Pokemon system:

Immutable and Mutable

A couple more concepts to cover before get into the step-by-step guide. This is on immutable and mutable attributes.

Immutable: Cannot be changed

Mutable: Can be changed in the future

At various points in the creation we will be setting the attributes that make up our NFT. Examples of these attributes are things like name of the NFT, image of the NFT, description of the NFT etc. For our step by step example we will be making a “Protonmander” NFT and using attributes like this:

Collection:

Name of collection

Description of collection

Image of the collection

Schema:
At this stage we will define attributes to be used later. Basically, we will be creating attributes — but not setting a value to them. For example, we will create a stat called “HP” but we are not going to set a value to that HP (i.e. “10”) until later in the process. Attributes we will make are:

Name

Desc

Image

HP

Attack

Experience

Template:

This is where we set the value of the attributes that won’t change. All our Protonmanders will have the same Name, Description, and Image — so we will set those three attributes at this stage

Asset:

Here is where we will make our Protonmanders each unique. We will set the HP and Attack stat as immutable attributes and we will set experience as a mutable attribute.

Ok let’s make our NFT!

Step 1: Create the collection

To make our NFT we are going to directly interact with the Atomic assets contract. To do so, navigate here:
https://www.protonscan.io/account/atomicassets?loadContract=true&tab=Actions&account=atomicassets&scope=atomicassets&limit=100&action=createcol

Scroll down and you are presented with a few fields to fill out for our collection

Author: Your account

Collection_name: What we want to call our collection. NOTE: This must be either exactly 12 characters, or the same name as your wallet. “tutorialtest” is what we are using so you will need to make your own name for the rest of the tutorial

Allow_notify: Lets enable this so notifications are on for our collection

Authorized_accounts: Who can edit the collection. Your wallet should be here

Notify_accounts: Just your wallet for now

Market_fee: Royalty fee you want

Data: Here is where we set our image, description, and friendly name. This needs to be formatted as an array. If you aren’t sure on how to format that I will explain shortly, but first an example of how we are filling this out:

Two concepts to understand before moving on:

Filling in Data and uploading to IPFS:

Data structure/format

The easiest way to do this is first have it expanded like a standard JSON:

Example for our tutorial:

[ {

“key”: “description”,

“value”: [“string”, “This is a tutorial”]

},

{

“key”: “name”,

“value”: [“string”, “Tutorial Collection”]

},

{

“key”: “image”,

“value”: [“string”, “QmazXTYA4FjtuYMUGS6oaDDNhZ2jcUiSimRoiTKted63ro”]

}

]

As you can see, the Key has the title of the attribute next to it. Then in value we set what kind of attribute it is (i.e. string, which is text) along with the value of that attribute. For example, we have an attribute called “description” which we set as a string (text) and set that text to “This is a tutorial.” We could also set it as a number doing something like this:

{

“key”: “description”,

“value”: [“uint8”, 2]

}

But more on that later!

Images/IPFS

Now, if you aren’t familiar with IPFS, the crazy combination of numbers and letters in our “img” attribute may look confusing. But it is actually quite easy! This is how we upload and set our image.

First, navigate to this website: https://anarkrypto.github.io/upload-files-to-ipfs-from-browser-panel/public/

Then, upload your image as instructed on the website.

Finally, copy the has on the right side (screenshot below):

With that hash copied, we just need to paste it into the img section as demonstrated earlier!

We have one more step, and then we can submit and create our collection. For us to have this formatted properly, we need to shrink down that JSON file. This can be done easily with this website:

https://codebeautify.org/jsonminifier

Just copy and paste the JSON (including the brackets, [ ]) into the left side and click minimize!

Note: Sometimes when pasting an error can pop up, as long as you see the right side modify to minimize what was entered you should be good

Then copy the right side and paste into the data field on protonscan:

Now click submit transaction, approve in your wallet, and you have created the collection!

Step 2: Making the Schema

Now let’s make our protoncreature schema that our protonmander will belong to! A lot less to fill out in this step.

First, head here: https://www.protonscan.io/account/atomicassets?loadContract=true&tab=Actions&account=atomicassets&scope=atomicassets&limit=100&action=createschema

Authorized_creator: your wallet

Collection_name: The name of the collection we just made

Schema_name: What we want to name our schema. Let’s make it procreature (these must be between 1–12 characters)

Schema_format: another json! Remember: This is where we create all the attributes we want to use later.

Remember also: We are going to create our attributes here, but not set a value yet. So it will look a little different than our collection data. Here is the JSON we are going to use to define the attributes we discussed earlier:

[

{

“name”: “name”,

“type”: “string”

},

{

“name”: “desc”,

“type”: “string”

},

{

“name”: “image”,

“type”: “string”

},

{

“name”: “hp”,

“type”: “uint8”

},

{

“name”: “attack”,

“type”: “uint8”

},

{

“name”: “experience”,

“type”: “uint8”

}

]

As you can see, we are setting the type but are not defining it. You can also see we have values called uint8 instead of string. This is because we want to use integers for our stats instead of text. We are going to copy and paste this JSON into our minifier website again and condense for pasting into the data field. Then we can submit transaction and our schema is made!

Step 3: Creating template

Navigate here: https://www.protonscan.io/account/atomicassets?loadContract=true&tab=Actions&account=atomicassets&scope=atomicassets&limit=100&action=createtempl

Authorized_creator: your wallet

Collection_name: our collection name (tutorialtest)

Schema_name: procreature

Click transferable and burnable so we can transfer our nft and also burn if needed

Max_supply: our max supply of this NFT (note: 0 stands in for infinite)

Immutable_data: Data used for all the nft’s under this template and cannot be changed later

For this dataset, as mentioned at the beginning, all of our protonmanders are going to have the same name, description, and image — so we can go ahead and set those now

[

{

“key”: “name”,

“value”: [“string”, “protonmander”]

},

{

“key”: “desc”,

“value”: [“string”, “A fiery proton salamander”]

},

{

“key”: “img”

“value”: [“string”, “QmazXTYA4FjtuYMUGS6oaDDNhZ2jcUiSimRoiTKted63ro”]

}

]

Remember for image to use instructions from earlier to upload the image you want, and to plug that hash into the code here. Minimize, then paste into the data field, and submit transaction! Now we just need to mint our protonmanders!

Final step — Mint asset:

Before we head to mint our asset, we need to find the template ID that we just created. Navigate here: https://www.protonscan.io/account/atomicassets?loadContract=true&tab=Tables&account=atomicassets&scope=atomicassets&limit=100&action=mintasset&table=templates

In the scope field, enter the collection name you used before. Then find the latest template in the list (the last line). Write down the template id (2nd column)

Next-

Navigate here: https://www.protonscan.io/account/atomicassets?loadContract=true&tab=Actions&account=atomicassets&scope=atomicassets&limit=100&action=mintasset

Authorized_minter: your account

Collection_name: the collection name

Schema_name:

Template_id: the template id you wrote down in the last step

New_asset_owner: use your account for now

Immutable data: we are going to put hp and attack here, more on that later

Mutable data: we are going to put experience here, more on that later

Tokens_to_back: we are going to leave this empty so just use empty brackets (like this: [])

Immutable data and mutable data will be entered just like we have entered data in the last steps. For this example, we don’t want hp or attack to ever change so we are going to set it under immutable data. We want our protonmander to gain experience, so we are going to set that under mutable. Since our template is already loaded with the image, name, and description — we don’t need to worry about that.

[

{

“key”: “hp”,

“value”: [“uint8”,10]

},

{

“key”: “attack”,

“value”: [“uint8”,5]

}

]

Put into our minifier and paste into immutable

Now, experience

[

{

“key”: “experience”,

“value”: [“uint8”,2]

}

]

Into the minifier and paste into mutable

Now, submit transaction and you’ve minted our first protonmander! This would be our serial #1

Lets go ahead and mint our serial #2 but we are going to give him more hp. Just change the 10 in the hp section of the immutable data to 20. Then click submit transaction. After authorizing, we now have a 2nd protonmander printer, who has 20 health!

Now, head to your account page on protonscan.io. View NFT’s and click one of your protonmanders. When the page opens you should see its stats stored under immutable and mutable!

Make sure to check out pixelheroes.in and protonmonz.com for some of our collections!

--

--