Create NFTs on CARDANO #CNFT

NOOPS
2 min readApr 10, 2021

--

Twitter @NftPigeons

Join our discord server :
https://t.co/RVc8ZlUcOf?amp=1

Stake your ADA with NOOPS

1 Create a NFT payment addr (air-gapped offline machine)

  • Create a new payment key pair
cardano-cli address key-gen \
--verification-key-file nft-payment.vkey \
--signing-key-file nft-payment.skey
  • Build a payment address for the payment key
cardano-cli address build \
--payment-verification-key-file nft-payment.vkey \
--out-file nft-payment.addr \
--mainnet

2 Fund your NFT payment addr

Yoroi, binance, Daedalus, etc…

3 Create policy

  • Generate policy key (air-gapped offline machine)
cardano-cli address key-gen \
--verification-key-file nft-policy.vkey \
--signing-key-file nft-policy.skey
  • Hash your policy.vkey
cardano-cli address key-hash --payment-verification-key-file nft-policy.vkey
  • Add the policy.vkey hash to the policy.script
{
“type” : “all”,
“scripts” : [
{
“keyHash”: “
<policy.vkey-hash>”,
“type”: “sig”
},
{
“type” : “before”,
“slot” :
<slotplus1h>
}
]
}
  • Retrieve the policyid
cardano-cli transaction policyid --script-file policy.script

4 Add your NFT to IPFS

  • Register on blockfrost.io
  • Add your nft
curl "https://ipfs.blockfrost.io/api/v0/ipfs/add" \
-X POST \
-H "project_id: <PROJECT_ID>" \
-F "file=@<NFTFILE>"
  • Store the ipfs_hash

5 Create Metadata

  • metadata.json
{
"721": {
"<policy-id>": {
"Noops1": {
"id": 0,
"name": "<NFT_NAME> 0",
"image": "ipfs://ipfs/<IPFS_HASH>",
"tags": [
"<TAG1>"
]
},
"Noops2": {
"id": 1,
"name": "<NFT_NAME> 1",
"image": "ipfs://ipfs/<IPFS_HASH>",
"tags": [
"<TAG1>"
]
}
},
"description": "<DESCRIPTION>",
"creator": "<CREATOR>",
"publisher": [
"<PUBLISHER>"
],
"version": 1
}
}

4 Create the transaction

  • Check the utxo
cardano-cli query utxo --address $(cat nft-payment.addr) \
--mainnet
  • Build the transaction
tx_in="${tx_in} --tx-in ${in_addr}#${idx}"cardano-cli transaction build-raw \
$tx_in \
--tx-out $ADDR+0+"1 $POLICYID.Noops1 + 1 $POLICYID.Noops2" \
--mint="1 $POLICYID.Noops1 + 1 $POLICYID.Noops2" \
--metadata-json-file metadata.json \
--fee 0 \
--invalid-hereafter $slot1000 \
--out-file tx.raw
fee=$(cardano-cli transaction calculate-min-fee \
--tx-body-file tx.raw \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 2 \
--mainnet \
--protocol-params-file protocol.json | awk '{ print $1 }')

afterfee=$(($total_balance-$fee))
cardano-cli transaction build-raw \
--fee $fee \
$tx_in \
--tx-out $ADDR+$afterfee+"1 $POLICYID.Noops1 + 1 $POLICYID.Noops2" \
--mint="1 $POLICYID.Noops1 + 1 $POLICYID.Noops2" \
--invalid-hereafter $slot1000 \
--metadata-json-file metadata.json \
--out-file tx.raw

5 Sign the transaction (air-gapped offline machine)

  • Retrieve the tx.raw from your node
cardano-cli transaction sign \
--signing-key-file nft-payment.skey \
--signing-key-file nft-policy.skey \
--script-file policy.script \
--mainnet \
--tx-body-file tx.raw \
--out-file tx.signed

6 Submit the transaction

  • Retrieve the tx.signed from your offline machine
cardano-cli transaction submit --tx-file tx.signed --mainnet

--

--

NOOPS

Let me introduce our ADA pool NOOPS. We are here to support the Cardano network’s decentralization.