Getting a syntax error on a BUILD command using "cardano-cli"

So I have been trying to follow this guide.

I am at the build command part. And I cannot for the life of me figure out what the issue is. Obviously there is an issue. I’m trying to figure out how to fix it. I believe it might just be a simple syntax error.

So I issued the following command on a server with a live running cardano node. I did remove the "–alonzo-era " line that was directly underneath "–mainnet ".

cardano-cli transaction build
–mainnet
–tx-in $txhash#$txix
–tx-out $address+$output+“$tokenamount $policyid.$tokenname”
–change-address $address
–mint=“$tokenamount $policyid.$tokenname”
–minting-script-file $script
–metadata-json-file metadata.json
–invalid-hereafter $slotnumber
–witness-override 2
–out-file matx.raw

I get the following response:

option --tx-out:
unexpected ‘P’
expecting hexadecimal asset name, white space, “+” or end of input

Followed by all the options of the build command and then at the very bottom it also states:

Build a balanced transaction (automatically calculates fees)

Please note the order of some cmd options is crucial. If used incorrectly may produce undesired tx body. See nested notation above for details.

I went and looked at the CARDANO-CLI documentation but I am not finding anything helpful. Thank you for taking the time to read. I am open to being educated. Kresp.

I probably should have included what were in the variables.

$txhash - This has the hash that I got from the “cardano-cli query utxo --address $address --mainnet” command.
$txix “0” - Also obtained from the above query utxo command
$address - Contents of my payment.addr file which has my public cardano address in it
$tokenamount - “1”
$policyid - This does have the policy ID hash that I generated earlier
$tokenname - “PrintCafe”
$script - “policy/policy.script”
$slotnumber - “150000000”

The token name has to be in hexadecimal not as text.

One way to encode is shown in the “Set variables” section of the guide you linked:
https://developers.cardano.org/docs/native-tokens/minting-nfts/#set-variables

Thank you so much HeptaSean. That was not something that was necessarily on my radar. But I have changed it to hexadecimal and I got the tx to build properly. So it appears to have minted my NFT. But when I go to pool.pm to view it, nothing is displayed. I had uploaded the image to pinata and in my metadata.json file I had the image referenced like so:

“image”: “ipfs://QmY2oprQLi27w5Yvg3UXDjHTuQK3DuCZy3DS155D1KYdxm”

The address it was minted under is:

addr1vx3nrkglncj2ft9xarh88604585zzdtf7jyg9qw5hdr33mst64ejf

I admit that my knowledge of NFTs is a bit limited. But I definitely want to learn. Is there a reason why my image is not being displayed? Are there any good sources of information that I can read that will help me understand better how I am to mint NFTs properly where the image shows up? Thank you in advance for your time. It is appreciated. Kresp.

Your mint transaction is: https://adastat.net/transactions/c4c91e1ef81aa3c7c71c01a67eb60187817db84a2444d0a9c1eff84df236153c

There, we can see that you added metadata for the token with the asset name “PrintCafe-0000000001”. But your asset name is (the hexadecimal encoding of) “PrintCafe”. Those two are not the same. So, pool.pm and all others do not consider this to be metadata for that token. The asset names have to be exactly the same.

Thank you so much. I’m guessing since I set the policy up for just 1 NFT I won’t be able to mint a second one? I probably need to go back to the beginning and start over. I appreciate you taking the time to help me. Successful minting of an NFT here we come. :=)

Few thoughts:

  • It’s really much cheaper to do such experiments on one of the testnets, Preprod or Preview.
  • With CIP-25, you can update the metadata of an NFT even after you have already sent it away by minting a second one with exactly the same policy ID and asset name and immediately burning it again. The spec says that the metadata at the latest mint transaction is used. It does not have to be the mint transaction that individual token was minted in.
  • Since you are just experimenting around, the difference to burning this one again and starting over is not that big. It would be relevant if you had already sent the NFT to someone else and don’t want to or can’t get it back.
  • Maybe, also look into CIP-68. It’s the newer NFT metadata standard that is increasingly used, works better with Plutus contracts and has some other advantages. But it’s also more complicated with two tokens – one reference token that carries the metadata (that can be modified by whoever holds it, typically the issuing project) and one user token that is meant to be transferred to the actual owner of the NFT.

Thank you very much. I am interested in CIP-68. I have a use purpose in mind. The testnets are not a bad idea. I guess I would need to set up a testnet node. By the way I was able to successfully mint the NFT and have it show up. All I did was change the hexadecimal data to match and viola! I’m not sure I would have figured that out very quickly if ever. So I do appreciate your help.

I am working on a website where I want to sell a physical product that will be shipped. I have this idea and I wondered if you could confirm that it will work? My understanding of CIP-68 would indicate to me that it will.

  1. Customer places order. Website requests a receiving Cardano Address for reception of an NFT. Customer supplies said address. Website then sends customer a Cardano NFT and at the same time presents a crypto address for payment of their order on the site. Customer receives NFT which states the website is awaiting payment. Customer sends crypto payment to the address provided and as soon as the payment hits the address I want the website to update the customers NFT to indicate their payment has been received and their order is now being prepared for shipment. When the order is actually shipped I want to be able to enter the shipping details along with the tracking number to the order via a backroom management screen on the site. The website would then update the customers NFT to indicate their order has shipped and provide the customer with the tracking number displayed on their NFT that they were sent at the very beginning of the interaction on the website. When customer receives their order I want the customer to be able to return to the website and indicate that their order was received in good order. At that time the website will update their NFT one last time to a collectible of some sort. A collectible NFT. I’m still working out exactly what that might be.

My question is. Is the above scenario something I can accomplish using the CIP-68 NFT specification?

Again, thank you so much for your time. I’m going to owe you a cold one by the end of our interaction. Kresp.