When I call estimatefee 1 in testnet it returns: 0.00044444

Then when I call sendtoaddress xxxxxx 0,1 (which got the first confirmation within a couple of minutes after sending) I see that the fee included is: 0.00001662 BTC, which is about 27 times smaller that the original estimate.

What am I missing?


estimatefee 1 will return the approx. fee per kilobyte.

Because sendtoaddress could use multiple of your unspent coins, the size of your transaction is not know until it is created (until the coin selection ran).

Example: Fresh wallet. You did receive 10 times 1 BTC. Now you create a transaction with sendtoaddress <ard> 9.5. This will produce a transaction with 10 inputs (your received 10 x 1BTC). Therefor the transaction size is bigger than if you would have received 1 x 10BTC.

At the moment there is no easy way of getting the transaction fee before sending the tx (on RPC level). You could use Bitcoin-Qt (there you will see the fee before sending within the confirmation dialog).

There is a pull request for bitcoin-core that would allow fee calculation before sending the tx: https://github.com/bitcoin/bitcoin/pull/6088

  • The pull request will provide a great functionality that is missing today from the RPC API, nice work! Jun 18 '15 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.