MINT/BURN assets via CNTOOLS + register ASSET

Hi

For today I want to share with you how easy is to mint ASSETS/NFTs with CNTOOLS
Enjoy!

STEP 1 - upload the file on IPFS server (I’m using pinata services but there are more services) all u need is the CID of the file which will be used later inside the metadata file

STEP 2 - create the policy ID

  • start CNTOOLS in advanced mode
./cntools.sh -a 
  • navigate to >> ADVANCED >> MULTI-ASSET >> CREATE POLICY

image|600x

*if you want to create a collection then keep the policy unlocked for more time (months or even 1 year) by setting a higher TTL value, if not you can lock the policy after 1 day but if the policy TTL will expire you will can’t modify the asset anymore

  • close CNTOOLS and nagivate to the folder created:
cd /opt/cardano/cnode/priv/asset/
  • here u should see the folder created from CNTOLS, and inside the folder you will find the POLICY files
vmi438734:~$ cd /opt/cardano/cnode/priv/asset/
vmi438734:/opt/cardano/cnode/priv/asset$ ls -l
total 8
drwxrwxr-x 2 user user 4096 Mar  2 09:47 NatureArt
drwx------ 2 user user 4096 Feb  8 09:47 winter_collection
vmi438734:/opt/cardano/cnode/priv/asset$ cd NatureArt/
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$ ls -l
total 16
-rw------- 1 user user  57 Mar  2 09:47 policy.id
-rw------- 1 user user 163 Mar  2 09:47 policy.script
-rw------- 1 user user 180 Mar  2 09:47 policy.skey
-rw------- 1 user user 190 Mar  2 09:47 policy.vkey
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$

STEP 3 - create METADATA for asset

  • inside the Nature folder create the metadata file (this is just an example, more details/infos can be added)
  • inside the metadata.json you will need to add the POLICY ID, which can be find with the command cat policy.id
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$ cat policy.id
f81a50437036f7a31673bf18d0ece864d7e805b925d81db94c6a91d4
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$
  • update the METADATA with the policy ID
nano metadata.json
{
  "721": {
    "f81a50437036f7a31673bf18d0ece864d7e805b925d81db94c6a91d4": {
      "NatureArt": {
        "name": "Crazy Eyes",
        "description": "Art created by nature",
        "image": "ipfs://Qmcpxxnt3tNfktiPRK7B6ajVgMnq3xQTBAZaA9AHur2MoK",
        "collection": "Nature Art",
        "author": "AlexD",
        "publisher": "https://charity-pool.ro/#nfts",
        "disclaimer": "photo by AlexD - Black Sea 2022"
      }
    }
  }
}

f81a50437036f7a31673bf18d0ece864d7e805b925d81db94c6a91d4 - is the POLICY ID
Qmcpxxnt3tNfktiPRK7B6ajVgMnq3xQTBAZaA9AHur2MoK - is the CID from IFPS server (STEP 1)

you can test the metadata here - pool.pm before to MINT the asset

  • check if the METADA file was created and if it’s correct
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$ ls -l
total 20
-rw-rw-r-- 1 user user 445 Mar  2 09:56 metadata.json
-rw------- 1 user user  57 Mar  2 09:47 policy.id
-rw------- 1 user user 163 Mar  2 09:47 policy.script
-rw------- 1 user user 180 Mar  2 09:47 policy.skey
-rw------- 1 user user 190 Mar  2 09:47 policy.vkey
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$

also u can create the METADA inside of CNTOOLS >> ADVANCED but it will be saved in different location (tmp/cntools)

STEP 4 - MINT asset

  • open again CNTOOLS in advanced mode
./cntools.sh -a
  • navigate to >> ADVANCED >> MULTI-ASSET >> MINT ASSET and select the right policy

  • type the Asset Name which u wrote inside metadata file ( Asset Name must be exactly the asset name from metadata file, otherwise the image will not be shown on pool.pm, etc)

image|600x

here you can chose the amount to be minted

  • choose Yes to attach a metadata JSON file, and search for the file

  • you must type/write the all path to the metadata file and press OK
  • choose the wallet which will pay the transactions and which will receive the ASSET/NFT

image|600x

If u receive the WARN: Balance mismatch, just press any key and wait more minutes (up to 20/30 minutes) before to check for the ASSET on pool.pm (it’s because of congestion)

  • check the ASSET/NFT on pool.pm by wallet address

STEP 5 - update the policy on pool.pm

  • go to pool.pm an search for asset >> click on policy

image|600x

  • you will need to paste the policy.script output from the asset folder
