TX Fee Calculation Incorrect for CIP68 on Cardano-cli 9.2.1

Hello - I am on cardano-cli 9.2.1 and am experiencing something strange. I am trying to submit a cip68 transaction, and am using the following command to get the TX fee:

cardano-cli transaction build-raw --fee 265513 --invalid-before 130784180 --invalid-hereafter 131043380 --tx-in d45d25c1b60e9032b64eb5332a1dc1faffc84e426ae097b14e95edd97dda9dd1#0 --tx-out “addr1vxym96cddjlt68kpvxffwhvcr2zfpf4cmfaelea0czxs2vclhzx8h+1193870+1 2df27e01576ca7f0db2f4267c82021f584a31ee740b861b970f08ccf.000643b041737365743133” --tx-out-datum-embed-file /home/admin/cardano-projects/sales/cip68-test-2/db/policy/transaction-metadata/datum-Asset13.json --tx-out “addr1q87gw8wkg0c5q3ldelf5s2w8gnv0nm025qssfpkkvenq3whav7terpg8pscu62tpk25xfd3jxeefyufccppahrj23mssknmfyx+1168010+1 2df27e01576ca7f0db2f4267c82021f584a31ee740b861b970f08ccf.000de14041737365743133” --tx-out “addr1q9sre2jl229cavt2n0n34km0cq2ch34u83j6ms74zu5rjryj5dysang6xcyp62r6dwdm7pnv3nsdwwn7jzzhr03ur6tqsef289+10000000000” --tx-out “addr1q8g2c4925w3f5n5g8dectc57n9z08259k0727wuy82wgshvj5dysang6xcyp62r6dwdm7pnv3nsdwwn7jzzhr03ur6tqye45dh+10000000000” --mint “1 2df27e01576ca7f0db2f4267c82021f584a31ee740b861b970f08ccf.000de14041737365743133+1 2df27e01576ca7f0db2f4267c82021f584a31ee740b861b970f08ccf.000643b041737365743133” --minting-script-file “/home/admin/cardano-projects/sales/cip68-test-2/db/policy/keys/policy.script” --out-file “/home/admin/cardano-projects/sales/cip68-test-2/scripts/cardano-cli/tmp/fce72111-d5cf-4521-b4f3-7a870e0fbd70-tx.draft” && cardano-cli transaction calculate-min-fee --tx-body-file “/home/admin/cardano-projects/sales/cip68-test-2/scripts/cardano-cli/tmp/fce72111-d5cf-4521-b4f3-7a870e0fbd70-tx.draft” --witness-count 2 --protocol-params-file “/home/admin/cardano-projects/sales/cip68-test-2/scripts/cardano-cli/tmp/fce72111-d5cf-4521-b4f3-7a870e0fbd70-protocol.json” | cut -d " " -f1

The fee returned is: 265513

However, when I submit the transaction itself, I receive an error that the fee isn’t enough:

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError (UtxowFailure (UtxoFailure (AlonzoInBabbageUtxoPredFailure (FeeTooSmallUTxO (Coin 266701) (Coin 265513))))

Any ideas what’s going on?

Likely the command you used to precalculate that fee didn’t have values high enough to cover all possible values: particularly the inputs you are actually using in the failed transaction.

We’re paying by the number of bytes, and your calculated & required fees from the error message are within several hundred lovelace: suggesting you’re some bytes short.

See this discussion here which addresses this problem for a simpler transaction:

1 Like

Alternatively, since you seem to calculate on pretty exactly the same transaction that you are also submitting: Is the witness count correct? Are you signing with exactly two keys?

Thanks for the suggestion, but yes, only two witnesses as far as I know - the policy and wallet keys.

Yes, thank you. I did see that earlier and tried it but doesn’t seem to be the issue.

1 Like