<p>Yes, this is possible, but you still need to check the wallet balance first.</p>

<p>However, you need to know the fee, as you usually specify how many BTC are supposed to arrive at the destination, rather than how much is being sent in total.</p>

<p>The <code>sendtoaddress</code> command takes 5 parameters: address, amount, comment, comment-to, subtractfeefromamount. This last option, subtractfeefromamount, is what you need.</p>

<p>So if your entire wallet balance is 0.1337 BTC, you could issue:</p>

<blockquote>
  <p>bitcoin-cli sendtoaddress "address" 0.1337 "" "" true</p>
</blockquote>

<p>Also, you can't use <code>move</code>, as that does not actually issue a Bitcoin transaction, but only updates internal balances.</p>

CC BY-SA 3.0
2016-11-09T11:21:40.777Z
How many satoshis are deducted as transaction fee?
Shabahat M. Ayubi
CC BY-SA 3.0
2016-11-09T16:34:53.980Z
Bitcoin has a floating fee per byte rate. You can either configure what that rate is, or let estimation do its work.
Pieter Wuille
CC BY-SA 3.0
2016-04-15T12:44:49.240Z
2016-04-15T12:44:49.240Z
Pieter Wuille
<p>I know we can send coins using the move, sendtoaddress and sendfrom commands from the console or commandline. </p>

<p>However these commands require to specify an "exact" amount, meaning you need to check the balance before you execute the commands. </p>

<p>Is it possible to just send all coins to an address or to oneself in the same wallet using just one command.</p>

<p>Hopefully someone understands what I"m talking about here.</p>

<transactions><wallet><movecmd><sendtoaddress>
Is it possible to Send the total balance of Bitcoin from the Wallet using rpc without having to specify the exact amount?
Demon
# Is it possible to Send the total balance of Bitcoin from the Wallet using rpc without having to specify the exact amount?

(Asked by: username_0 on 2016-04-14)

I know we can send coins using the move, sendtoaddress and sendfrom commands from the console or commandline.

However these commands require to specify an "exact" amount, meaning you need to check the balance before you execute the commands.

Is it possible to just send all coins to an address or to oneself in the same wallet using just one command.

Hopefully someone understands what I"m talking about here.

**Tags:** transactions, wallet, movecmd, sendtoaddress


---

## 1 answers

### Answer by username_1 on 2016-04-15. Score: 4

Yes, this is possible, but you still need to check the wallet balance first.

However, you need to know the fee, as you usually specify how many BTC are supposed to arrive at the destination, rather than how much is being sent in total.

The `sendtoaddress` command takes 5 parameters: address, amount, comment, comment-to, subtractfeefromamount. This last option, subtractfeefromamount, is what you need.

So if your entire wallet balance is 0.1337 BTC, you could issue:

> bitcoin-cli sendtoaddress "address" 0.1337 "" "" true

Also, you can't use `move`, as that does not actually issue a Bitcoin transaction, but only updates internal balances.

> **Comments:**
> **username_2**: How many satoshis are deducted as transaction fee?  
> **username_1**: Bitcoin has a floating fee per byte rate. You can either configure what that rate is, or let estimation do its work.  

---

