|
|
@ -44,23 +44,38 @@ If you are looking for the original, it is tagged as `0.1.3`. Unless you need it |
|
|
|
|
|
|
|
var bitcoin = require('bitcoinjs-lib') |
|
|
|
|
|
|
|
From the repo: |
|
|
|
|
|
|
|
var bitcoin = require('./src/index.js') |
|
|
|
### Browser |
|
|
|
|
|
|
|
If you're familiar with how to use browserify, ignore this and proceed normally. |
|
|
|
These steps are advisory only and allow you to use the API to its full extent. |
|
|
|
|
|
|
|
### Browser |
|
|
|
[Browserify](https://github.com/substack/node-browserify) is assumed to be installed for these steps. |
|
|
|
|
|
|
|
From your repository, create a `foobar.js` file |
|
|
|
|
|
|
|
``` javascript |
|
|
|
var foobar = { |
|
|
|
base58: require('bs58'), |
|
|
|
bitcoin: require('bitcoinjs-lib'), |
|
|
|
ecurve: require('ecurve'), |
|
|
|
BigInteger: require('bigi'), |
|
|
|
Buffer: require('buffer') |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = foobar |
|
|
|
``` |
|
|
|
|
|
|
|
From the repository: Compile `bitcoinjs-min.js` with the following command: |
|
|
|
Each of these included packages are seperate to `bitcoinjs-lib`, and must be installed separately. |
|
|
|
They are however used in the bitcoinjs-lib public API. |
|
|
|
|
|
|
|
$ npm run-script compile |
|
|
|
Using browserify, compile `foobar.js` for use in the browser: |
|
|
|
|
|
|
|
From NPM: |
|
|
|
$ browserify foobar.js -s foobar > foobar.js |
|
|
|
|
|
|
|
$ npm -g install bitcoinjs-lib browserify uglify-js |
|
|
|
$ browserify -r bitcoinjs-lib -s bitcoin | uglifyjs > bitcoinjs.min.js |
|
|
|
You will then be able to load `foobar.js` into your browser, with each of the dependencies above accessible from the global `foobar` object. |
|
|
|
|
|
|
|
After loading this file in your browser, you will be able to use the global `bitcoin` object. |
|
|
|
**NOTE**: See our package.json for the currently supported version of browserify used by this repository. |
|
|
|
|
|
|
|
|
|
|
|
## Examples |
|
|
|