Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ RUN $PKG_NAME install @owstack/ows-explorer@0.0.3
RUN $PKG_NAME install @owstack/ows-elastic-sync@1.0.3

USER root
CMD ["btcnode","start"]
CMD ["btcnode", "start", "-c", "/home/ows/config", "-m", "/home/ows/bitcoin-core-services"]
16 changes: 3 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
version: '3.2'
services:
bitcoin-core-conf:
build: extra/compose
volumes:
- bitcoin-core-data-dir:/data
- btc-conf-dir:/home/ows/config
bitcoin-core:
image: "owstack/bitcoin-core:0.14.1-ows"
user: root
Expand All @@ -17,18 +12,13 @@ services:
- "28332:28332"
- "28333:28333"
volumes:
- bitcoin-core-data-dir:/data
depends_on:
- "bitcoin-core-conf"
- /data/bitcoin-core:/data
btc-node:
build: .
ports:
- "3001:3001"
depends_on:
- "bitcoin-core"
volumes:
- btc-conf-dir:/home/ows/config
command: "btcnode start -c /home/ows/config"
volumes:
bitcoin-core-data-dir:
btc-conf-dir:
- /data/btc-node:/home/ows/config
command: "btcnode start -c /home/ows/config -m /home/ows/bitcoin-core-services"
16 changes: 11 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ Edit `btc-node.json` with something similar to:
],
"servicesConfig": {
"bitcoind": {
"spawn": {
"datadir": "/home/<youruser>/.bitcoin",
"exec": "/home/<youruser>/bitcoin/src/bitcoind"
}
"connect": [{
"zmqpubrawtx": "tcp://bitcoin-core:28332",
"zmqpubhashblock": "tcp://bitcoin-core:28332",
"rpcprotocol": "http",
"rpchost": "bitcoin-core",
"rpcport": 8332,
"rpcuser": "bitcoin",
"rpcpassword": "local321"
}]

},
"explorer-api": {
"module": "btc-explorer-api"
Expand Down Expand Up @@ -162,4 +168,4 @@ rpcpassword=local321
From within the `devnode` directory with the configuration file, start the node:
```bash
../btc-node/bin/btc-node start
```
```
14 changes: 9 additions & 5 deletions docs/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ var myNode = new btc.Node({
name: 'bitcoind',
module: Bitcoin,
config: {
spawn: {
datadir: '/home/<username>/.bitcoin',
exec: '/home/<username>/btc-node/bin/bitcoind'
}
"connect": [{
"zmqpubrawtx": "tcp://bitcoin-core:28332",
"zmqpubhashblock": "tcp://bitcoin-core:28332",
"rpcprotocol": "http",
"rpchost": "bitcoin-core",
"rpcport": 8332,
"rpcuser": "bitcoin",
"rpcpassword": "local321"
}]
}
},
{
Expand Down Expand Up @@ -85,4 +90,3 @@ A new service can be created by inheriting from `Node.Service` and implementing
The `package.json` for the service module can either export the `Node.Service` directly, or specify a specific module to load by including `"btcNode": "lib/btc-node.js"`.

Please take a look at some of the existing services for implementation specifics.

15 changes: 1 addition & 14 deletions docs/services/bitcoind.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,7 @@ The Bitcoin Service is a Node.js interface to [Bitcoin Core](https://github.com/

## Configuration

The default configuration will include a "spawn" configuration in "bitcoind". This defines the location of the block chain database and the location of the `bitcoind` daemon executable. The below configuration points to a local clone of `bitcoin`, and will start `bitcoind` automatically with your Node.js application.

```json
"servicesConfig": {
"bitcoind": {
"spawn": {
"datadir": "/home/btc/.bitcoin",
"exec": "/home/btc/bitcoin/src/bitcoind"
}
}
}
```

It's also possible to connect to separately managed `bitcoind` processes with round-robin quering, for example:
It is possible to connect to separately managed `bitcoind` processes with round-robin quering, for example:

```json
"servicesConfig": {
Expand Down
13 changes: 0 additions & 13 deletions extra/compose/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions extra/compose/default.bitcoin.conf

This file was deleted.

13 changes: 0 additions & 13 deletions extra/compose/default.btc-node.conf

This file was deleted.

28 changes: 0 additions & 28 deletions extra/compose/default.btc-node.json

This file was deleted.

18 changes: 10 additions & 8 deletions lib/scaffold/default-base-config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
'use strict';

var path = require('path');

/**
* Will return the path and default btc-node configuration on environment variables
* or default locations.
* @param {Object} options
* @param {String} options.network - "testnet" or "livenet"
* @param {String} options.datadir - Absolute path to bitcoin database directory
* @param {String} options.network - testnet or livenet
*/
function getDefaultBaseConfig(options) {
if (!options) {
Expand All @@ -21,10 +18,15 @@ function getDefaultBaseConfig(options) {
services: ['bitcoind', 'web'],
servicesConfig: {
bitcoind: {
spawn: {
datadir: options.datadir || path.resolve(process.env.HOME, '.bitcoin'),
exec: path.resolve(__dirname, '../../bin/bitcoind')
}
connect: [{
zmqpubrawtx: 'tcp://bitcoin-core:28332',
zmqpubhashblock: 'tcp://bitcoin-core:28332',
rpcprotocol: 'http',
rpchost: 'bitcoin-core',
rpcport: 8332,
rpcuser: 'bitcoin',
rpcpassword: 'local321'
}]
}
}
}
Expand Down
15 changes: 10 additions & 5 deletions lib/scaffold/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var fs = require('fs');

/**
* Will return the path and default btc-node configuration. It will search for the
* configuration file in the "~/.btc" directory, and if it doesn't exist, it will create one
* configuration file in the ~/.btc directory, and if it doesn't exist, it will create one
* based on default settings.
* @param {Object} [options]
* @param {Array} [options.additionalServices] - An optional array of services.
Expand Down Expand Up @@ -36,10 +36,15 @@ function getDefaultConfig(options) {
services: defaultServices,
servicesConfig: {
bitcoind: {
spawn: {
datadir: path.resolve(defaultPath, './data'),
exec: path.resolve(__dirname, '../../bin/bitcoind')
}
connect: [{
zmqpubrawtx: 'tcp://bitcoin-core:28332',
zmqpubhashblock: 'tcp://bitcoin-core:28332',
rpcprotocol: 'http',
rpchost: 'bitcoin-core',
rpcport: 8332,
rpcuser: 'bitcoin',
rpcpassword: 'local321'
}]
}
}
};
Expand Down
13 changes: 9 additions & 4 deletions lib/scaffold/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ function checkConfigVersion2(fullConfig) {
var missingConfig = {
servicesConfig: {
bitcoind: {
spawn: {
datadir: fullConfig.datadir,
exec: path.resolve(__dirname, '../../bin/bitcoind')
}
connect: [{
zmqpubrawtx: 'tcp://bitcoin-core:28332',
zmqpubhashblock: 'tcp://bitcoin-core:28332',
rpcprotocol: 'http',
rpchost: 'bitcoin-core',
rpcport: 8332,
rpcuser: 'bitcoin',
rpcpassword: 'local321'
}]
}
}
};
Expand Down
Loading