Setting up Development Environment

Install Node.js

Install Node.js by your favorite method, or use Node Version Manager by following directions at

nvm install v4

Fork and Download Repositories

To develop bitcore-node:

cd ~
git clone [email protected]:<yourusername>/bitcore-node.git
git clone [email protected]:<yourusername>/bitcore-lib.git

To develop bitcoin or to compile from source:

git clone [email protected]:<yourusername>/bitcoin.git
git fetch origin <branchname>:<branchname>
git checkout <branchname>

Note: See bitcoin documentation for building bitcoin on your platform.

Install Development Dependencies

For Ubuntu:

sudo apt-get install libzmq3-dev
sudo apt-get install build-essential

Note: Make sure that libzmq-dev is not installed, it should be removed when installing libzmq3-dev.

For Mac OS X:

brew install zeromq
cd bitcore-lib
npm install
cd ../bitcore-node
npm install

Note: If you get a message about not being able to download bitcoin distribution, you'll need to compile bitcoind from source, and setup your configuration to use that version.

We now will setup symlinks in bitcore-node (repeat this for any other modules you're planning on developing):

cd node_modules
rm -rf bitcore-lib
ln -s ~/bitcore-lib
rm -rf bitcoind-rpc
ln -s ~/bitcoind-rpc

And if you're compiling or developing bitcoin:

cd ../bin
ln -sf ~/bitcoin/src/bitcoind

Run Tests

If you do not already have mocha installed:

npm install mocha -g

To run all test suites:

cd bitcore-node
npm run regtest
npm run test

To run a specific unit test in watch mode:

mocha -w -R spec test/services/bitcoind.unit.js

To run a specific regtest:

mocha -R spec regtest/bitcoind.js

Running a Development Node

To test running the node, you can setup a configuration that will specify development versions of all of the services:

cd ~
mkdir devnode
cd devnode
mkdir node_modules
touch bitcore-node.json
touch package.json

Edit bitcore-node.json with something similar to:

  "network": "livenet",
  "port": 3001,
  "services": [
  "servicesConfig": {
    "bitcoind": {
      "spawn": {
        "datadir": "/home/<youruser>/.bitcoin",
        "exec": "/home/<youruser>/bitcoin/src/bitcoind"

Note: To install services insight-api and insight-ui you'll need to clone the repositories locally.

Setup symlinks for all of the services and dependencies:

cd node_modules
ln -s ~/bitcore-lib
ln -s ~/bitcore-node
ln -s ~/insight-api
ln -s ~/insight-ui

Make sure that the <datadir>/bitcoin.conf has the necessary settings, for example:


From within the devnode directory with the configuration file, start the node:

../bitcore-node/bin/bitcore-node start