cardano-foundation / developer-portal

The Cardano Developer Portal
https://developers.cardano.org
MIT License
381 stars 919 forks source link

Simple transactions: add padded & recursive fee calculation? #1322

Open rphair opened 2 months ago

rphair commented 2 months ago

There are repeated postings of Cardano users getting values calculated too low from calculate-min-fee when either:

The advice to both pad the input fee & submit conservative or actual values, so that CBOR can be realistically assigned and a workable transaction fee determined from the byte cost, has been given here & in other places, though still not addressed @CarlosLopezDeLara in your otherwise excellent recently rewritten instructions (https://developers.cardano.org/docs/get-started/cardano-cli/get-started/simple-transactions#calculating-transaction-fees-and-balancing-a-transaction):

Given that this question has to be answered manually every time, I propose that we agree upon & include language (to @CarlosLopezDeLara's high standards) that includes this "recursive" fee calculation as constantly recommended to the community.

I believe that if users continue to encounter trouble they may be tempted to use transaction build instead of the advance fee calculation even when their security configurations don't support doing this safely (as per https://developers.cardano.org/docs/get-started/secure-workflow#why-cant-i-use-cardano-cli-transaction-build).

CarlosLopezDeLara commented 2 months ago

Yes, this is a good idea. The key thing is that using --fee 0 is not always a good idea. It may produce a slightly smaller tx than the real one once we add the fees. We have two options:

  1. Start with 0, get a fee, rebuild the tx, get fee again, sign, submit.

  2. Start with something like --fee 0.170000

CarlosLopezDeLara commented 2 months ago

About "security", I always suggest doing the signing of transactions in an air-gapped machine, while building the transaction is perfectly acceptable thing to do in a hot environment.

rphair commented 2 months ago

Start with something like --fee 0.170000

The older version of the doc pages had fee 300000 lovelace which was well backed up by recommendations circulated in the community.

Given the process requires convergence from either direction, in case the "recursion" doesn't happen I think it's better for a manual CLI user to pay for an extra CBOR byte or two than for a Tx to fail for a user who sometimes can't diagnose the problem.