Transaction error while wiping out a wallet

Hi,

I want to move my ADA in stake pool (payment.addr) to my other wallet. I constructed the txn message, signed it and when I submit the transaction, I get the following error.

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Mainnet (KeyHashObj (KeyHash “4c7d6f75680f54684022c1e67ca874f1da24edec2604e54f6e88653a”)) (StakeRefBase (KeyHashObj (KeyHash “c31f05dcaadcf66568003cd64e7223da01b620ee81dcbbc219547d40”))),Value 689775 (fromList ),SNothing)])))])

I am trying to send 55 ADA in this txn, which is the total available balance in the wallet. I know the remaining balance will be less than 1 ADA… is this the problem? In that case, can we not wipe out a wallet to the last lovelace?

Please, can someone enlighten me on what is happening?
My cardano-cli version is 1.32.1 -and- cardano-node is also 1.32.1

Thanks,
-Ismail

1 Like

Yes, the problem is that the remaining output of 689775 lovelace is less than 1 ADA.
You have 2 options:

  1. send more than 55 ADA (add the 689775 lovelace to that amount)
  2. pay the 689775 lovelace as transaction fees (the already existing transaction fee plus the 689775 lovelace).

Thanks George.

  1. send more than 55 ADA (add the 689775 lovelace to that amount)
    → I tried the txn as you mentioned. The UTXO output is 0… but then I got the exact same error - OutputTooSmallUTxO

  2. pay the 689775 lovelace as transaction fees (the already existing transaction fee plus the 689775 lovelace).
    → Do you mean to say I forgo the 689775 lovelace?.. no big deal but just want to understand how it works.

It appears to me that you need to leave at least 1 ADA UTXO output. That means we cannot wipe-off a wallet to absolute 0 ADA.

Interested to hear more comments…

Can you share your build command?

If you want to wipe out the wallet completely, there should obviously be no --tx-out for an address in this old, wiped-out wallet. Then it should also not complain about an output that is too small.

I have a bash script that does it. Here are the excerpts of sequence of commands that I use.

1, cardano-cli query utxo --address $(cat payment.addr) --mainnet
→ Query the UTXOs and add them up to get the total balance. Then I check if there is enough balance to do the txn.

2, cardano-cli transaction build-raw $tx_in --tx-out $to_addr+0 --tx-out $(cat payment.addr)+0 --invalid-hereafter 0 --fee 0 --out-file $txn_file
→ build-raw to calculate the min txn fee

3, cardano-cli transaction calculate-min-fee --tx-body-file $txn_file --tx-in-count $tx_in_count --tx-out-count 2 --witness-count 1 --byron-witness-count 0 --mainnet --protocol-params-file protocol-params.json
→ Calculate the min fee, balance after the transfer

4, cardano-cli transaction build-raw $tx_in --tx-out $to_addr+$value --tx-out $(cat payment.addr)+$balance_after_txn --invalid-hereafter $slot_TTL --fee $fee --out-file txn.to_sign
→ build-raw txn again, but with the proper value, balance_after_txn… the output will be signed in cold env.

Should I not include the --tx-out when the UTXO output is 0?

Exactly that. You want your transaction output to completely go to the other address, so you don’t want any change back in payment.addr.

Thanks Sean. That worked! You saved a lot of head scratch… :+1:

1 Like