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.

2 Likes

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