4

The developer guide doesn't cover this.

Here is an example of what I'm trying to do: https://cardanoscan.io/transaction/e1c7bc707e56bf37b4325dc4b7fe524eafe8ca746e54746d60b321588ffebb6c?tab=tokenmint

I tried making the metadata look identical in structure but cardanoscan says my transaction only minted 1 coin.

I want my mint transaction to have multiple asset names.

3

The process is the same but you need to specify in your cardano-cli transaction build command, all your assets to mint. For example:

cardano-cli transaction build-raw \
  --fee 197797 \
  --tx-in 6af4fea10fe3fd7120ab7e3f5361ae15d898f4fa6ebddcf585a80865010722dd#0 \
  --tx-out $(cat key1/payment.addr)+15850022+"1 $(cat policy.id).nft1"+"1 $(cat policy.id).nft2" \
  --mint="1 $(cat policy.id).nft1"+"1 $(cat policy.id).nft2" \
  --minting-script-file policy.json \
  --metadata-json-file metadata.json \
  --invalid-hereafter=41797828 \
  --out-file transaction.raw

And of course, modify your metadata to have all your assets.

UPDATE Consider that from cardano-cli v 1.31, your asset names should be base16-encoded, this is only for the build-raw command.

Your metadata.json should look like this:

{
    "721": {
        "1573568cde0f3c340266e50f0d108795f5e4190de939081f15287a24": {
            "nft1": {
                "name": "nft#00001",
                "image": "ipfs://QmfVzQceRW7Awo1t82CrzdLeoLddQqz4SB3kNC2wiWyGAs",
                "mediaType": "image/gif",
                "description": "My TEST NFT 00001",
                "propety1": "Serie 1",
                "propety2": "Red"
            },
            "nft2": {
                "name": "nft#00002",
                "image": "ipfs://QmfVzQceRW7Awo1t82CrzdLeoLddQqz4SB3kNC2wiWyGEs",
                "mediaType": "image/gif",
                "description": "My TEST NFT 00002",
                "propety1": "Serie 1",
                "propety2": "Black"
            }
        }
    }
}
2
  • Can you include here an example of what metadata.json might look like for multiple nfts?
    – melchoir55
    Dec 17 '21 at 4:03
  • 1
    Done, check my updated answer.
    – georgeos
    Dec 17 '21 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.