var bitcoin = require("bitcoinjs-lib"); tx = new bitcoin.Transaction() tx.addInput("44f730d44973366fb7dfea7291e5a0257a7ec1b2d568b3de524516e6efd2e111", 0) tx.addOutput("1Gx9FCknxSsLfFDzFdn75Xgqx95sDp38ir", 15000) //;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; key = bitcoin.ECKey.makeRandom() // Print your private key (in WIF format) console.log(key.toWIF()) // => Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct // Print your public key (toString defaults to a Bitcoin address) console.log(key.pub.getAddress().toString()) // => 14bZ7YWde4KdRb5YN7GYkToz3EHVCvRxkF //;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; // Initialize a private key using WIF key = bitcoin.ECKey.fromWIF("L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy") // Sign the first input with the new key tx.sign(0, key) // Print transaction serialized as hex console.log("Serialized transaction:") console.log(tx.toHex()) // => 0100000001313eb630b128102b60241ca895f1d0ffca21 ... // You could now push the transaction onto the Bitcoin network manually (see https://blockchain.info/pushtx)