Error while building transaction (--tx-out: unexpected 'n' expecting alphanumeric asset name, white space, "+" or end of input)

I was following this tutorial about minting nfts and when I entered this command to build the transaction: cardano-cli transaction build \

--mainnet \

--alonzo-era \

--tx-in 32b522ab6f403cf5032d4aed87673298ef5ef4f4af774b38307d2bf3fa645131#0 \

--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 got this error back: `–tx-out:
unexpected ‘n’
expecting alphanumeric asset name, white space, “+” or end of input

`

Any ideas on how to solve this? You can find the tutorial here->(Minting NFTs | Cardano Developer Portal)

Hi!,
My recomentation is don forget define variables as

tokenname1=“Testtoken”
tokenamount=“10000000”
output=“0”

export CARDANO_NODE_SOCKET_PATH="$HOME/TESTNET_NODE/socket/node.socket"

and add the variables related to libsodium
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

I got this same error.
The character being objected to (first letter of asset name) is alphanumeric so this seems like a bug.
I am using cardano-node version 1.32.1.
I was able to mint with an empty string as the asset name so there isn’t anything wrong with the variable settings or environment.
Did you ever find a workaround for this problem?

I filed a bug report on this.

FYI from the github issue discussion, you now need to specify asset names in hex.
You can do something like below to convert your asset name.

echo -n "MyAssetName" | xxd -b -ps -c 80 | tr -d '\n'

I submitted a pull request to fix the native asset and NFT minting docs to use hex asset names.

2 Likes