vmi438734:/opt/cardano/cnode$ cd priv/asset/
vmi438734:/opt/cardano/cnode/priv/asset$ cd NatureArt/
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$ ls -l
total 24
-rw-rw-r-- 1 user user 445 Mar  2 10:12 metadata.json
-rw-rw-r-- 1 user user 270 Mar  2 10:13 NatureArt.asset
-rw------- 1 user user  57 Mar  2 10:11 policy.id
-rw------- 1 user user 163 Mar  2 10:11 policy.script
-rw------- 1 user user 180 Mar  2 10:11 policy.skey
-rw------- 1 user user 190 Mar  2 10:11 policy.vkey
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$ cat policy.script
{ "type": "all", "scripts": [ { "slot": 54649606, "type": "before" }, { "keyHash": "5d2fa1b010f072c0e36a1b9dacf375a56515793f2266e5928397e10f", "type": "sig" } ] }
vmi438734:/opt/cardano/cnode/priv/asset/NatureArt$
  • copy and paste the policy.script on pool.pm

now it must show registered

CONGRATS, you created your NFT by yourself and you paid only ~0.2 ADA for transaction fee :muscle:

BURN NFT

  • open CNTOOLS and navigate to ADVANCED >> MULTI-ASSET >> BURN ASSET
  • select the ASSET and press enter

REGISTER ASSET

you have the possibility to register the asset also from CNTOOLS but before you will need to Build token-metadata-creator

Build Instructions:anchor:

An alternative to pre-built binaries - instructions describe how to build the token-metadata-creator tool but the offchain-metadata-tools repository contains other tools as well. Build the ones needed for your installation.

Step 1 - Clone the repository:anchor:

Execute the below to clone the offchain-metadata-tools repository to $HOME/git folder on your system:

cd ~/git
git clone https://github.com/input-output-hk/offchain-metadata-tools.git
cd offchain-metadata-tools/token-metadata-creator

Step 2 - Build token-metadata-creator:anchor:

You can use the instructions below to build token-metadata-creator , same steps can be executed in future to update the binaries (replacing appropriate tag) as well.

git fetch --tags --all
git pull
# Replace master with appropriate tag if you'd like to avoid compiling against master
git checkout master
$CNODE_HOME/scripts/cabal-build-all.sh

The above would copy the binaries into ~/.cabal/bin folder.

Step 3 - Verify:anchor:

Verify that the tool is executable from anywhere by running:

token-metadata-creator -h

Step 4 - go to CNtools >> ADVANCED >> MULTI-ASSET >> REGISTER ASSET

For decimals, here are 2 examples:
1.if u will want to mint 5000 tokens and u will want to use 3 decimals u must mint 5000000
Total Supply will be 5,000.000

2.for 1000 tokens and 4 decimals u must mint 10000000
Total Supply will be 1,000.0000

Step 5 - submit and create a pull request for metadata registration (follow the steps)

Thank you,

5 Likes

easy going process :slight_smile:
amazing presentation

1 Like

Thanks Alex, this looks good.

1 Like

I tried it and I keep getting the same error as before.

But if u test the metadata on pool.pm is fine?

I have cntools version 9.0.7 and cardano-node 1.34.0

image

I just checked the metadata and is fine … then it must be the node-version or the cntools version

is there a size limit to the jpg?

I don’t know what is the maximum size but few Mb should not be a problem

My node version is 1.34.0 and cntools is 9.0.7
the metadata check good in pool.pm but when minted the “721” removed

should work…
can I try to mint one for test? I will burn it after…

1 Like

image

can I try to mint 1?

I tried, and with your metadata doesn’t work, let me test something///

  • can u try to rename the picture .png and the mp3 to convert it to wav?
    I found another example of songs minted…
1 Like

Yeah, you can test whenever you need with my data I appreciate you trying. I’ll try the wav and png in a few hrs.

Just tried the png and wav file test. I got the same results… actually the wav failed the metadata test but I tried anyway.

I want to add some self advertising for the transaction editor, which simplifies your work for many task you would use the cardano-cli

I also recorded a video on how to mint tokens with this tool.

1 Like

update:
!!! Asset Name must be exactly the asset name from metadata file, otherwise the image will not be shown … (many thanks to @HeptaSean who opened my eyes)

1 Like

did u fixed? I updated the guide. see my last comment

1 Like

I saw you set the Asset Name Someday but inside the metadata u wrote Toxic… so both must match

1 Like

Hey, Thanks for the follow up! Yes, that worked!

1 Like

I made several policy’s trying to resolve this issue. Is there a way to burn the policy’s I’ve made? I do see the token burn feature in cntools.