In this article I will try to tell about creating NFT’s in the simplest way
At first we need a running AVALANCHE node and there should be a user and X address on it. I will put the commands below.
This is a mainnet article you can try these at FUJI testnet before creating NFT’s at the mainnet.
To create user
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"keystore.createUser",
"params" :{
"username":"mahof",
"password":"pass"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
To create X-address
curl POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.createAddress",
"params" :{
"username": "mahof",
"password": "pass"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
You will need to fund this wallet before you create the Asset.
At first we need to upload our picture to internet and it should not be deleted from there because we will encode this url and create our payload. I used www.imgbb.com because they say they do not delete pictures.I tried ipfs and drive links but they do not point directly the filename of the file and after encoding picture was not seen at the wallet. The filetype is png at my example I uploaded the picture and got the https://i.ibb.co/QHJ1HQJ/avx.png link pointing to the file.
Now most important part is creating payload at my example i used golang playground and put the code there https://play.golang.org/p/ItZqPyxBETn you can just change the URL and create your own payload.
Now we have our payload lets get in to the creating Asset of NFT
We will use our node to create the asset
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.createNFTAsset",
"params" :{
"name":"AVAX TOKEN 3D",
"symbol":"ANFT",
"minterSets":[
{"minters": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8", "X-avax1s3q7jnhthh3s5pvecx8z3m57un8wlm0mg6grtp"], "threshold": 1}, {"minters": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8", "X-avax1s3q7jnhthh3s5pvecx8z3m57un8wlm0mg6grtp"], "threshold": 1}, {"minters": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8", "X-avax1s3q7jnhthh3s5pvecx8z3m57un8wlm0mg6grtp"], "threshold": 1}, {"minters": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8", "X-avax1s3q7jnhthh3s5pvecx8z3m57un8wlm0mg6grtp"], "threshold": 1},{"minters": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8", "X-avax1s3q7jnhthh3s5pvecx8z3m57un8wlm0mg6grtp"], "threshold": 1}
],
"from": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8"],
"changeAddr": "X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8",
"username":"mahof",
"password":"pass"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
This command creates an asset and by increasing the minters line you increase the number of NFT’s they will all be at the same Asset. At this example there are minters line and it means i created 5 NFT’s
name: name of the asset which includes NFT’s
symbol: symbol of the asset
minters: first one is my X wallet at node second is my web wallet
answer of the command will be an Asset Id note it down
Now we have created NFT’s and the next part is minting.
We have created an Asset which can hold 5 NFT’s so we can mint 5 NFT’s
The code is below:
for n in {1..5}; do
curl -X POST --data '{
"jsonrpc":"2.0",
"id" : 1,
"method" :"avm.mintNFT",
"params" :{
"assetID":"2UL3Gnr9Cxdvyzk2ivESZYCc6HJgCJNTpDqwu3zSKHXwf4uVsM","changeAddr":"X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8",
"payload":"26po4UFBGGvZxficDMDdDudMgQewsWZDDcFTgC1BEsajH9dJuRYXzdm1r722rZoGnJxdpGUVbcgiobF8a",
"from": ["X-avax1jqn0utd3z9anlejs42jypk495tzs732jqsc9h8"],
"to":"X-avax1tkhk40ltcelzhel6ewgmxmkwg8cyvgrgzp067u",
"username":"mahof",
"password":"pass"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X ; sleep 2; done
assetid: the asset id we noted down
payload: the code we created from the go code
from: the wallet at node
to: the web wallet which you send the NFT’s
changeAddr: the wallet at node
If you did everything right in a few seconds you will see your NFT’s at your wallet.
Do not forget to clap and do not forget to send NFT’s you created to me
X-avax1kranq78dsaldrlq5x49p09vxm2rwyqwqhwefjk