bitcore/README.md

135 lines
3.8 KiB
Markdown
Raw Normal View History

2014-01-22 14:12:45 -08:00
Bitcore
2013-07-04 13:02:18 -07:00
=======
2013-07-04 12:55:19 -07:00
2014-04-08 12:10:52 -07:00
[![Build Status](https://travis-ci.org/bitpay/bitcore.svg?branch=master)](https://travis-ci.org/bitpay/bitcore)
2014-06-05 12:44:32 -07:00
[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcore.svg)](https://coveralls.io/r/bitpay/bitcore)
2014-04-08 12:10:52 -07:00
2014-01-22 14:12:45 -08:00
A pure, powerful core for your bitcoin project.
2014-01-22 14:12:45 -08:00
Bitcore is a complete, native interface to the Bitcoin network, and provides the core functionality needed to develop apps for bitcoin.
2014-01-22 14:12:45 -08:00
#Principles
2014-02-03 12:54:26 -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-22 14:12:45 -08:00
**Bitcore unchains developers from fallible, centralized APIs, and provides the tools to interact with the real Bitcoin network.**
2014-01-22 14:12:45 -08:00
#Get Started
2014-01-22 14:12:45 -08:00
Bitcore runs on [node](http://nodejs.org/), and can be installed via [npm](https://npmjs.org/):
2014-01-22 14:12:45 -08:00
```
npm install bitcore
```
2014-03-24 14:52:57 -07:00
It is a collection of objects useful to bitcoin applications; class-like idioms are enabled via [Soop](https://github.com/bitpay/soop). In most cases, a developer will require the object's class directly. For instance:
2014-01-23 08:17:43 -08:00
```
var bitcore = require('bitcore');
var Address = bitcore.Address;
var Transaction = bitcore.Transaction;
var PeerManager = bitcore.PeerManager;
2014-01-23 08:17:43 -08:00
```
2014-01-23 07:26:27 -08:00
#Examples
Examples are provided [here](examples.md)
Or in form of .js files at [/examples](/examples) folder.
2014-01-22 14:12:45 -08:00
#Security
2014-01-23 08:17:43 -08:00
Please use at your own risk.
2014-01-22 14:12:45 -08:00
2014-01-23 08:17:43 -08:00
Bitcore is still under heavy development and not quite ready for "drop-in" production use. If you find a security issue, please email security@bitcore.io.
2014-01-22 14:12:45 -08:00
#Contributing
2014-01-22 14:12:45 -08:00
Bitcore needs some developer love. Please send pull requests for bug fixes, code optimization, and ideas for improvement.
#Browser support
2014-03-11 14:16:44 -07:00
## Building the browser bundle
To build bitcore full bundle for the browser (this is automatically executed after you run `npm install`):
2014-03-11 14:16:44 -07:00
```
2014-03-12 05:37:24 -07:00
node browser/build.js -a
2014-03-11 14:16:44 -07:00
```
This will generate a `browser/bundle.js` file which you can include in your HTML to use bitcore in the browser.
2014-03-11 14:16:44 -07:00
##Example browser usage
From example/simple.html
```
2014-03-11 14:16:44 -07:00
<!DOCTYPE html>
<html>
<body>
<script src="../browser/bundle.js"></script>
<script>
var bitcore = require('bitcore');
var Address = bitcore.Address;
var a = new Address('1KerhGhLn3SYBEQwby7VyVMWf16fXQUj5d');
console.log('1KerhGhLn3SYBEQwby7VyVMWf16fXQUj5d is valid? '+a.isValid());
</script>
</body>
</html>
```
2014-02-03 12:33:45 -08:00
You can check a more complex usage example at examples/example.html.
2014-03-11 14:16:44 -07:00
## Generating a customized browser bundle
To build the main bitcore bundle, run:
```
node browser/build.js -m
```
To build all features into the bitcore bundle (which will lead to a large filesize), run:
```
node browser/build.js -a
```
To generate a customized bitcore bundle, you can specify which submodules you want to include in it with the -s option:
2014-03-11 14:16:44 -07:00
```
2014-03-12 05:37:24 -07:00
node browser/build.js -s Transaction,Address
2014-03-11 14:16:44 -07:00
```
This will generate a `browser/bundle.js` containing only the Transaction and Address class, with all their dependencies. Use this option if you are not using the whole bitcore library, to optimize the bundle size, script loading time, and general resource usage.
2014-02-26 11:16:42 -08:00
## Tests
Run tests in node:
```
mocha
```
Or generate tests in the browser:
```
grunt shell
```
And then open test/index.html in your browser.
To run the code coverage report:
```
npm run-script coverage
```
And then open coverage/lcov-report/index.html in your browser.
2014-02-07 18:08:56 -08:00
#License
**Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).**
Copyright 2013-2014 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
2014-02-03 12:35:51 -08:00
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bitpay/bitcore/trend.png)](https://bitdeli.com/free "Bitdeli Badge")