docs: various updates
- remove build and update bitcoind - remove outdated error documentation - update bus docs
This commit is contained in:
parent
bb726bac8b
commit
dab49aef39
|
@ -47,7 +47,6 @@ There are several add-on services available to extend the functionality of Bitco
|
||||||
- [Testing & Development](docs/testing.md) - Developer guide for testing
|
- [Testing & Development](docs/testing.md) - Developer guide for testing
|
||||||
- [Node](docs/node.md) - Details on the node constructor
|
- [Node](docs/node.md) - Details on the node constructor
|
||||||
- [Bus](docs/bus.md) - Overview of the event bus constructor
|
- [Bus](docs/bus.md) - Overview of the event bus constructor
|
||||||
- [Errors](docs/errors.md) - Reference for error handling and types
|
|
||||||
- [Release Process](docs/release.md) - Information about verifying a release and the release process.
|
- [Release Process](docs/release.md) - Information about verifying a release and the release process.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
117
docs/build.md
117
docs/build.md
|
@ -1,117 +0,0 @@
|
||||||
# Build & Install
|
|
||||||
This includes a detailed instructions for compiling. There are two main parts of the build, compiling Bitcoin Core as a static library and the Node.js bindings.
|
|
||||||
|
|
||||||
## Ubuntu 14.04 (Unix/Linux)
|
|
||||||
If git is not already installed, it can be installed by running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt-get install git
|
|
||||||
```
|
|
||||||
|
|
||||||
If Node.js v0.12 isn't installed, it can be installed using "nvm", it can be done by following the installation script at [https://github.com/creationix/nvm#install-script](https://github.com/creationix/nvm#install-script) and then install version v0.12
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nvm install v0.12
|
|
||||||
```
|
|
||||||
|
|
||||||
To build Bitcoin Core and bindings development packages are needed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt-get install build-essential libtool autotools-dev automake autoconf pkg-config libssl-dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Clone the bitcore-node repository locally:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/bitpay/bitcore-node.git
|
|
||||||
cd bitcore-node
|
|
||||||
```
|
|
||||||
|
|
||||||
And finally run the build which will take several minutes. A script in the "bin" directory will download Bitcoin Core v0.11, apply a patch (see more info below), and compile the static library and Node.js bindings. You can start this by running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
Once everything is built, you can run bitcore-node via:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
This will then start the syncing process for Bitcoin Core and the extended capabilities as provided by the built-in Address Module (details below).
|
|
||||||
|
|
||||||
## Fedora
|
|
||||||
Later versions of Fedora (>= 22) should also work with this project. The directions for Ubuntu should generally work except the installation of system utilities and libraries is a bit different. Git is already installed and ready for use without installation.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
yum install libtool automake autoconf pkgconfig openssl make gcc gcc-c++ kernel-devel openssl-devel.x86_64 patch
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mac OS X Yosemite
|
|
||||||
If Xcode is not already installed, it can be installed via the Mac App Store (will take several minutes). XCode includes "Clang", "git" and other build tools. Once Xcode is installed, you'll then need to install "xcode-select" via running in a terminal and following the prompts:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
xcode-select --install
|
|
||||||
```
|
|
||||||
|
|
||||||
If "Homebrew" is not yet installed, it's needed to install "autoconf" and others. You can install it using the script at [http://brew.sh](http://brew.sh) and following the directions at [https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Installation.md](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Installation.md) And then run in a terminal:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install autoconf automake libtool openssl pkg-config
|
|
||||||
```
|
|
||||||
|
|
||||||
If Node.js v0.12 and associated commands "node", "npm" and "nvm" are not already installed, you can use "nvm" by running the script at [https://github.com/creationix/nvm#install-script](https://github.com/creationix/nvm#install-script) And then run this command to install Node.js v0.12
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nvm install v0.12
|
|
||||||
```
|
|
||||||
|
|
||||||
Clone the bitcore-node repository locally:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/bitpay/bitcore-node.git
|
|
||||||
cd bitcore-node
|
|
||||||
```
|
|
||||||
|
|
||||||
And finally run the build which will take several minutes. A script in the "bin" directory will download Bitcoin Core v0.11, apply a patch (see more info below), and compile the static library and Node.js bindings. You can start this by running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cross Compilation
|
|
||||||
If you desire to cross compile to ARM or Windows from a system that has cross compilation tools available for use, please use the following directions:
|
|
||||||
|
|
||||||
Using a Debian (Jessie) system as the host system (the system that will be doing the compiling):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo -n "deb http://emdebian.org/tools/debian/ jessie main" | sudo tee -a /etc/apt/sources.list
|
|
||||||
sudo dpkg --add-architecture armhf #or whatever arch you are interested in compiling for
|
|
||||||
sudo apt-get update #you will get GPG KEY warnings, you can decide if you would like to trust the key
|
|
||||||
sudo apt-get install crossbuild-essential-armhf
|
|
||||||
```
|
|
||||||
|
|
||||||
Next is to use the cross compilation toolchain instead of the defaults:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
CXX=arm-linux-gnueabihf-g++ CC=arm-linux-gnueabihf-gcc npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
The only thing different is the setting of CC/CXX environment variables. Please make sure those compilers (arm-linux-gnueabihf-gcc) actually exist and are on your path.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
arm-linux-gnueabihf-g++ -v
|
|
||||||
arm-linux-gnueabihf-gcc -v
|
|
||||||
```
|
|
||||||
|
|
||||||
You should get output with the last line ending with something like this:
|
|
||||||
gcc version 4.9.2 ( 4.9.2-10)
|
|
||||||
|
|
||||||
Once everything is built, you can run bitcore-node via:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
This will then start the syncing process for Bitcoin Core and the extended capabilities as provided by the built-in Address Module (details below).
|
|
|
@ -20,11 +20,11 @@ bus.close();
|
||||||
```javascript
|
```javascript
|
||||||
|
|
||||||
// subscribe to all transaction events
|
// subscribe to all transaction events
|
||||||
bus.subscribe('db/transaction');
|
bus.subscribe('bitcoind/rawtransaction');
|
||||||
|
|
||||||
// only subscribe to events relevant to a bitcoin address
|
// to subscribe to new block hashes
|
||||||
bus.subscribe('address/transaction', ['13FMwCYz3hUhwPcaWuD2M1U2KzfTtvLM89']);
|
bus.subscribe('bitcoind/hashblock');
|
||||||
|
|
||||||
// unsubscribe
|
// unsubscribe
|
||||||
bus.unsubscribe('db/transaction');
|
bus.unsubscribe('bitcoind/rawtransaction');
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
# Errors
|
|
||||||
Many times there are cases where an error condition can be gracefully handled depending on a particular use. To assist in better error handling, errors will have different types so that it's possible to determine the type of error and handle appropriately.
|
|
||||||
|
|
||||||
```js
|
|
||||||
node.services.address.getUnspentOutputs('00000000839a8...', function(err, outputs) {
|
|
||||||
|
|
||||||
if (err instanceof errors.NoOutputs) {
|
|
||||||
// the address hasn't received any transactions
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise the address has outputs (which may be unspent/spent)
|
|
||||||
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information about different types of errors, please see `lib/errors.js`.
|
|
|
@ -292,7 +292,7 @@ node.services.bitcoind.on('tx', function(transactionBuffer) {
|
||||||
});
|
});
|
||||||
|
|
||||||
node.services.bitcoind.on('block', function(blockHash) {
|
node.services.bitcoind.on('block', function(blockHash) {
|
||||||
// a new transaction has left the mempool
|
// a new block has been added
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue