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:
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 ?
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.
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 ?
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.