2011-05-06 01:08:46 +02:00
# bitcoinjs-lib
2014-03-03 05:07:30 +01:00
[![browser support ](https://ci.testling.com/bitcoinjs/bitcoinjs-lib.png )](https://ci.testling.com/bitcoinjs/bitcoinjs-lib)
2013-04-21 11:04:23 +02:00
2014-03-08 22:08:08 +01:00
A pure JavaScript Bitcoin library for node.js and browsers. Backed by (slowly improving) testing, proven by over a million wallet users. The backbone for almost all Bitcoin web wallets in production today.
This is not the original bitcoinjs-lib that was not updated for a while. The current bitcoinjs-lib has been refactored to clean things up, add new functionality and merge improvements from the community. If you are looking for the original, it will be tagged as `0.1.3` . We will use `0.2.x` for releases based on these changes, so be sure to use the `0.1.3` tag if you need the original version.
## Features
2011-05-06 01:08:46 +02:00
2014-03-08 22:08:08 +01:00
- Bitcoin Testnet and Mainnet (production) support
2014-03-01 14:03:37 +01:00
- [HD Wallets ](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki )
2014-03-08 22:08:08 +01:00
- Highly secure random private key / address generation using [window.crypto.getRandomValues ](https://developer.mozilla.org/en-US/docs/Web/API/Window.crypto )
2014-03-01 14:03:37 +01:00
- ECDSA signing and verification
2014-03-08 22:08:08 +01:00
- Transaction creation (pay-to-pubkey-hash), support for multisignature transactions
- A (somewhat incomplete) wallet implementation, improvements ongoing
2011-05-06 01:08:46 +02:00
2014-03-08 22:08:08 +01:00
## Installation
2011-12-20 12:47:50 +01:00
2014-03-01 14:03:37 +01:00
`npm install bitcoinjs-lib`
2013-10-07 14:21:00 +02:00
2014-03-08 22:08:08 +01:00
Note: The npm version is currently out of date, are working to resolve this. The best way to use the latest code is to clone the repository.
## Usage
### Run the test suite
$ npm test
### Node.js
var bitcoin = require('bitcoinjs-lib')
From the repo:
2014-03-01 14:03:37 +01:00
2014-03-08 22:08:08 +01:00
var bitcoin = require('./src/index.js')
2014-03-01 14:03:37 +01:00
2014-03-08 22:08:08 +01:00
### Browser
2014-03-05 22:53:29 +01:00
2014-03-08 22:08:08 +01:00
Compile `bitcoinjs-min.js` with the following command:
2014-03-05 22:53:29 +01:00
2014-03-08 22:08:08 +01:00
$ npm run-script compile
2014-03-05 22:53:29 +01:00
2014-03-08 22:08:08 +01:00
After loading this file in your browser, you will be able to use the global `Bitcoin` object.
2014-03-01 14:03:37 +01:00
2014-03-08 22:08:08 +01:00
## Projects utilizing bitcoinjs-lib
2014-03-01 14:03:37 +01:00
2014-03-08 22:08:08 +01:00
- [Blockchain.info Wallet ](http://blockchain.info/wallet )
- [Coinpunk ](https://coinpunk.com )
- [Bitaddress.org ](https://www.bitaddress.org )
2014-03-01 14:03:37 +01:00
2014-03-08 22:08:08 +01:00
## Alternatives
2014-03-01 14:03:37 +01:00
2014-03-08 22:08:08 +01:00
- [Bitcore ](https://github.com/bitpay/bitcore )
- [Cryptocoin ](https://github.com/cryptocoinjs/cryptocoin )
2013-10-07 14:21:00 +02:00
2014-03-08 22:08:08 +01:00
## License
2011-12-20 12:47:50 +01:00
2014-03-08 22:08:08 +01:00
This library is free and open-source software released under the MIT license.
2012-07-30 19:09:21 +02:00
2014-03-08 22:08:08 +01:00
## Copyright
2012-07-30 19:09:21 +02:00
2014-03-01 14:03:37 +01:00
BitcoinJS (c) 2011-2012 Stefan Thomas
Released under MIT license
2012-07-30 19:09:21 +02:00
http://bitcoinjs.org/
2014-03-01 14:03:37 +01:00
JSBN (c) 2003-2005 Tom Wu
Released under BSD license
2012-07-30 19:09:21 +02:00
http://www-cs-students.stanford.edu/~tjw/jsbn/
2014-03-01 14:03:37 +01:00
CryptoJS (c) 2009– 2012 by Jeff Mott
Released under New BSD license
2012-07-30 19:09:21 +02:00
http://code.google.com/p/crypto-js/