Create a transaction

Hi - I am using Cardano-cli to perform a transaction like
https://docs.cardano.org/projects/cardano-node/en/latest/stake-pool-operations/simple_transaction.html

Above guide works for me when I want to transfer partial amount from UTXO to destination account.

Now I want to do a transaction where full amount to a account. So the amount left ultimately will be zero. And that transaction doesn’t work. It fails UtxowFailure (UtxoFailure (OutputTooSmallUTxO

How do you create a transaction where you nothing is left in the original utxo and everything(-fees) is send to destination account?

The error message may be a result of having a --tx-out with 0 lovelace. If no change/remainder is left, then there should be no --tx-out to that address.

1 Like

Hi!

Are you still facing with this issue?

No it got resolved after following what bwbush said

hi bwbush,
what if the sender want to send all the lovelace, but keep other asset, then should the txOut of sender be

–tx-out “address+0+900000000 asset1+200000 asset2+200000”
or
–tx-out “address+900000000 asset1+200000 asset2+200000”

Each output must include at least the min-ADA, which is 1 ADA for tokenless outputs, but 1.6 ADA or more for outputs with tokens. You can use cardano-cli transaction calculate-min-value to calculate that minimum.

So, if you want to separate the tokens from as much of the ADA as possible, you’d need two outputs, something like the following:

--tx-out "tokenreceiveraddress+1700000+200000 asset1+200000 asset2
--tx-out "adareceiveraddress+898300000"

This assumes there are 900000000 ADA and 200000 each of asset1 and asset2. The first output keeps all of the tokens at tokenreceiveraddress and includes just the min-ADA, while the second output sends most of the ADA to adareceiveraddress.

hi @bwbush according to what you said earlier, it seems like it’s possible to transfer all off your lovelace.
but on the previous comment, it seems it’s not possible? so for conclusion, right now, you can’t transfer all of your lovelace into another account, am I right ?
image

I apologize for the confusion.To clarify, the 0 lovelace output should have either been removed from the transaction or have had the min-ADA added to it. Every output of every transaction must have the min ADA.

hi @bwbush,
as I checked on Daedalus Mainnet App, I see that even I have 1.5ADA, I can transfer maximum ADA I have ( which is 1 ADA) after Fee, so does Daedalus have different kind of mechanism of transfering ADA compare to cardano-cli ?
image

Daedalus hides the details of sending the remaining “change” from a transaction back to the originating wallet. It also doesn’t let you choose exactly which UTxOs are spent. In cardano-cli you have to choose the input UTxOs and specify both the output to the destination address and the output of the remaining ADA (if any) back to your wallet.

Daedalus makes decisions about which UTxOs to combine in a transaction. Sometimes that results in higher fees than strictly necessary. Mostly, it appears that Daedalus tries to minimize the number of UTxOs that a wallet holds.

BTW, if you have 1.5 ADA in a wallet, then sending 1.0 ADA to an address would mean that the remaining 0.5 ADA (minus fee) would have to be sent back to the originating wallet. However, that output of less than 0.5 ADA violates the min-ADA rule, which requires that each output, including the remaining “change” has at least 1.0 ADA. Daedalus deals with this by increasing the fee to 0.5 ADA, so that the transaction balances, even though the minimum fee for this transaction is about 0.15 ADA.

P.S. Version 1.28.0 of cardano-cli has both a transaction build and a transaction build-raw command. The transaction build command handles the remaining “change” automatically, but transaction build-raw behaves like version 1.27.0, which doesn’t automate that.

hi @bwbush , sorry, I don’t clearly understand the explanation you did. could you maybe draw a utxo diagram of a possible scenario that Daedalus did?
Thank you for your support

1 Like