<p>The problem is that your fee is probably not exactly <code>165721</code>.</p>
<ul>
<li>You have <code>6000000</code> lovelace</li>
<li>You want to send <code>5827019</code> lovelace to <code>recpt_addr</code></li>
<li>The fee is something like <code>165721</code> but not exactly (probably less)</li>
<li>Some lovelace are left and the command tries to send them to <code>change_addr</code></li>
</ul>
<p>You can inspect the transaction using <code>cardano-cli transaction view --tx-body-file &lt;build_file&gt;</code> to see the problem, then you can adjust your command params accordingly.</p>
<p>Maybe it would also work if you simply set the change address to the same address as the recipient:</p>
<ul>
<li><code>--change-address &lt;recpt_addr&gt;</code></li>
</ul>

CC BY-SA 4.0
2022-06-17T08:27:51.937Z
2022-06-17T08:27:51.937Z
eddex
<p>I simply used build-raw command to send all ADA from first wallet to second.
Here --tx-out-count will be 1 only. As there will be only one recipient</p>
<pre><code>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 params.json
</code></pre>
<p>Command to build raw transaction</p>
<pre><code>cardano-cli transaction build-raw \
 --tx-in &lt;txn hash&gt;#0 \
 --tx-out $(cat recipient.addr)+&lt;all ada balance&gt; \
 --invalid-hereafter 0 \ 
 --fee 0 \ 
 --out-file tx.raw
</code></pre>
<p>calculate min fee and manually calculate remaining ADA balance.
Transaction with Fees</p>
<pre><code> cardano-cli transaction build-raw \
 --tx-in &lt;txn hash&gt;#0 \
 --tx-out $(cat recipient.addr)+&lt;remaining ada balance&gt;  \
 --invalid-hereafter $(( ${currentSlot} + 10000)) \
 --fee &lt;Fee&gt; \
 --out-file tx.raw
</code></pre>

CC BY-SA 4.0
2023-09-25T21:47:00.723Z
2023-09-25T21:47:00.723Z
Harish Lalwani
<p>As George and eddex mentioned, you should use the change field as your sole output. Since you are using the <code>build</code> endpoint rather than <code>build-raw</code>, <em>and your input doesn't carry any tokens/NFTs</em>, you don't need to worry about the fee either. Your build command should look like this:</p>
<pre class="lang-sh prettyprint-override"><code>cardano-cli transaction build $MAGIC \
  --tx-in &lt;tx_in&gt;                    \
  --change-address &lt;recpt_addr&gt;      \
  --out-file &lt;build_file&gt;
</code></pre>
<p>Sign and submit, and that's it!</p>

CC BY-SA 4.0
2023-06-12T15:59:06.403Z
2023-06-12T15:59:06.403Z
keyanm
<p>Cli commands to send all ada from an address to another :</p>
<pre><code>cardano-cli transaction build-raw \
--tx-in a61c02&lt;...&gt;8848#0 \
--tx-out DdzFF&lt;...&gt;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
</code></pre>

CC BY-SA 4.0
2022-11-06T12:59:12.160Z
2022-11-06T12:59:12.160Z
mxdbld
<p>I am trying to build a transaction with a wallet that has 6 ADA. The transaction fee is 165721 lovelaces. So <code>6000000 - 165721 = 5827019</code> 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?</p>
<p>Here is my build command</p>
<p><code>cardano-cli transaction build --alonzo-era --testnet-magic 1097911063 --change-address &lt;change_addr&gt; --tx-in &lt;tx_in&gt; --tx-out &lt;recpt_addr&gt;+5827019 --out-file &lt;build_file&gt;</code></p>

CC BY-SA 4.0
2022-06-16T05:43:40.073Z
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.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-06-17T14:23:25.127Z
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
CC BY-SA 4.0
2022-11-07T07:13:33.460Z
If you are trying to send all to one address, just put that address in the --change-address and remove the --tx-out line.
George - APEX Stake Pool
<cardano-cli><transaction><build>
Using carano-cli How Do I send All of the ADA from a wallet?
# Using carano-cli How Do I send All of the ADA from a wallet?

(Asked by: username_0 on 2022-06-16)

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  --tx-in  --tx-out +5827019 --out-file`

**Tags:** cardano-cli, transaction, build
> **Comments:**
> **username_1**: 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.  
> **username_2**: 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.  
> **username_3**: If you are trying to send all to one address, just put that address in the --change-address and remove the --tx-out line.  

---

## 4 answers

### Answer by username_4 on 2022-06-17. Score: 2

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`  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`


---

### Answer by username_5 on 2023-09-25. Score: 0

I simply used build-raw command to send all ADA from first wallet to second.
Here --tx-out-count will be 1 only. As there will be only one recipient
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 params.json

Command to build raw transaction
cardano-cli transaction build-raw \
 --tx-in #0 \
 --tx-out $(cat recipient.addr)+ \
 --invalid-hereafter 0 \ 
 --fee 0 \ 
 --out-file tx.raw

calculate min fee and manually calculate remaining ADA balance.
Transaction with Fees
 cardano-cli transaction build-raw \
 --tx-in #0 \
 --tx-out $(cat recipient.addr)+  \
 --invalid-hereafter $(( ${currentSlot} + 10000)) \
 --fee  \
 --out-file tx.raw


---

### Answer by username_6 on 2023-06-12. Score: 0

As George and eddex mentioned, you should use the change field as your sole output. Since you are using the build endpoint rather than build-raw, and your input doesn't carry any tokens/NFTs, you don't need to worry about the fee either. Your build command should look like this:
cardano-cli transaction build $MAGIC \
  --tx-in                     \
  --change-address       \
  --out-file 

Sign and submit, and that's it!


---

### Answer by username_7 on 2022-11-06. Score: 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


---

