Cardano-cli 1.31 --tx-out unexpected end of input expecting hexadecimal digit AssetName deserisalisation failed

  1. is deserisalisation a real word?
  2. This example doesn’t work… Minting NFTs | Cardano Developer Portal

So I get to the part where I’m building my transaction for the NFT.
First attempt I followed the instructions literally. This fails with option --tx-out: unexpected 'R' expecting alphanumeric asset name, white space, "+" or end of input message.
So I google around and found a few points where folks say due to 1.31 the $tokenname needs to be in base16. So I do that because others say it fixed their issue.

Ok…but now I get option --tx-out: unexpected end of input expecting hexadecimal digit AssetName deserisalisation failed.

What could I be doing wrong?

Would anyone happen to know of a working example of creating an NFT using cardano-cli v1.31 specifically?

1 Like

Serialization typically refers to the process of encoding or writing DTO hashes. Whereas de-serialization is the opposite where you decode or read the original value from the representation. In the case of base16 it just means a hexadecimal representation.

e.g. “Curtis” the string of single byte ANSI characters would be 437572746973 serialized as base16. You can reverse the process by de-serializing the numeric representation back where 0x43 = ‘C’ and so on …

The documentation is scattered, outdated, and quite pathetic compared to other projects. Without seeing the command you used to generate the errors it would be guesswork. However a cursory search of github should easily turn up a script or wrapper for this kind of thing. Just make sure you read and understand the code BEFORE using it :wink:

https://github.com/search?q=cardano+NFT

Ya, was kidding about spelling of the word in the error output.

I ran out of steam yesterday after going through that tutorial and simply trying to find a reference on using the command that explained the process.

Now I get to sift though a bunch of over engineered and maybe even wrong methods for doing it on github…but there has to be at least one working example for 1.31 right?

Spaces in the asset name should be fine, so as long as it’s in base16 right?

Correct. Space is just a number as well (0x20 in hex)

Ya, I’m good there on the spaces. Wondering what the cardano-cli error “unexpected end of input expecting hexadecimal digit” intends to mean. Clearly it’s saying unexpected end of input…but that’s odd because the switch is --tx-out…so I suspect it means the value passed to --tx-out is failing an input validation of some kind. Is there a limit to the string length maybe?..expecting hexadecimal digit?..lol…that just sounds funny together. Should the token amount also be a hex value? Should the whole entire string be converted to base16 prior to passing to --tx-out?

You can have multiple --txIn and --txOut but keep in mind the CLI is a space delimited parser. That’s one of the reasons it works better to base16 encode asset name. The policy ID of course is already a base16 identifier. Another trick is to quote or escape larger commands to help the shell and haskell program interpret things the way you meant. Last thought would be using environment or shell variables to reduce the parsing errors.

e.g. You can use variables with values or paths to files that have the values etc.

txnfee = 500000
txin = "yourInputHash"
txout = "yourOutputHash"
mint = "1 yourPolicyId.yourAssetNameHash"
policy = pathToYourPolicyScript
meta = pathToYourMetaDataJson

cardano-cli transaction build-raw
--fee $txnfee
--tx-in $txin
--tx-out $txout 
--mint $mint
--minting-script-file $policy
--metadata-json-file $meta

What do you mean to say when you say “yourOutputHash”?

Are you saying the entire string input into --tx-out must be deliberately converted to base16?

In other words, are you saying the following would need to be converted to base16 before being passed to --tx-out? or do you mean something else?

$address+$output+"$tokenamount $policyid.$tokenname"

Variables based on the example link in my first post.

These are just placeholders for your values such as wallet addresses, datums, etc meant to illustrate the example of using variables to organize your shell script if you try that method.

I use the term hash loosely because to me it simply means any data encoded for a computer rather than for a human. I consider wallet addresses to be hashes as well because it’s gibberish to me even though I know how they get generated.

Ok so are you saying you don’t know or yes the entire string must be base16 for each of those parameters?

1 Like

I guess it’s confusing in that some of the values are already “hashed”.

Do we know of any definitive documentation on the input requirements for those parameters published by IOHK?

Ok…so I need to put hex code 20 at the end of the base16 AssetName it seems. I’m getting really tired of crappy documentation.

1 Like

Trailing space seems odd or perhaps masking a bug/issue but you are not wrong, third party development support is basically non-existent compared to other projects. The expectation seems to be learn haskell then plutus. Afterward you may be equipped to scour through the source code to figure out how things work by reverse engineering. I am only partially joking …

Can you post your entire transaction build-raw command?

Im having the same issue I think - would love if you or someone can review my code:

cardano-cli transaction build-raw
–fee 188865
–tx-in 48e56e4f06370a4f6c2da00d32104f9db50108e9191a4239fdfb1b0830e61b80#0
–tx-out $(cat payment.addr)+4811135+“1000 $(cat policy/tokens/policy.id).SilverCoin”+“1000 $(cat policy/tokens/policy.id).GoldCoin”
–mint=“1000 $(cat policy/tokens/policy.id).SilverCoin”+“1000 $(cat policy/tokens/policy.id).GoldCoin”
–minting-script-file policy/tokens/token_policy.script
–metadata-json-file policy/tokens/token_meta.json
–out-file token_tx.raw