Cardano-cli error during NFT minting

cardano-cli is saying “option --tx-out: unexpected end of input expecting hexadecimal digit AssetName deserisalisation failed”

I’m running cardano-cli 1.31 on a synced up node.

This was the command:
cardano-cli transaction build
–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 followed these instructions.

The deviation from the doc I made was to convert the text of the AssetName to base16. It’s not base16 in the metadata.json file, but the input parameter validation is stopping before getting to --metadata-json-file so…

Anyway, not finding much out there on what could be wrong. Is there more to tack on to --tx-out that’s not being explained in the dev document perhaps?

Ok…I think I figured it out…maybe. I don’t see this documented anywhere. Since I’m running cardano-cli 1.31 the AssetName text must be converted to base16 (Hexadecimal). Not documented by the developers on the how to mint NFT page. Also, it appears to be required to add a delimiter character at the end of the AssetName value. So slap a hex code of 20 on the end of that string. Seems like it’s needed on the --mint parameter as well…wheeee…not having adequate documentation makes me want to use other protocols.


my mint code looks like this and works well (after upgrading 1.31).
I used the same guide but it has been changed since I used it.

funds=cardano-cli query utxo --address $(cat /opt/cardano/cnode/priv/wallet/payment.addr) --mainnet | tail -n +3 |head -1 | awk {'print $3 '}
tx_in="–tx-in ${tx_hash}#${idx}"

((maradek = funds - amountToSendUser))

            currentSlot=$(cardano-cli query tip --mainnet | jq -r '.slot')
            cardano-cli transaction build-raw \
                --fee 0 \
                ${tx_in} \
                --tx-out ${in_addr}+${amountToSendUser}+"1 $POLICYID.${tokenname}" \
                --tx-out ${paymentAddr}+${maradek} \
	    --mint="1 $POLICYID.${tokenname}" \
	    --minting-script-file $scriptPath \
	    --metadata-json-file ${metadatajson} \
                --invalid-hereafter $(( ${currentSlot} + 10000)) \
                --out-file tx.tmp >> $log
            fee=$(cardano-cli transaction calculate-min-fee \
                --tx-body-file tx.tmp \
                --tx-in-count 1 \
                --tx-out-count 2 \
                --mainnet \
                --witness-count 2 \
                --byron-witness-count 0 \
                --protocol-params-file protocol.json | awk '{ print $1 }') >> $log
        fee=${fee%" Lovelace"}
            cardano-cli transaction build-raw \
                --fee ${fee} \
                ${tx_in} \
                --tx-out ${in_addr}+${amountToSendUser}+"1 $POLICYID.${tokenname}" \
                --tx-out ${paymentAddr}+${maradek} \
	    --mint="1 $POLICYID.${tokenname}" \
                --minting-script-file $scriptPath \
	    --metadata-json-file ${metadatajson} \
                --invalid-hereafter $(( ${currentSlot} + 10000)) \
                --out-file tx.raw

Thanks for the example, think I’ll try again. Would you happen to have an example of what your metadata json looks like?

1 Like

Hi, it seems that I have similar problem. Did you manage to resolve it?

I haven’t had a chance to try macracanta’s example yet, maybe try that.