Mint NFT to Multiple address

Is it possible to mint an NFT using the cardano-cli to multiple receiving addresses ? I know its possible with native tokens and payount address. Just wondering how to go about the same with an NFT ?

1 Like

Yes it is possible, and in fact the answer is in your question. NFTs ARE native (non-fungible) tokens.

In the same way that you can spread your input lovelace across multiple outputs, your mint (which could be seen as a “special kind of input” being created out of thin air rather than coming from a UTxO), can be spread across multiple outputs too.

As long as the sum of inputs (including mint) is equal to the sum out outputs + fee, your transaction will be valid.

1 Like

It’s not really an NFT anymore if there is more than one of it, though.

But you can also mint multiple different NFTs and send them to different addresses in a single transaction.

Yes, that’s what I meant. By definition an NFT is unique, and as you say, you can mint multiple in a single transaction. Any metadata file would contain multiple entries with the different token names under the same policy id entry. You could also mint NFTs with different policies in the same transaction by providing multiple policy scripts.

1 Like

…Even though the original question states “an NFT”, I interpreted it to mean more than one token from the same collection. Besides the fact that an NFT must be unique, the article “an” represents a unit value, which cannot be split across multiple outputs whether it represents an NFT or not. So interpreting the question as a single unit doesn’t make sense either way.

1 Like

Hi HeptaSean

Ok minting say 1 of 10 tokens if each had a different property like edition 1 of 10 then could that work ?

Hi grim

The objective is to give the tokens to a whitelist of address so wondered what the most cost effective way of doing this is hopefully involving a single transaction. I did see a post on another forum about using a list of --tx-out $address

I managed to mint NFTs to 24 separate addresses in a single transaction. This amount will depend on the output address size (whether they include a staking key) and the size of your metadata. I also included the 24 payment utxos as input so you may be able to fit more outputs if you don’t do this.

your transaction will look something like this:

cardano-cli transaction build
   --tx-in $payment1-utxo
   --tx-in $payment2-utxo
   --tx-in $paymentn-utxo
   --tx-out $profit-address + ($total payments - $fee) lovelace
   --tx-out $payment1-address + $min_utxo_value lovelace + 1 policyid.token1Hex
   --tx-out $payment2-address + $min_utxo_value lovelace + 1 policyid.token2Hex
   --tx-out $paymentn-address + $min_utxo_value lovelace + 1 policyid.tokennHex
  --mint 1 policyid.token1Hex + 1 policyid.token2Hex + 1 policyid.tokennHex
  --metadata-json-file metadata.json
  --fee=$fee

Moving the processed payments to a separate “profit” address makes it easier to distinguish new orders.

And your metadata.json will contain:

721:
   { "$policyid":
      { "token1":
         { ... token1 props
         }
      , "token2":
         { ... token2 props
         }
      , "tokenn":
         { ... tokenn props
         }
      }
   }
}

Important!: Token name in tx-out and mint must be the hex value but in the metadata it must be text

Note that what uniquely identifies a token is its policy id and name. Just having a different value in the metadata doesn’t achieve this. For your tokens to be proper NFTs, they must be minted with a time locked native script or with a Plutus minting policy script parameterised with a UTxO reference, and that UTxO must be used in the minting transaction.

For an NFT collection, the Plutus script approach would only work if you pre-mint your whole collection since the script hash will be your token’s policy id and this is what identifies all NFTs in the same collection.

For a time locked native script, unless you pre-mint your whole collection and set your script to expire soon after the transation completes, your customers will only be able to confirm the uniqueness of their NFT once the minting policy has expired.

3 Likes

Thanks Grim I will digest this then get back to you this could really help others and me.

Hi there @grim_i_am am re visiting this as I am getting ready to proceed with the native script.
So you know I am asking as this can facilitate an Airdrop to a number of wallets say 20.
If there is another way of doing this I am happy to be advised.

In reference to the above to recap the process do I have to set it as follows ;

tokenname=“myNFTname”
Token name convert to base16
tokenbase16=$(echo $tokenname | basenc --base16)

then

cardano-cli transaction build
–mint $policyid.$tokenbase16
–tx-out1 $targetaddr1
–tx-out2 $targetaddr2
–tx-out3 $targetaddr3

And so on ?

Hi @mattmco,

it will be more like:

token1_name=“myNFTname1”
token1_base16=$(echo $token1_name | basenc --base16)

token2_name=“myNFTname2”
token2_base16=$(echo $token2_name | basenc --base16)

token3_name=“myNFTname3”
token3_base16=$(echo $token3_name | basenc --base16)

then

cardano-cli transaction build
   --tx-in $utxo
   --tx-out "$targetaddr1 + $min_req_utxo lovelace + 1 $policyid.$token1_base16"
   --tx-out "$targetaddr2 + $min_req_utxo lovelace + 1 $policyid.$token2_base16"
   --tx-out "$targetaddr3 + $min_req_utxo lovelace + 1 $policyid.$token3_base16"
   --mint "1 $policyid.$token1_base16 + 1 $policyid.$token2_base16 + 1 $policyid.$token3_base16"
   --metadata-json-file metadata.json
   --fee $fee

and metadata.json as already outlined in one of my previous replies

Cheers
grim_i_am

Hi that looks good i can follow the first part.
How do you set the $min_req_utxo variable ?

cardano-cli transaction calculate-min-required-utxo --mainnet -tx-out "address + n lovelace + 1 policyid.tokenname1 + 1 policyid.tokenname2 ... "