- Jun 29, 2018
- 1
- 1
hello,
I have created bitcoin addresses dynamically using nodejs module. I have private key and address.
we want to tranfer BTC received in those dynamically generated address we have private key for it.
At present we are using below nodejs code to send BTC
var bitcoinTransaction = require('bitcoin-transaction');
var to = "12zyHTgqfm3XT5K9afmaPjhcwvbAYuBBHk";
var from ="1DnqKVAPB9JUxQxuc6xe9jycyvhWhu7NzS";
var privKeyWIF = "XXXX-Privatekey-XXXXXXX";
bitcoinTransaction.getBalance(from, { network: "mainnet" }).then((balanceInBTC) => {
var btcToSend=parseFloat(0.0001);
bitcoinTransaction.sendTransaction({
from: from,
to: to,
privKeyWIF: privKeyWIF,
btc: 0.00000547,
network: "mainnet",
fees: 3,
}).catch((error) => {
console.log(error);
}).then((result)=> {
console.log(result);
});
console.log(balanceInBTC);
}).catch((error) => { console.log(error); });
As we have done the transaction using this code it cost me fees as 206 satoshi per byte
Here is the tx : https://www.[Suspicious link removed]/en/btc/tx/2d4639266d3af9416b1f022193a3587df501a678a794744dbf8f4fddcecc3564
What i have to change to specify fixed fees for transaction. Is there any other API or node module that i can use for transfering BTC from one address to another using private key of address?
I have created bitcoin addresses dynamically using nodejs module. I have private key and address.
we want to tranfer BTC received in those dynamically generated address we have private key for it.
At present we are using below nodejs code to send BTC
var bitcoinTransaction = require('bitcoin-transaction');
var to = "12zyHTgqfm3XT5K9afmaPjhcwvbAYuBBHk";
var from ="1DnqKVAPB9JUxQxuc6xe9jycyvhWhu7NzS";
var privKeyWIF = "XXXX-Privatekey-XXXXXXX";
bitcoinTransaction.getBalance(from, { network: "mainnet" }).then((balanceInBTC) => {
var btcToSend=parseFloat(0.0001);
bitcoinTransaction.sendTransaction({
from: from,
to: to,
privKeyWIF: privKeyWIF,
btc: 0.00000547,
network: "mainnet",
fees: 3,
}).catch((error) => {
console.log(error);
}).then((result)=> {
console.log(result);
});
console.log(balanceInBTC);
}).catch((error) => { console.log(error); });
As we have done the transaction using this code it cost me fees as 206 satoshi per byte
Here is the tx : https://www.[Suspicious link removed]/en/btc/tx/2d4639266d3af9416b1f022193a3587df501a678a794744dbf8f4fddcecc3564
What i have to change to specify fixed fees for transaction. Is there any other API or node module that i can use for transfering BTC from one address to another using private key of address?