Using latest bitoind, any way to calculate max spendable from wallet with some amount of outputs? For example i need to send all wallet amount to 2 outputs and set mining fee enough to get confirmation in first block. How can i calculate max spendable amount?


In Bitcoin Core, there is the option to subtract the fee from the amount. When you create a transaction, you set the amount to be the maximum amounts, and then you enable the subtract fee from amount options which will then reduce the specified outputs by the fee. This way, you can choose to send your entire balance without change and have the fee be subtracted from the output.

In the GUI (bitcoin-qt), there is a checkbox labeled "Subtract fee from amount" which you can set for each recipient. You can use the "Use available balance" button to auto-fill the full wallet balance. It will also automatically check that option for you.

If you are using bitcoind over the RPC interface, sendtoaddress has a parameter subtractfeefromamount which you can set to true in order to deduct the fee from the amount you are sending. sendmany has a similar option but it is instead an array of addresses so you specify the addresses that will receive less due to the fee being subtracted from their amounts.

  • ye i know about subtractfeefromamount but i need to calculate amount before(!) send, so with your example we'll understand how much we sent only after processing transaction – Dimedrol Nov 7 '18 at 15:31
  • You can use fundrawtransaction with the subtractFeeFrom option to construct a transaction (but not sign or broadcast it). Then you can look at the amount in the output to see how much will actually be sent. – Andrew Chow Nov 7 '18 at 15:39

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.