How to send Bitcoins with node js

0 votes

I am trying to make a web app where if I push on a button, it will send some bitcoins from my bitcoin wallet (A) to another peer's bitcoin wallet (B). I've figured out how to make a raw bitcoin transaction like this:

var bitcoin = require('bitcoinjs-lib');

var keyPair = bitcoin.ECPair.fromWIF('****************************');
var tx = new bitcoin.TransactionBuilder();

tx.addInput('****************************', 0);
tx.addOutput('****************************', 546);
tx.sign(0, keyPair);

console.log(tx.build().toHex());
generatedhash = tx.build().toHex();

If I take the generatedhash to a website like https://blockr.io/tx/push , will it succesfully do the bitcoin transaction? If so, I'd like to know if its possible to automate pushing the raw transaction using js as well? 

Jul 20, 2018 in Blockchain by sabby
• 4,370 points
3,410 views

1 answer to this question.

0 votes
This website https://blockr.io/tx/push will successfully do the bitcoin transaction.

You can do a post request with axios to push it through: api.blockcypher.com/v1/bcy/test/txs/push once you've generated the raw transaction.
answered Jul 20, 2018 by Christine
• 15,790 points

Related Questions In Blockchain

+3 votes
2 answers

How to run ethereumjs using Node.JS

You need to install testrpc globally on ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points
1,441 views
0 votes
1 answer

How to create tokens in smart contracts from node.js?

Any modification to the Ethereum Blockchain will ...READ MORE

answered Jun 27, 2018 in Blockchain by Shashank
• 10,400 points
1,688 views
0 votes
1 answer

How to send bitcoins to multiple recipients at once?

To send bitcoins to multiple recipients, you ...READ MORE

answered Aug 1, 2018 in Blockchain by slayer
• 29,370 points
712 views
0 votes
1 answer

How to add https security for Node js?

You need to add the key and cert to the createServer function. const options ...READ MORE

answered Aug 10, 2018 in Blockchain by digger
• 26,740 points
830 views
0 votes
1 answer

blockchain.info api_code is missing

Check the blockchain api. it should be $Blockchain ...READ MORE

answered Aug 22, 2018 in Blockchain by slayer
• 29,370 points
1,261 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How can I send data to docker?

Whenever i invoke chaincode from the cli ...READ MORE

answered Nov 17, 2018 in Blockchain by Christine
• 15,790 points
592 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP