<p>What <code>getmempoolinfo</code> is returning is not the minimum fee to send a transaction, but the minimum <strong>rate per kilobyte</strong> to send a transaction. Your bitcoin client will take the configured fee and multiply it by the size of the transaction in kilobytes to calculate the actual transaction fee.</p>

<p>The size of a transaction is somewhat difficult to compute (for a person) because it requires understanding the number of inputs that are required to fulfil the transaction, the number of outputs (primary recipients + change address), and the targeted transaction fee (since appropriate fees could eliminate the need for a change address).</p>

<p>There are online fee calculators out there you can use to estimate these, but it is still difficult to completely empty a wallet with a known fee using the straight bitcoin client.</p>

CC BY-SA 4.0
2018-10-01T13:03:43.580Z
Is there a way to get fee before sending transaction ?
Yur Gasparyan
CC BY-SA 4.0
2018-10-01T13:09:58.823Z
No, but if all you are looking to do is empty a wallet, you can pass an argument to `sendtoaddress` which will take the fee out of the sent amount rather than the wallet you're sending from--you will receive less bitcoin than you "sent", but you will be able to empty the wallet.

See argument #5 for `sendtoaddress`: https://bitcoin.org/en/developer-reference#sendtoaddress
Motoma
CC BY-SA 4.0
2018-10-01T13:16:18.770Z
thanks! but what when i want to send bitcoins from specific account to address?
Yur Gasparyan
CC BY-SA 4.0
2018-10-01T13:31:42.377Z
Again, if you want to remove a specific amount from the sending address, you set that 5th argument to true. If you want a specific amount to be received by the recipient address, you leave it set to false.
Motoma
CC BY-SA 4.0
2018-10-01T12:57:30.913Z
2018-10-01T13:10:59.513Z
2018-10-01T13:10:59.513Z
Motoma
<p>I am trying to get real fee per trasnaction.</p>

<p>So I have an account whit balance <code>0.06940000</code> and have a second account with balance <code>0.00000000</code>.</p>

<p>To get current fee I have run the command</p>

<pre><code>bitcoin-cli getmempoolinfo
</code></pre>

<p>and got the <code>mempoolminfee = 0.00001000</code>.
I thought that when I send the <code>0.06939000</code> in my account rest balance will <code>0.00000000</code>. but I got <code>0.00004860</code>. Actually the fee was  <code>0.0000514</code>.</p>

<p>general question is WhY ? </p>

<p>Please tell me to understand how is fees working!</p>

<bitcoind><bitcoin-cli><fee-estimation>
Get real fee per transaction
Yur Gasparyan
# Get real fee per transaction

(Asked by: username_0 on 2018-10-01)

I am trying to get real fee per trasnaction.

So I have an account whit balance `0.06940000` and have a second account with balance `0.00000000`.

To get current fee I have run the command

```
bitcoin-cli getmempoolinfo

```

and got the `mempoolminfee = 0.00001000`.
I thought that when I send the `0.06939000` in my account rest balance will `0.00000000`. but I got `0.00004860`. Actually the fee was `0.0000514`.

general question is WhY ?

Please tell me to understand how is fees working!

**Tags:** bitcoind, bitcoin-cli, fee-estimation


---

## 1 answers

### Answer by username_1 on 2018-10-01. Score: 1

What `getmempoolinfo` is returning is not the minimum fee to send a transaction, but the minimum **rate per kilobyte** to send a transaction. Your bitcoin client will take the configured fee and multiply it by the size of the transaction in kilobytes to calculate the actual transaction fee.

The size of a transaction is somewhat difficult to compute (for a person) because it requires understanding the number of inputs that are required to fulfil the transaction, the number of outputs (primary recipients + change address), and the targeted transaction fee (since appropriate fees could eliminate the need for a change address).

There are online fee calculators out there you can use to estimate these, but it is still difficult to completely empty a wallet with a known fee using the straight bitcoin client.

> **Comments:**
> **username_0**: Is there a way to get fee before sending transaction ?  
> **username_1**: No, but if all you are looking to do is empty a wallet, you can pass an argument to `sendtoaddress` which will take the fee out of the sent amount rather than the wallet you're sending from--you will receive less bitcoin than you "sent", but you will be able to empty the wallet.  See argument #5 for `sendtoaddress`: https://bitcoin.org/en/developer-reference#sendtoaddress  
> **username_0**: thanks! but what when i want to send bitcoins from specific account to address?  
> **username_1**: Again, if you want to remove a specific amount from the sending address, you set that 5th argument to true. If you want a specific amount to be received by the recipient address, you leave it set to false.  

---

