Refactor readme

This commit is contained in:
Esteban Ordano 2014-11-22 18:41:12 -03:00
parent 33d0bc0255
commit debcb89996
1 changed files with 35 additions and 91 deletions

126
README.md
View File

@ -4,139 +4,83 @@ Bitcore
[![Build Status](https://travis-ci.org/bitpay/bitcore.svg?branch=master)](https://travis-ci.org/bitpay/bitcore)
[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcore.svg)](https://coveralls.io/r/bitpay/bitcore)
A pure, powerful core for your bitcoin project.
A pure and simple javascript bitcoin API.
Bitcore is a complete, native interface to the Bitcoin network, and provides the core functionality needed to develop apps for bitcoin.
#Principles
## Principles
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.
**Bitcore unchains developers from fallible, centralized APIs, and provides the tools to interact with the real Bitcoin network.**
## Get Started
#Get Started
Bitcore runs on [node](http://nodejs.org/), and can be installed via [npm](https://npmjs.org/):
You can run bitcore on any javascript engine. It's distributed through npm, and you can also find compiled single files here: [bitcore.js](http://missing-link) and [bitcore.min.js](http://missing-link).
```
npm install bitcore
```
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:
Using it on node.js:
```javascript
var bitcore = require('bitcore');
var Address = bitcore.Address;
var Transaction = bitcore.Transaction;
var PeerManager = bitcore.PeerManager;
assert(bitcore.isValid(address));
var simpleTx = new bitcore.Transaction();
var simpleTx.from(unspent).to(address, amount);
simpleTx.sign(privateKey);
```
#Examples
## Documentation
Examples are provided [here](examples.md)
Build the examples by installing and running gulp:
The complete docs are hosted here: [bitcore documentation](http://missing-link). There's also a [bitcore API reference](http://missing-link) available generated from the JSDocs of the project.
```
npm install -g gulp
gulp
```
Javascript files available at [/examples](/examples) folder.
#Security
## Security
Please use at your own risk.
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.
#Contributing
## Contributing
Bitcore needs some developer love. Please send pull requests for bug fixes, code optimization, and ideas for improvement.
#Browser support
Please send pull requests for bug fixes, code optimization, and ideas for improvement.
## Building the browser bundle
To build bitcore full bundle for the browser (this is automatically executed after you run `npm install`):
To build bitcore full bundle for the browser:
```
node browser/build.js -a
```sh
gulp browser
```
This will generate a `browser/bundle.js` file which you can include in your HTML to use bitcore in the browser.
##Example browser usage
From example/simple.html
```html
<!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>
```
You can check a more complex usage example at examples/example.html.
## 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:
```
node browser/build.js -s Transaction,Address
```
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.
This will generate files named `dist/bitcore.js` and `dist/bitcore.min.js`.
## Tests
Run tests in node:
Run all the tests:
```
mocha
```sh
gulp test
```
Or generate tests in the browser:
Run the tests with mocha:
```
grunt shell
```sh
gulp test:node
```
And then open test/index.html in your browser.
Run the tests with karma (uses firefox and chrome):
To run the code coverage report:
```
npm run-script coverage
```sh
gulp test:browser
```
And then open coverage/lcov-report/index.html in your browser.
Create a coverage report (you can open `coverage/lcov-report/index.html` to visualize it):
#License
```sh
gulp coverage
```
**Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).**
## 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.
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bitpay/bitcore/trend.png)](https://bitdeli.com/free "Bitdeli Badge")