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 addressx, 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?

2 Answers 2


As the bitcoin-cli help sendtoaddress states:

  1. 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

  • doesnt sound like it really answers the question to me, what if the merchant/recipient expects the full amount?
    – Mark S.
    May 30, 2019 at 20:58

I think you want estimatesmartfee or 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.

  • 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
    May 31, 2019 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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