user57105: I'm currently playing with bitcoinjs (https://bitcoinjs.org/) and I'm creating offline transactions that I broadcast over the network after.
I've successfully create my first transaction using this : https://medium.com/@orweinberger/how-to-create-a-raw-transaction-using-bitcoinjs-lib-1347a502a3a
But it seems my transaction is stuck since I haven't put enough fee on it to get it mined.
How using a var tx = new bitcoin.TransactionBuilder(); can I set the fee to a certain amount ? Is this calculated using a default value ?
Thank you for your help !

user3115: The fee is the sum of unspent value in a Transaction.
Aka the value NOT SENT by your outputs.

fee = in - out

For an example,  if we assume the input aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31, 0 has an unspent value of 15000...
var txb = new bitcoin.TransactionBuilder()
txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0)
txb.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)

When we send 15000 to 1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK, the fee is the value of the inputs minus the value of outputs.

in:15000 - out:15000 = fee:0

For a fee to be non-zero, in > out is required.

57105: <p>I'm currently playing with <code>bitcoinjs</code> (<a href="https://bitcoinjs.org/" rel="nofollow noreferrer">https://bitcoinjs.org/</a>) and I'm creating offline transactions that I broadcast over the network after.</p>

<p>I've successfully create my first transaction using this : <a href="https://medium.com/@orweinberger/how-to-create-a-raw-transaction-using-bitcoinjs-lib-1347a502a3a" rel="nofollow noreferrer">https://medium.com/@orweinberger/how-to-create-a-raw-transaction-using-bitcoinjs-lib-1347a502a3a</a></p>

<p>But it seems my transaction is stuck since I haven't put enough fee on it to get it mined.</p>

<p>How using a <code>var tx = new bitcoin.TransactionBuilder();</code> can I set the fee to a certain amount ? Is this calculated using a default value ?</p>

<p>Thank you for your help !</p>
 3115: <p>The fee is the sum of unspent value in a Transaction.</p>

<p>Aka the value <strong>NOT SENT</strong> by your outputs.</p>

<blockquote>
  <p>fee = in - out</p>
</blockquote>

<p>For an example,  if we assume the input <code>aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31, 0</code> has an unspent value of <code>15000</code>...</p>

<pre><code>var txb = new bitcoin.TransactionBuilder()
txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0)
txb.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
</code></pre>

<p>When we send <code>15000</code> to <code>1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK</code>, the <code>fee</code> is the value of the inputs minus the value of outputs.</p>

<blockquote>
  <p>in:15000 - out:15000 = fee:0</p>
</blockquote>

<p>For a fee to be non-zero, <strong>in > out</strong> is required.</p>
