<p>As the <code>bitcoin-cli help sendtoaddress</code> states:</p>

<blockquote>
  <ol start="5">
  <li>subtractfeefromamount    (boolean, optional, default=false) The fee will be deducted from the amount being sent.</li>
  </ol>
</blockquote>

<p>So you can change your call to:</p>

<pre><code>bitcoin-cli sendtoaddress x 1 "" "" true
</code></pre>

<p>So that the fee is deducted from the amount to send</p>

CC BY-SA 4.0
2019-05-30T20:58:42.300Z
doesnt sound like it really answers the question to me, what if the merchant/recipient expects the full amount?
Mark S.
CC BY-SA 4.0
2019-05-30T13:05:48.860Z
2019-05-30T13:05:48.860Z
davidlj95
<p>I think you want <a href="https://bitcoincore.org/en/doc/0.16.0/rpc/util/estimatesmartfee/" rel="nofollow noreferrer">estimatesmartfee</a> or <a href="https://bitcoin.org/en/developer-reference#estimatefee" rel="nofollow noreferrer">estimatefee</a> it takes one argument which is the confirmation target in blocks.  You can also select from Economical or Conservative fee modes which may affect the suggested fee rate.</p>

CC BY-SA 4.0
2019-05-31T04:45:40.620Z
How should I dermine the blocks, also estimatesmartfee does not work for bitcoincash, and estimatefee do not take any argument now.
Also, how is the fee determined for this sendtoaddress. Is it the average fee or the lowest possible value?
Paras
CC BY-SA 4.0
2019-05-30T21:06:49.210Z
2019-05-30T21:06:49.210Z
Mark S.
<p>I have a bitcoin core running on testnet, so for suppose I have a wallet balance of <strong>1BTC</strong> and I have to send it to an address<strong>x</strong>, so how can I know the amount of transaction fee so that I can subtract it from the sending amount.</p>

<pre><code>bitcoin-cli sendtoaddress x 1
</code></pre>

<p>This will return an error stating that </p>

<pre><code>error code: -4
error message:
Error: This transaction requires a transaction fee of at least 0.00000488
</code></pre>

<p>How can I know it beforehand the fee required for a transaction?</p>

<bitcoin-core><bitcoind>
Bitcoin core How do I get the transaction fee while using sendtoaddress
Paras
# Bitcoin core How do I get the transaction fee while using sendtoaddress

(Asked by: username_0 on 2019-05-30)

I have a bitcoin core running on testnet, so for suppose I have a wallet balance of **1BTC** and I have to send it to an address**x**, so how can I know the amount of transaction fee so that I can subtract it from the sending amount.

```
bitcoin-cli sendtoaddress x 1

```

This will return an error stating that

```
error code: -4
error message:
Error: This transaction requires a transaction fee of at least 0.00000488

```

How can I know it beforehand the fee required for a transaction?

**Tags:** bitcoin-core, bitcoind


---

## 2 answers

### Answer by username_1 on 2019-05-30. Score: -1 | Accepted answer

As the `bitcoin-cli help sendtoaddress` states:

> 5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.

So you can change your call to:

```
bitcoin-cli sendtoaddress x 1 "" "" true

```

So that the fee is deducted from the amount to send

> **Comments:**
> **username_2**: doesnt sound like it really answers the question to me, what if the merchant/recipient expects the full amount?  

---

### Answer by username_2 on 2019-05-30. Score: 1

I think you want [estimatesmartfee](https://bitcoincore.org/en/doc/0.16.0/rpc/util/estimatesmartfee/) or [estimatefee](https://bitcoin.org/en/developer-reference#estimatefee) it takes one argument which is the confirmation target in blocks. You can also select from Economical or Conservative fee modes which may affect the suggested fee rate.

> **Comments:**
> **username_0**: How should I dermine the blocks, also estimatesmartfee does not work for bitcoincash, and estimatefee do not take any argument now. Also, how is the fee determined for this sendtoaddress. Is it the average fee or the lowest possible value?  

---

