0

This already summaries the issue I'm currently trying to figure out to calculate the transaction fee to prevent negative balance.

(testnet) I tried using createrawtransaction answered. When I tried to send all balance to an address, the txid was created successfully using createrawtransaction but when I ran the fundrawtranaction on that txid it showed

error code: -4
error message:
Insufficient funds

The goal is to calculate transaction fee before hand to check either sufficient balance is available of an account using sendfrom

To manage multiple users to isolate users' balances as this.

EDIT1:

If using estimatesmartfee it is showing the fee:

bitcoin-cli -testnet estimatesmartfee 6
{
  "feerate": 0.00501921,
  "blocks": 6
}

When calling sendfrom for total balance transfer:

bitcoin-cli -testnet sendfrom <account> <address> <amount>
error code: -4
error message:
Error: This transaction requires a transaction fee of at least 0.00067257

Is there a way to get 0.00067257 the fee part before send the transaction amount and set it so that account balance won't go negative for multi accounts wallet.

Edit 2:

I found out that accounts are deprecated.

And multi wallet creation/load/unload on runtime is underway to 0.17.0

So what would be the best approach to handle multiple users bitcoins in isolation on a full node to prevent negative balance.

1 Answer 1

0

You can do estimatesmartfee 6 to calculate suggested BTC/kB fee aiming confirmation in six blocks. Then you can do fundrawtransaction <tx> "{feeRate: 0.000something}" to add inputs with the specified fee. This way, you'll have more control over the fees.

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.