<p>Yes.</p>

<ul>
<li>Use <code>createrawtransaction</code> with the outputs you want, but no inputs.</li>
<li>Use <code>fundrawtransaction</code> to make the wallet add inputs and a change output if necessary.</li>
<li>Check what fee the resulting unsubmitted raw transaction has. If you like the result, continue:</li>
<li>Call <code>signrawtransaction</code> to sign the inputs.</li>
<li>Call <code>sendrawtransaction</code> to broadcast it on the network, and as a side effect, list it in the wallet.</li>
</ul>

<p>You can't control the network fee directly (as it is per byte, and you don't know the size beforehand), but you can set the feerate using -paytxfee. In a new release, you'll also be able to pass the feerate to <code>fundrawtransaction</code>.</p>

CC BY-SA 3.0
2016-05-17T04:34:36.247Z
2016-05-17T04:34:36.247Z
Pieter Wuille
<p>I am using the RPC API to submit automated transactions to my Bitcond, the user introduces the Amount and I check it against its balance before submitting the transaction.</p>

<p>I would like to also check if the user has enough balance to pay the network fee as well.</p>

<ul>
<li>Is there a way to know the Bitcoin Network transaction fee BEFORE actually submitting the transaction?</li>
<li>Is there a way I can define the network fee?</li>
</ul>

<bitcoind><json-rpc><transaction-fees>
Is there a way to know the Bitcoin Network transaction fee BEFORE actually submitting the transaction?
Diego vDev
# Is there a way to know the Bitcoin Network transaction fee BEFORE actually submitting the transaction?

(Asked by: username_0 on 2016-05-17)

I am using the RPC API to submit automated transactions to my Bitcond, the user introduces the Amount and I check it against its balance before submitting the transaction.

I would like to also check if the user has enough balance to pay the network fee as well.

* Is there a way to know the Bitcoin Network transaction fee BEFORE actually submitting the transaction?
* Is there a way I can define the network fee?

**Tags:** bitcoind, json-rpc, transaction-fees


---

## 1 answers

### Answer by username_1 on 2016-05-17. Score: 4

Yes.

* Use `createrawtransaction` with the outputs you want, but no inputs.
* Use `fundrawtransaction` to make the wallet add inputs and a change output if necessary.
* Check what fee the resulting unsubmitted raw transaction has. If you like the result, continue:
* Call `signrawtransaction` to sign the inputs.
* Call `sendrawtransaction` to broadcast it on the network, and as a side effect, list it in the wallet.

You can't control the network fee directly (as it is per byte, and you don't know the size beforehand), but you can set the feerate using -paytxfee. In a new release, you'll also be able to pass the feerate to `fundrawtransaction`.


---

