<p>I have not tried this myself but having a look through the documentation on blockchain-transaction - npm api it looks like you can query fees, under the advanced section:</p>

<blockquote>
  <p>fees - Gets a list of current fees based on the BitCoin network going
  rate.</p>
</blockquote>

<p><a href="https://www.npmjs.com/package/bitcoin-transaction" rel="nofollow noreferrer">https://www.npmjs.com/package/bitcoin-transaction</a></p>

<p>Looks like you can select a 'fastest' option or others:</p>

<blockquote>
  <p>Set the fee for the transaction. Can be either one of "fastest",
  "halfHour" or "hour" in which case the actual fee numbers are fetched
  from the fees provider. Or it can be just a plain number in which case
  that will be used as the Fee per Byte value in Satoshis. It is
  recommended to use one of the string aliases unless you know what you
  are doing.</p>
</blockquote>

<p>You might have to specify a feesProvider, not sure if they have a default selected when nothing set.</p>

CC BY-SA 4.0
2018-06-29T12:11:35.720Z
I have try it in my code but it's not working. It shows me same error.

First of all I try `Fees=3`(as integer) after that `Fees="3"`(as string) and also I have try for FeesProvider. but no luck.
Hardik Dhankecha
CC BY-SA 4.0
2018-06-29T12:45:34.120Z
"It is recommended to use one of the string aliases unless you know what you are doing."
Fuzzybear
CC BY-SA 4.0
2018-06-29T12:45:54.127Z
"Can be either one of "fastest", "halfHour" or "hour" in which case the actual fee numbers are fetched from the fees provider."
Fuzzybear
CC BY-SA 4.0
2018-06-29T10:20:46.130Z
2018-06-29T10:20:46.130Z
Fuzzybear
<p>Finally I get answer for this question by surfing very much for this topic.</p>

<p>I found source code for transfer Bitcoin from one individual account to another.</p>

<p>"<a href="https://github.com/Blank101/bitcoin-transaction/blob/master/index.js" rel="nofollow noreferrer">https://github.com/Blank101/bitcoin-transaction/blob/master/index.js</a>"</p>

<p>and there I set feePerByte = 3 as per my requirement. So by set this Transaction fees My transaction does not deduct much more fees.</p>

CC BY-SA 4.0
2018-06-30T08:40:30.100Z
2018-06-30T08:40:30.100Z
Hardik Dhankecha
<p>I want to transfer Bitcoin from one individual address to another using API. But I want to set Transaction fees as per my requirement. So How can I do it ?</p>

<p>Right now I am using blockchain-transaction - npm api for transfer bitcoin from one address to another. So please shade some lights on this.</p>

<pre><code>var bitcoinTransaction = require('bitcoin-transaction');
//Send all my money from wallet1 to wallet2 on the bitcoin testnet
var from = "mm3gdVh8n6YtcNyaTKYkveB6yTME7aDWNJ";
var to = "mgPUfqJk4X6gE4P5Do5RfpkTFsYmsSjCya";
var privKeyWIF = "cNZi8iySqBToXMpcsQaHKD5uv7HExBQJBSi4dTg3ZPaEzeNAzvbj";    //Private key in WIF form (Can generate this from bitcoinlib-js)
bitcoinTransaction.getBalance(from, { network: "testnet" }).then((balanceInBTC) =&gt; {
    return bitcoinTransaction.sendTransaction({
from: from,
to: to,
privKeyWIF: privKeyWIF,
btc: balanceInBTC,
network: "testnet"
});
});
</code></pre>

<bitcoin-core><blockchain><transaction-fees><api><fee-estimation>
Bitcoin Transaction using API with Custom Fees
Hardik Dhankecha
# Bitcoin Transaction using API with Custom Fees

(Asked by: username_0 on 2018-06-29)

I want to transfer Bitcoin from one individual address to another using API. But I want to set Transaction fees as per my requirement. So How can I do it ?

Right now I am using blockchain-transaction - npm api for transfer bitcoin from one address to another. So please shade some lights on this.

```
var bitcoinTransaction = require('bitcoin-transaction');
//Send all my money from wallet1 to wallet2 on the bitcoin testnet
var from = "mm3gdVh8n6YtcNyaTKYkveB6yTME7aDWNJ";
var to = "mgPUfqJk4X6gE4P5Do5RfpkTFsYmsSjCya";
var privKeyWIF = "cNZi8iySqBToXMpcsQaHKD5uv7HExBQJBSi4dTg3ZPaEzeNAzvbj";    //Private key in WIF form (Can generate this from bitcoinlib-js)
bitcoinTransaction.getBalance(from, { network: "testnet" }).then((balanceInBTC) => {
    return bitcoinTransaction.sendTransaction({
from: from,
to: to,
privKeyWIF: privKeyWIF,
btc: balanceInBTC,
network: "testnet"
});
});

```

**Tags:** bitcoin-core, blockchain, transaction-fees, api, fee-estimation


---

## 2 answers

### Answer by username_1 on 2018-06-29. Score: 0

I have not tried this myself but having a look through the documentation on blockchain-transaction - npm api it looks like you can query fees, under the advanced section:

> fees - Gets a list of current fees based on the BitCoin network going
> rate.

<https://www.npmjs.com/package/bitcoin-transaction>

Looks like you can select a 'fastest' option or others:

> Set the fee for the transaction. Can be either one of "fastest",
> "halfHour" or "hour" in which case the actual fee numbers are fetched
> from the fees provider. Or it can be just a plain number in which case
> that will be used as the Fee per Byte value in Satoshis. It is
> recommended to use one of the string aliases unless you know what you
> are doing.

You might have to specify a feesProvider, not sure if they have a default selected when nothing set.

> **Comments:**
> **username_0**: I have try it in my code but it's not working. It shows me same error.  First of all I try `Fees=3`(as integer) after that `Fees="3"`(as string) and also I have try for FeesProvider. but no luck.  
> **username_1**: "It is recommended to use one of the string aliases unless you know what you are doing."  
> **username_1**: "Can be either one of "fastest", "halfHour" or "hour" in which case the actual fee numbers are fetched from the fees provider."  

---

### Answer by username_0 on 2018-06-30. Score: 0

Finally I get answer for this question by surfing very much for this topic.

I found source code for transfer Bitcoin from one individual account to another.

"<https://github.com/Blank101/bitcoin-transaction/blob/master/index.js>"

and there I set feePerByte = 3 as per my requirement. So by set this Transaction fees My transaction does not deduct much more fees.


---

