<p>With recent versions of bitcoind, you can use <a href="http://chainquery.com/bitcoin-api/sendtoaddress" rel="nofollow noreferrer"><code>sendtoaddress</code></a> with the optional <code>subtractfeefromamount</code> argument.  </p>

<pre><code>sendtoaddress 123abc... 1.055 "" "" true
</code></pre>

<p>Creates a transaction with 1.055 BTC of inputs.  The destination address will receive a little less than 1.055 BTC, after an appropriate fee is subtracted. </p>

CC BY-SA 4.0
2018-06-27T02:54:18.237Z
2018-06-27T02:54:18.237Z
Nate Eldredge
<p>There are a couple of ways to estimate the transaction fee (Skip to 3 if you want an automated way to send your entire balance). </p>

<ol>
<li><p>You can use the Bitcoin cli. From <a href="https://bitcoin.stackexchange.com/questions/50380/how-to-estimate-optimal-fees-for-transaction-in-bitcoind">a previous answer on  how to
estimate fees</a>:</p>

<pre><code>bitcoin-cli estimatesmartfee 6
</code></pre></li>
<li><p>You can also use many webservices that focus on fee estimation: </p>

<ul>
<li><a href="https://estimatefee.com/" rel="nofollow noreferrer">https://estimatefee.com/</a>    </li>
<li><a href="https://bitcoinfees.earn.com/" rel="nofollow noreferrer">https://bitcoinfees.earn.com/</a></li>
</ul></li>
<li><p>Finally, you could upload your private key to a wallet such as
<a href="https://electrum.org/" rel="nofollow noreferrer">electrum</a> which will take care of fee estimation for you and
ensure all your bitcoin is transferred.</p></li>
</ol>

CC BY-SA 4.0
2018-05-24T14:11:39.467Z
2018-08-31T19:46:34.500Z
2018-08-31T19:46:34.500Z
timothyylim
<p>I have created an account in a bitcoind wallet which has got some 1.055btc which has to be wiped out to <strong>0.00BTC</strong> to another account.  so the actual BTC has to be sent is 1.055 - transaction fee. </p>

<p>Is there any calculation for bitcoin to find transaction fee or any jsonrpc to find estimation fee like ethereum (balance - (gasprice*gaslimit)).</p>

<bitcoind><transaction-fees><json-rpc><fee-estimation>
How to sweep a Bitcoin Core wallet?
Thomson Ignesious
# How to sweep a Bitcoin Core wallet?

(Asked by: username_0 on 2018-05-24)

I have created an account in a bitcoind wallet which has got some 1.055btc which has to be wiped out to **0.00BTC** to another account. so the actual BTC has to be sent is 1.055 - transaction fee.

Is there any calculation for bitcoin to find transaction fee or any jsonrpc to find estimation fee like ethereum (balance - (gasprice\*gaslimit)).

**Tags:** bitcoind, transaction-fees, json-rpc, fee-estimation


---

## 2 answers

### Answer by username_1 on 2018-06-27. Score: 2

With recent versions of bitcoind, you can use sendtoaddress with the optional subtractfeefromamount argument.  
sendtoaddress 123abc... 1.055 "" "" true

Creates a transaction with 1.055 BTC of inputs.  The destination address will receive a little less than 1.055 BTC, after an appropriate fee is subtracted.


---

### Answer by username_2 on 2018-05-24. Score: 0

There are a couple of ways to estimate the transaction fee (Skip to 3 if you want an automated way to send your entire balance). 

You can use the Bitcoin cli. From a previous answer on  how to
estimate fees:
bitcoin-cli estimatesmartfee 6

You can also use many webservices that focus on fee estimation: 

https://estimatefee.com/ 
https://bitcoinfees.earn.com/

Finally, you could upload your private key to a wallet such as
electrum which will take care of fee estimation for you and
ensure all your bitcoin is transferred.


---

