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?