* directly contributed code or funding to the project.
$ npm install -g bitcoinjs-lib
$ npm -g install bitcoinjs-lib browserify uglify-js $ browserify -r bitcoinjs-lib -s bitcoin | uglifyjs > bitcoinjs.min.js
var keyPair = bitcoin.ECPair.makeRandom() // Print your private key (in WIF format) console.log(keyPair.toWIF()) // => Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct // Print your public key address console.log(keyPair.getAddress()) // => 14bZ7YWde4KdRb5YN7GYkToz3EHVCvRxkF
var tx = new bitcoin.TransactionBuilder() // Add the input (who is paying) of the form [previous transaction hash, index of the output to use] tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31", 0) // Add the output (who to pay to) of the form [payee's address, amount in satoshis] tx.addOutput("1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK", 15000) // Initialize a private key using WIF var keyPair = bitcoin.ECKey.fromWIF("L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy") // Sign the first input with the new key tx.sign(0, keyPair) // Print transaction serialized as hex console.log(tx.build().toHex()) // => 0100000001313eb630b128102b60241ca895f1d0ffca21 ... // You could now push the transaction onto the Bitcoin network manually (see https://blockchain.info/pushtx)
Soon. For now, use the tests as a reference. They show what the code is supposed to do.
Stefan Thomas is the inventor and creator of this project. His pioneering work made Bitcoin web wallets possible.
Since then, many developers have joined in to improve the library. Click here to see the full list.
Daniel Cousens, Wei Lu, JP Richardson and Kyle Drake lead the major refactor of the library from 0.1.3 to 1.0.0.
We always welcome help on the library. If you want to help build (or fix bugs), fork the repository, create a topic branch (keep it focused, and ADD TESTS), make the change, commit to your forked repo, and send a pull request.