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
*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)
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
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
- 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
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︎
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︎
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︎
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︎
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,