Skip to content

Instantly share code, notes, and snippets.

@orweinberger
Created January 8, 2015 15:24
Show Gist options
  • Save orweinberger/3bd7dfdc574be58539c5 to your computer and use it in GitHub Desktop.
Save orweinberger/3bd7dfdc574be58539c5 to your computer and use it in GitHub Desktop.
Generate a raw transaction using bitcoinjs-lib
var bitcoin = require(‘bitcoinjs-lib’);
var key = bitcoin.ECKey.fromWIF("L1Kzcyy88LyckShYdvoLFg1FYpB5ce1JmTYtieHrhkN65GhVoq73");
var tx = new bitcoin.TransactionBuilder();
tx.addInput("d18e7106e5492baf8f3929d2d573d27d89277f3825d3836aa86ea1d843b5158b", 1);
tx.addOutput("12idKQBikRgRuZEbtxXQ4WFYB7Wa3hZzhT", 149000);
tx.sign(0, key);
console.log(tx.build().toHex());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment