NFT syntax of names using cardano-cli

Hi guys, I’m minting NFTs by using Daedalus socket node and cardano-cli.
When it comes to build transaction I cannot set spaces or special characters in the asset name, it gives me error
but I see around a lot of NFT minted with a space in the name. How can I solve this problem?

Example:
–mint=“1 03840f1ca7480d2e07f272b954a14c8841e2528545d5d428cfa33569.Assetname”
here and in the --txout out section if I set “Assetname” it is ok, if I try to set “Asset name” or “Asset-name”
it gives me error and I cannot build the transaction!

Thank you!!

Did you use any quote around your asset name ? Could you provide the command line and the corresponding error message please ?

Thank you for the support, for sure: here it is the command and the error message

Cardano-cli complains about the space in between “test " and " test”. I tried writing 1 word
and putting spaces only in the metadata.json but then it is not visualized correctly on pool.pm

OK, so from the inline help of cardano-cli we have :

  --tx-out TX-OUT          The transaction output as Address+Lovelace where
                           Address is the Bech32-encoded address followed by the
                           amount in Lovelace.

It seems like you put the value for --mint= in place of the amount in Lovelace… There is more info on 3. Create a simple transaction — cardano-node Documentation 1.0.0 documentation

If I use just 1 word, for example instead of “test test” I use “test” it works.
Anyway I tried to remove the part from the tx-out command and the problem is also in the --mint command.
Here the command I used and the error I got:

So now the --txout part is ok, we can focus on --mint, if you refer to the doc you shouldn’t use quotes for the whole parameter value, only for the part with the asset name. Eventually you could remove the quotes and escape the space between ...test and test by prefixing it with a backslash, i.e. ...test\ test.

In other words, regarding mint parameter value "1 abc def" and 1 "abc def" are quite different, in first case you have one string parameter, in second case you have two.

Thank you again for the support.
I tried without quotes or putting quotes only to the policyID , assetname or only to the assetname and the result is always this one:
image

I used again the quotes as before and it gives me the error as before:
image

Also using "\ "before the space gives me problems:
image

I manage to build the tranaction only if I use the “old method” and so witohut spaces:

Ok, then I’ll try asking someone more knowledgeable than me.

By the way, have you got any example of such an asset, I mean with spaces in asset name and not in asset metadata ? I didn’t find one on pool.pm

The short answer to your question is that it’s not possible, as @bwbush made me remark, it is a current limitation of cardano-cli as you may see in the source code the parser only accepts sequences of alpha-numeric characters .

However @bwbush was able to use other characters using his own tools ; you’ll find many useful resources on his website. Finally he referred me to a current feature request concerning your current need for cardano-cli : [FR] - Extend CLI syntax for multi-asset names · Issue #2297 · input-output-hk/cardano-node · GitHub

1 Like

Here is the link to the tool I use to mint tokens whose names contain spaces and other non-alphanumeric characters: mantis/ReadMe.md at main · functionally/mantis · GitHub.

Thank you for the outstanding support! I’ll try and let you know in case of troubles.

Thank you again!

Hi folks, I’ve posted a question on github but has anyone else seen the TxMetadataJsonToplevelBadKey error when using the mantis tool to mint?

Cheers,
Rhys

I think this is a problem in the policy script that was provided to the tool. I’m responding on the github issue.

Sorry for my delay responding to the github issue you posted.

This bug is fixed in version 0.2.10.2, which is available on github now. Thanks for your patience.

Cheers Brian. As replied on github - tested and working perfectly. Thanks again for sharing your code with the community and allowing mere mortals to experiment with Cardano and blockchain.

Aroha from Aotearoa
Rhys

1 Like

Even with single word asset name, it is giving error on full node 1.31.0. If I remove the policyId and asset name from txn-out, then it gives error on --mint. I’m stuck here. Anyone help?

