I’m running into this error while trying to do a fee calculation for a smartcontract tx, in particular spending the UTxO of the smart contract plutus script:
cardano-cli: FatalError {fatalErrorMessage = "TODO alonzo: runTxCalculateMinValue using new protocol params"}
Here is the python function I’m using when this error is generated (also it doesn’t kill my tx, just seems I can’t predetermine the fee):
For reference, the above python script (transactions.py) and the related smart contract source code along with the cabal.project file I used to compile (I’m using based on the 1.29.0 cardano-node cabal file), etc are at my git here:
were you able to fix the error? I am trying to calculate the minimum ada amount to be sent along with other tokens. I get the same error as the one you posted. I cant find any solution on the web.
Not looked at it since, and since it wasn’t really stopping me. Per @bwbush reply, it isn’t necessary to do the build-raw if using build, etc. My plan is to rewrite the python scripts to avoid this.
I’m running into this same problem. Has anyone found a solution? I switched to using “cardano-cli transaction build” and see that it automatically calculates the fee but when wanting to mint or transfer NFTs I haven’t found a way to get it to automatically calculate the minimum ada value.
Previously I was using “cardano-cli transaction calculate-min-required-utxo” with version 1.30.0 but that has been removed from version 1.30.1. With version 1.30.1 and “cardano-cli transaction calculate-min-value” I get the same error as above.
I currently have something like this using “build”, I thought if I leave the ADA value off --tx-out for the NFT being transferred but build command will automatically calculate it.
Fails with: Error: Minimum UTxO threshold not met for tx output: addr_test1vzwyk8nwfh5esy09z79nzyxe69y8u5wdx60vgxsnu0w0q7cxqx50m + 1 3d6d8a031b309c0181be1c618a9762fee47bf1e28646bc7dab63ecdb.TNx003x0001x1
So my guess that “build” would set the minimum ADA value is wrong.
I previously had this working using “build-raw”, but having no such luck anymore since calculate-min-required-utxo has been removed and calculate-min-value isn’t working.
I made that same assumption, here’s a script I created and just used yesterday to mint with a known fee which does not kick any errors…(it’s still a little rough but I’ll clean it up as I’m able/have time)…you then just need to sign and send, just remember to sign with 2 witnesses, your wallet and your policy skey file:
#!/bin/bash
read -p 'Minting Wallet: ' MINT_ADDR
read -p 'Token Name: ' nftName
read -p 'Token Qty: ' tknQTY
read -p 'Slot: ' nftSlot
mintAddr=$(cat wallets/${MINT_ADDR}.addr) # the answer to Minting Wallet should be the filename of a file ending in .addr residing in a wallets folder inside this folder, and it only contains the wallets address. Same wallet should have an skey and vkey file by the same wallet name in the same wallets folder for these scripts to work
LOGFOLDER=logs/payments # optional, keep files clean and log them in a logs folder in this folder
TIMESTAMP=`date "+%Y-%m-%d_%H-%M-%S"`
# Get UTxO
$CARDANO_CLI query utxo \
--address ${mintAddr} \
--testnet-magic ${TESTNET_MAGIC_NUM} > fullUtxo.out
tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out
cat balance.out
tx_in=""
total_balance=0
while read -r utxo; do
in_addr=$(awk '{ print $1 }' <<< "${utxo}")
idx=$(awk '{ print $2 }' <<< "${utxo}")
utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
total_balance=$((${total_balance}+${utxo_balance}))
echo TxHash: ${in_addr}#${idx}
echo ADA: ${utxo_balance}
tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}
echo TXIn: ${tx_in}
newbal=$((${total_balance}-4000000)) # <-- subtracting the 2 following instances of token utxos
# Draft the tx
$CARDANO_CLI transaction build-raw \
${tx_in} \
--tx-out ${mintAddr}+${newbal} \
--tx-out ${mintAddr}+2000000+"1 some_other_already_mintedTokenID.NAME" \
--tx-out ${mintAddr}+2000000+"${tknQTY} $(cat nativetokens/${nftName}.id).${nftName}" \
--invalid-hereafter 0 \
--fee 0 \
--mint="${tknQTY} $(cat nativetokens/${nftName}.id).${nftName}" \
--minting-script-file nativetokens/${nftName}.script \
--metadata-json-file nativetokens/${nftName}.json \
--alonzo-era \
--out-file tx_nft.tmp
# Calculate the fee
fee=$($CARDANO_CLI transaction calculate-min-fee \
--tx-body-file tx_nft.tmp \
--tx-in-count ${txcnt} \
--tx-out-count 3 \ # <-- make sure your count is accurate
--witness-count 2 \
--testnet-magic ${TESTNET_MAGIC_NUM} \
--protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee
txOut=$((${total_balance}-${fee}-4000000)) # again, account for the 2 (or other) tx-outs
echo Change Output: ${txOut}
# Build the TX
echo "=========================="
echo "....Building for: ${tx_in}"
echo "=========================="
echo ""
$CARDANO_CLI transaction build-raw \
${tx_in} \
--tx-out ${mintAddr}+${txOut} \
--tx-out ${mintAddr}+2000000+"1 some_other_already_mintedTokenID.NAME" \
--tx-out ${mintAddr}+2000000+"${tknQTY} $(cat nativetokens/${nftName}.id).${nftName}" \
--invalid-hereafter ${nftSlot} \
--fee ${fee} \
--mint="${tknQTY} $(cat nativetokens/${nftName}.id).${nftName}" \
--minting-script-file nativetokens/${nftName}.script \
--metadata-json-file nativetokens/${nftName}.json \
--alonzo-era \
--out-file tx_nft.raw
mv fullUtxo.out $LOGFOLDER/${TIMESTAMP}_fullUtxo.out
mv balance.out $LOGFOLDER/${TIMESTAMP}_balance.out
mv tx_nft.tmp $LOGFOLDER/${TIMESTAMP}_tx_nft.tmp
cp tx_nft.raw $LOGFOLDER/${TIMESTAMP}_tx_nft.raw
echo ""
echo "===== Finished ====="
echo "Get and Move tx_nft.raw file to Cold for signing"
echo ""