Cardano CLI - Cardano Transaction Build for NFT from Guide Docs

Hi!

As per title, want to ask about cardano-cli transaction build for NFT, that I read on this guide or maybe this one

On near the last step, where it says about Minimum required UTxO - I wonder, if we can automatically handle it, so we don’t need to change the variable of that minimum UTxO (yes, minimum UTxO, NOT Minimum Fee).

Is that possible? If yes, what command / option needed on that particular case?

Reason is, if we want to build, like a single command (or automation), to mint an NFT, we couldn’t, since we don’t know for sure if the Minimum required UTxO is enough (which, 1.4 ADA) or not.

Example, what if, suddenly, it’s more than 1.4 ADA? We do need to change it manually, then hit it again. Which I think, it’s a hassle.

Thanks!

1 Like

Calculation is explained here: https://docs.cardano.org/native-tokens/minimum-ada-value-requirement

It depends, for example, also on the length of the asset names.

It would perhaps be easier to just take a fixed value that is comfortably enough, say 2 ADA.

1 Like

Hi!

Thanks for your hint!

I’m super confuse, as they had 2 (or maybe more) official docs and sometimes, both kinda says different and/or on 1 guide it has detail and the other doesn’t have any. :confused:

*back to the topics.
I wonder, if there’s a more simpler terms for this kind.
Since, when I try to look on the parameter. For example, when I do cardano-cli query protocol-parameters --testnet-magic 1097911063 --out-file protocol-parameters.json, and look for a variable named adaOnlyUTxOSize - I couldn’t found it.

So, I think, I kinda lost in their terms.

And also, when I try (without any --…era)

cardano-cli transaction calculate-min-fee …

With tx-body-file is newly created matx.raw, it shows different amount.

202681 Lovelace

Here’s the amount I got when I do (as per guide), but I set the fee to be 0.4 ADA (to see the Minimum required UTxO)

cardano-cli transaction build --alonzo-era …

Command failed: transaction build Error: Minimum UTxO threshold not met for tx output: [address] + [minimum_required_utxo] lovelace + 1 [policy_id].[hash_nft_name]
Minimum required UTxO: Lovelace 1379280


Lastly,
  1. Is - Minimum Fee ada value requirement (The link that you provided) means Minimum required UTxO?

  2. For your suggestion,

I wonder, as your experience so far, is there any Minimum required UTxO that > 2 ADA?
What I’m thinking now is, to set that 2 ADA (or maybe 1.8 or below) regardless, so I wouldn’t need to hassle things to calculate Minimum required UTxO. To be honest, the more I try to understand your provided link, the more confuse I become :disappointed_relieved:

*PS: I forgot to say, that I’m trying on testnet network

Thanks anyway!
Sorry if I’m asking too many basic stuff & question. :sweat_smile:

Yes, the documentation is a mess. And now that you say it, I’m not even sure the one that I linked is up-to-date.

The only way would be to look in the code of cardano-cli/cardano-node itself, but I don’t have time for that, right now, unfortunately.

Transaction fee and minimum required UTxO are two totally different things.

The transaction fee is collected and distributed to the pools having minted blocks in the current epoch. It depends on the size of the whole transaction including metadata, signatures, …

The minimum required UTxO goes to the receiver of the transaction. It is not lost in the same way as the transaction fee and is just a minimum of what needs to be transferred. It depends only on the transaction outputs, not on the rest of the transaction size.

The link talks about “Minimum ada value requirement”, not about fees. And, yes, that is the “Minimum required UTxO”. But the calculation may have been updated.

In the linked article, there are already examples with much larger minimum required UTxOs, but that only happens if you have lots of different tokens in the UTxO.

Since you want to mint NFTs and will only send one NFT with the output, it should stay way below 2 ADA.

I’d guess the minting will be paid by the users? Then, it doesn’t matter that much I think.

With the exact amount, you would say “You pay 3.41234 ADA and get 1.41234 ADA back together with the minted NFT.”, with some large enough fixed amount, you say “You pay 4 ADA and get 2 ADA back together with the minted NFT.”. In the end, it’s the same for you as well as for the customer.

1 Like

The command you are looking for is:
cardano-cli transaction calculate-min-required-utxo

Given a --tx-out it will give you the minimum amount of lovelace that that output will need to contain.

2 Likes

Seems the docs kinda updated but only on some-part(?) :confused:
But, anyway, thanks for the refs!

–Back to topic
Thanks for your detail the explanation! It kinda helps me!

And yes, I only send one NFT with the output, but at this stage, I did “paid” the NFT I mint (just for test and some case I had).
The example you give is kinda help me! Thanks! :star_struck:

Hi! Thanks for that!
I think that is the command I’m looking for!
When I cross-check the result, the Lovelace output is same!
I’m not sure if it’s exactly the same calculation used between transaction build (nft version from docs) and transaction calculate-min-required-utxo (your suggestion), but the output is same.

I think, I’m gonna combine it with, @HeptaSean 's example, to rounding-up the Minimum required UTxO, just in-case.

Thanks again!

*PS - I’m gonna mark your solution as the correct answer at the moment. If someone can prove that it’s not really what I’m looking for, then I will change it.