2

I am trying to build a transaction with a wallet that has 6 ADA. The transaction fee is 165721 lovelaces. So 6000000 - 165721 = 5827019 lovelaces. But when i try to send 5827019 lovelaces I get an error saying I can't build the transaction because the Minimum UTxO threshold: Lovelace 999978. Is it possible to send all my ADA or do I have have to leave a balance of at least 1 ADA?

Here is my build command

cardano-cli transaction build --alonzo-era --testnet-magic 1097911063 --change-address <change_addr> --tx-in <tx_in> --tx-out <recpt_addr>+5827019 --out-file <build_file>

3
  • 2
    Note: cardano-cli transaction build does have some issues, I find cardano-cli transaction build-raw is more reliable but need some extra work. You will need to calculate fees manually and add another --tx-out for the change. Jun 16, 2022 at 5:43
  • Additiionally, if you use the cardano-cli transaction build-raw command, you can specify exactly the fee amount you wish to pay, and as long as it is above the minimum (which itself is estimated by the calculate-min-fee subcommand), the tx will be valid. Use this if you wish to create a transaction without change.
    – zhekson
    Jun 17, 2022 at 14:23
  • If you are trying to send all to one address, just put that address in the --change-address and remove the --tx-out line. Nov 7, 2022 at 7:13

2 Answers 2

1

The problem is that your fee is probably not exactly 165721.

  • You have 6000000 lovelace
  • You want to send 5827019 lovelace to recpt_addr
  • The fee is something like 165721 but not exactly (probably less)
  • Some lovelace are left and the command tries to send them to change_addr

You can inspect the transaction using cardano-cli transaction view --tx-body-file <build_file> to see the problem, then you can adjust your command params accordingly.

Maybe it would also work if you simply set the change address to the same address as the recipient:

  • --change-address <recpt_addr>
0

Cli commands to send all ada from an address to another :

cardano-cli transaction build-raw \
--tx-in a61c02<...>8848#0 \
--tx-out DdzFF<...>v2mEoo+2061351 \
--invalid-hereafter 000000 \
--fee 172233 \
--out-file tx.raw 

cardano-cli transaction calculate-min-fee \
--tx-body-file tx.raw \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 1 \
--byron-witness-count 0 \
--mainnet \
--protocol-params-file ../../protocol.json

cardano-cli transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--mainnet \
--out-file tx.signed

cardano-cli transaction submit \
--tx-file tx.signed \
--mainnet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.