…/cardano/cardano-cli shelley transaction build-raw
–fee $txnfee
–tx-in “07a1a75d4d022c6bb988c9797862998d456a1384a83feb4af568b21fa4a0dec9#0”
–tx-out addr1qyk5z9eltwxy53anlulq0yx3npapvx2ghs80kg5ghszmsyp8jyyvzx6mjrlcv80q8a22rn3decgx47km3vj4ycdyhc2qj39khr+2828691+“1 614d432e7bfbad362a5b55fe7f86d5471add05d6a834972c0b0471dd.test”
–mint “1 614d432e7bfbad362a5b55fe7f86d5471add05d6a834972c0b0471dd.test”
–minting-script-file policy/policy.script
–metadata-json-file ./metadata.json
–out-file ./matx.raw
option --tx-out:
unexpected ‘t’
expecting alphanumeric asset name, white space, “+” or end of input

Hello,
is the syntax correct?
In my version I set " --tx-out=…" try to put the ‘=’ in the same manner as the pictures from my screenshots above and let me know if it works.

I already tried “=” for both tx-out and mint, same results.
I’m providing the asset name as is in plain text. Is the asset name supposed to be encoded or something?

The assetname should be plain test, for example “test” is good, it does not require any encoding .

Try to build the transaction with the same syntax and so "mary-era …etc, like I did in the previous screenshots. I am thinking that maybe there is some error with the Parser or there are specific syntax requirement for the “shelley-era” version that you are using.

I’m getting same error.

…/cardano/cardano-cli transaction build-raw
–mary-era
–fee 196521
–tx-in “7b6867ce124139051a3d79e2591557d60698419c183fc7b1a53f1527b1577307#0”
–tx-out=addr1qye0s7efe98gyd9jfrjqm0kmq96t6c9qlr8mjnfuk356lne8jyyvzx6mjrlcv80q8a22rn3decgx47km3vj4ycdyhc2q8sh6dm+1803479+“1 086c2ccb567991202a3e3bdc8c9f23567e54ad9cf2faff511cf99516.test”
–mint=“1 086c2ccb567991202a3e3bdc8c9f70563454ad9cf2faff511cf99516.test”
–minting-script-file policy/policy.script
–json-metadata-no-schema
–metadata-json-file metadata.json
–out-file ./matx.raw

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

Usage: cardano-cli transaction build-raw
[ --byron-era
| --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
]
[–script-valid | --script-invalid]
(–tx-in TX-IN
[–tx-in-script-file FILE
[(–tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)
( --tx-in-redeemer-file FILE
| --tx-in-redeemer-value JSON VALUE
)
–tx-in-execution-units (INT, INT)]])
[–tx-in-collateral TX-IN]
[–required-signer FILE]
[–tx-out ADDRESS VALUE
[ --tx-out-datum-hash HASH
| --tx-out-datum-hash-file FILE
| --tx-out-datum-hash-value JSON VALUE
| --tx-out-datum-embed-file FILE
| --tx-out-datum-embed-value JSON VALUE
]]
[–mint VALUE
(–mint-script-file FILE
[(–mint-redeemer-file FILE | --mint-redeemer-value JSON VALUE)
–mint-execution-units (INT, INT)])]
[–invalid-before SLOT]
[–invalid-hereafter SLOT]
[–fee LOVELACE]
[–certificate-file CERTIFICATEFILE
[–certificate-script-file FILE
[
( --certificate-redeemer-file FILE
| --certificate-redeemer-value JSON VALUE
)
–certificate-execution-units (INT, INT)]]]
[–withdrawal WITHDRAWAL
[–withdrawal-script-file FILE
[
( --withdrawal-redeemer-file FILE
| --withdrawal-redeemer-value JSON VALUE
)
–withdrawal-execution-units (INT, INT)]]]
[–json-metadata-no-schema | --json-metadata-detailed-schema]
[–auxiliary-script-file FILE]
[–metadata-json-file FILE | --metadata-cbor-file FILE]
[–genesis FILE | --protocol-params-file FILE]
[–update-proposal-file FILE]
–out-file FILE