2014-12-18 07:43:20 -08:00
Bitcore
=======
2013-07-04 12:55:19 -07:00
2014-12-16 08:56:25 -08:00
[![NPM Package ](https://img.shields.io/npm/v/bitcore.svg?style=flat-square )](https://www.npmjs.org/package/bitcore)
[![Build Status ](https://img.shields.io/travis/bitpay/bitcore.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore)
[![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore)
2015-01-08 07:39:13 -08:00
2014-04-08 12:10:52 -07:00
2014-12-23 11:33:42 -08:00
A pure and powerful JavaScript Bitcoin library.
2014-01-05 16:01:06 -08:00
2014-11-22 13:41:12 -08:00
## Principles
2014-04-17 05:53:14 -07:00
2014-12-23 11:33:42 -08:00
Bitcoin is a powerful new peer-to-peer platform for the next generation of financial technology. The decentralized nature of the Bitcoin network allows for highly resilient bitcoin infrastructure, and the developer community needs reliable, open-source tools to implement bitcoin apps and services.
2014-01-05 16:01:06 -08:00
2014-11-22 13:41:12 -08:00
## Get Started
2014-01-05 16:01:06 -08:00
2014-01-22 14:12:45 -08:00
```
npm install bitcore
```
2014-01-05 16:01:06 -08:00
2014-12-19 14:23:48 -08:00
Using it in Node.js:
2014-04-17 05:53:14 -07:00
2014-09-04 08:44:01 -07:00
```javascript
2014-03-13 10:46:21 -07:00
var bitcore = require('bitcore');
2014-01-23 07:26:27 -08:00
2014-12-22 13:27:39 -08:00
assert(bitcore.Address.isValid('126vMmY1fyznpZiFTTnty3cm1Rw8wuheev'));
2014-11-22 13:41:12 -08:00
var simpleTx = new bitcore.Transaction();
var simpleTx.from(unspent).to(address, amount);
simpleTx.sign(privateKey);
2014-07-07 16:26:41 -07:00
```
2014-11-22 13:41:12 -08:00
## Documentation
2014-02-17 23:49:35 -08:00
2014-12-22 12:54:20 -08:00
The complete docs are hosted here: [bitcore documentation ](http://bitcore.io/guide/ ). There's also a [bitcore API reference ](http://bitcore.io/api/ ) available generated from the JSDocs of the project, where you'll find low-level details on each bitcore utility.
2014-02-17 23:49:35 -08:00
2015-05-26 10:01:20 -07:00
- [Read the Developer Guide ](http://bitcore.io/guide/ )
- [Read the API Reference ](http://bitcore.io/api/ )
2014-12-18 06:50:51 -08:00
2014-12-22 12:47:21 -08:00
To get community assistance and ask for help with implementation questions, please use our [community forums ](http://bitpaylabs.com/c/bitcore ).
2015-02-13 08:33:25 -08:00
## Examples
* [Generate a random address ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#generate-a-random-address )
* [Generate a address from a SHA256 hash ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#generate-a-address-from-a-sha256-hash )
* [Import an address via WIF ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#import-an-address-via-wif )
* [Create a Transaction ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#create-a-transaction )
* [Sign a Bitcoin message ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#sign-a-bitcoin-message )
* [Verify a Bitcoin message ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#verify-a-bitcoin-message )
* [Create an OP RETURN transaction ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#create-an-op-return-transaction )
* [Create a 2-of-3 multisig P2SH address ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#create-a-2-of-3-multisig-p2sh-address )
* [Spend from a 2-of-2 multisig P2SH address ](https://github.com/bitpay/bitcore/blob/master/docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address )
2015-01-21 12:10:09 -08:00
## Modules
2015-01-21 13:31:44 -08:00
This module provides bitcoin's core features. Other features and protocol extensions are built into separate modules. Here is a list of official bitcore modules:
2015-01-21 11:59:56 -08:00
Module | Version | Building | Coverage
-------|---------|----------|---------
2015-03-13 12:35:24 -07:00
< a href = "http://github.com/bitpay/bitcore-payment-protocol" >< img src = "http://bitcore.io/css/images/bitcore-payment-protocol.svg" alt = "bitcore-payment-protocol" height = "28" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-payment-protocol.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-payment-protocol) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-payment-protocol.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-payment-protocol) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-payment-protocol.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-payment-protocol)
< a href = "http://github.com/bitpay/bitcore-p2p" >< img src = "http://bitcore.io/css/images/bitcore-p2p.svg" alt = "bitcore-p2p" height = "28" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-p2p.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-p2p) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-p2p.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-p2p) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-p2p.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-p2p?branch=master)
< a href = "http://github.com/bitpay/bitcore-mnemonic" >< img src = "http://bitcore.io/css/images/bitcore-mnemonic.svg" alt = "bitcore-mnemonic" height = "28" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-mnemonic.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-mnemonic) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-mnemonic.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-mnemonic) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-mnemonic.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-mnemonic)
< a href = "http://github.com/bitpay/bitcore-ecies" >< img src = "http://bitcore.io/css/images/bitcore-ecies.svg" alt = "bitcore-ecies" height = "25" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-ecies.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-ecies) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-ecies.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-ecies) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-ecies.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-ecies)
< a href = "http://github.com/bitpay/bitcore-channel" >< img src = "http://bitcore.io/css/images/bitcore-channel.svg" alt = "bitcore-channel" height = "28" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-channel.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-channel) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-channel.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-channel) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-channel.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-channel)
< a href = "http://github.com/bitpay/bitcore-explorers" >< img src = "http://bitcore.io/css/images/bitcore-explorers.svg" alt = "bitcore-explorers" height = "28" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-explorers.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-explorers) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-explorers.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-explorers) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-explorers.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-explorers)
< a href = "http://github.com/bitpay/bitcore-message" >< img src = "http://bitcore.io/css/images/bitcore-message.svg" alt = "bitcore-message" height = "28" ></ a > | [![NPM Package ](https://img.shields.io/npm/v/bitcore-message.svg?style=flat-square )](https://www.npmjs.org/package/bitcore-message) | [![Build Status ](https://img.shields.io/travis/bitpay/bitcore-message.svg?branch=master&style=flat-square )](https://travis-ci.org/bitpay/bitcore-message) | [![Coverage Status ](https://img.shields.io/coveralls/bitpay/bitcore-message.svg?style=flat-square )](https://coveralls.io/r/bitpay/bitcore-message)
2015-01-21 11:59:56 -08:00
2014-11-22 13:41:12 -08:00
## Security
2014-04-17 05:53:14 -07:00
2014-12-22 12:42:45 -08:00
We're using Bitcore in production, as are [many others ](http://bitcore.io#projects ), but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.
2014-01-22 14:12:45 -08:00
2014-12-22 12:42:45 -08:00
If you find a security issue, please email security@bitpay.com.
2014-01-22 14:12:45 -08:00
2014-11-22 13:41:12 -08:00
## Contributing
2014-04-17 05:53:14 -07:00
2014-12-22 13:03:15 -08:00
Please send pull requests for bug fixes, code optimization, and ideas for improvement. For more information on how to contribute, please refer to our [CONTRIBUTING ](https://github.com/bitpay/bitcore/blob/master/CONTRIBUTING.md ) file.
2014-04-17 05:53:14 -07:00
2014-12-19 14:23:48 -08:00
## Building the Browser Bundle
2014-04-17 05:53:14 -07:00
2014-11-22 13:41:12 -08:00
To build bitcore full bundle for the browser:
2014-03-11 14:16:44 -07:00
2014-11-22 13:41:12 -08:00
```sh
gulp browser
2014-03-11 14:16:44 -07:00
```
2015-02-18 11:23:17 -08:00
This will generate files named `bitcore.js` and `bitcore.min.js` .
2015-05-26 10:01:20 -07:00
You can also use our pre-generated files, provided for each release along with a PGP signature by one of the project's maintainers. To get them, checkout a release commit (for example, https://github.com/bitpay/bitcore/commit/e33b6e3ba6a1e5830a079e02d949fce69ea33546 for v0.12.6).
2015-02-18 11:23:17 -08:00
To verify signatures, use the following PGP keys:
- @braydonf: https://pgp.mit.edu/pks/lookup?op=get& search=0x9BBF07CAC07A276D
2015-05-26 10:01:20 -07:00
- @pnagurny: https://pgp.mit.edu/pks/lookup?op=get& search=0x0909B33F0AA53013
2014-06-20 19:38:56 -07:00
2014-11-22 13:41:12 -08:00
## Tests
2014-06-20 19:38:56 -07:00
2014-11-22 13:41:12 -08:00
Run all the tests:
2014-03-11 14:16:44 -07:00
2014-11-22 13:41:12 -08:00
```sh
gulp test
2014-03-11 14:16:44 -07:00
```
2014-03-19 06:43:14 -07:00
2015-02-18 11:00:18 -08:00
You can also run just the NodeJS tests with `gulp test:node` , just the browser tests with `gulp test:browser`
or create a test coverage report (you can open `coverage/lcov-report/index.html` to visualize it) with `gulp coverage` .
2014-03-19 06:43:14 -07:00
2014-11-22 13:41:12 -08:00
## License
2014-02-07 18:08:56 -08:00
2014-11-22 13:41:12 -08:00
Code released under [the MIT license ](https://github.com/bitpay/bitcore/blob/master/LICENSE ).
2014-02-07 18:08:56 -08:00
2014-12-22 13:03:15 -08:00
Copyright 2013-2015 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.