Skip to content

Commit

Permalink
feat: docker-compose setup for BTCV explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
krecik committed Jun 10, 2021
1 parent 5b64476 commit 943df05
Show file tree
Hide file tree
Showing 12 changed files with 1,559 additions and 2,967 deletions.
17 changes: 17 additions & 0 deletions .env-local-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# API
RPC_HOST=bitcoinvault
RPC_USER=user
RPC_PASSWORD=password
RPC_PORT=18332
DB_URL=mongodb
DB_NAME=blockchain
DB_PORT=27017

# Bitcoin Vault

BVAULTD_RPC_PASSWORD=password
BVAULTD_RPC_USER=user
BVAULTD_RPC_ALLOW_IP_FIRST=0.0.0.0/0
BVAULTD_TESTNET_ENABLED=1
BVAULTD_TXINDEX=1
BVAULTD_RPC_PORT=18332
33 changes: 13 additions & 20 deletions .env-sample
Original file line number Diff line number Diff line change
@@ -1,59 +1,52 @@
# Optional logging settings, see comments after each for more info
#DEBUG=* # Enable all logging, including middleware, etc
DEBUG=app
#DEBUG=btcexp:* # Enable all logging specific to btc-rpc-explorer
#DEBUG=btcexp:app,btcexp:error # Default logging setting if "DEBUG" is not set

# The active coin: BTC/LTC
#BTCEXP_COIN=BTC
BTCEXP_COIN=BTCV

# Host/Port to bind to
#BTCEXP_HOST=127.0.0.1
#BTCEXP_PORT=3002
BTCEXP_HOST=0.0.0.0
BTCEXP_PORT=3002

# Bitcoin RPC Credentials (URI -OR- HOST/PORT/USER/PASS)
#BTCEXP_BITCOIND_URI=bitcoin://rpcusername:rpcpassword@127.0.0.1:8332?timeout=10000
#BTCEXP_BITCOIND_HOST=localhost
#BTCEXP_BITCOIND_PORT=8332
#BTCEXP_BITCOIND_USER=rpcusername
#BTCEXP_BITCOIND_PASS=rpcpassword
BTCEXP_BITCOIND_HOST=bitcoinvault
BTCEXP_BITCOIND_PORT=18332
BTCEXP_BITCOIND_USER=user
BTCEXP_BITCOIND_PASS=password
#BTCEXP_BITCOIND_COOKIE=/path/to/bitcoind/.cookie
#BTCEXP_BITCOIND_RPC_TIMEOUT=5000

# Select optional "address API" to display address tx lists and balances
# Options: electrumx, blockchain.com, blockchair.com, blockcypher.com
# If electrumx set, the BTCEXP_ELECTRUMX_SERVERS variable must also be
# set.
BTCEXP_ADDRESS_API=(electrumx|blockchain.com|blockcypher.com)
BTCEXP_ADDRESS_API=electrumx

# Optional ElectrumX Servers. See BTCEXP_ADDRESS_API. This value is only
# used if BTCEXP_ADDRESS_API=electrumx
#BTCEXP_ELECTRUMX_SERVERS=tls://electrumx.server.com:50002,tcp://127.0.0.1:50001,...
BTCEXP_ELECTRUMX_SERVERS=tcp://electrumx:50001

# Set number of concurrent RPC requests. Should be lower than your node's "rpcworkqueue" value.
# The default for this value is 10, aiming to be less than Bitcoin Core's default rpcworkqueue=16.
#BTCEXP_RPC_CONCURRENCY=10
BTCEXP_RPC_CONCURRENCY=32

# Disable app's in-memory RPC caching to reduce memory usage
#BTCEXP_NO_INMEMORY_RPC_CACHE=true
BTCEXP_NO_INMEMORY_RPC_CACHE=true

# Optional redis server for RPC caching
#BTCEXP_REDIS_URL=redis://localhost:6379

#BTCEXP_COOKIE_SECRET=0000aaaafffffgggggg

# Whether public-demo aspects of the site are active
#BTCEXP_DEMO=true

# Privacy mode disables:
# Exchange-rate queries, IP-geolocation queries
#BTCEXP_PRIVACY_MODE=true
BTCEXP_PRIVACY_MODE=true

# Don't request currency exchange rates
#BTCEXP_NO_RATES=true

# Password protection for site via basic auth (enter any username, only the password is checked)
#BTCEXP_BASIC_AUTH_PASSWORD=mypassword

# Enable to allow access to all RPC methods
#BTCEXP_RPC_ALLOWALL=true

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM node:12 as builder
FROM node:16 as builder
WORKDIR /workspace
COPY . .
RUN npm install

FROM node:12-alpine
FROM node:16-alpine
WORKDIR /workspace
COPY --from=builder /workspace .
CMD npm start
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:16 as builder
WORKDIR /workspace
VOLUME /workspace
EXPOSE 3002

CMD npm run start-dev
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This tool is intended to be a simple, self-hosted explorer for the Bitcoin Vault

Whatever reasons one might have for running a full node (trustlessness, technical curiosity, supporting the network, etc) it's helpful to appreciate the "fullness" of your node. With this explorer, you can not only explore the blockchain (in the traditional sense of the term "explorer"), but also explore the functional capabilities of your own node.

Live demo available at: [http://explorer.bitcoinvault.global](http://explorer.bitcoinvault.global)
Live demo available at: [https://explorer.bitcoinvault.global](https://explorer.bitcoinvault.global)

# Features

Expand All @@ -19,9 +19,8 @@ Live demo available at: [http://explorer.bitcoinvault.global](http://explorer.bi
* View transaction details, with navigation "backward" via spent transaction outputs
* View JSON content used to generate most pages
* Search by transaction ID, block hash/height, and address
* Optional transaction history for addresses by querying from ElectrumX, blockchain.com, blockchair.com, or blockcypher.com
* Optional transaction history for addresses by querying from ElectrumX
* Mempool summary, with fee, size, and age breakdowns
* RPC command browser and terminal

# Getting started

Expand All @@ -31,7 +30,7 @@ The below instructions are geared toward BTCV, but can be adapted easily to othe

1. Install and run a full, archiving [node](https://github.com/bitcoinvault/bitcoinvault/blob/master/INSTALL.md). Ensure that your bitcoin node has full transaction indexing enabled (`txindex=1`) and the RPC server enabled (`server=1`).
2. Synchronize your node with the Bitcoin Vault network.
3. "Recent" version of Node.js (8+ recommended).
3. "Recent" version of Node.js (16+ recommended).

## Instructions

Expand Down Expand Up @@ -79,6 +78,11 @@ See `./bin/cli.js --help` for the full list of CLI options.
1. `docker build -t btcv-rpc-explorer .`
2. `docker run -p 3002:3002 -it btcv-rpc-explorer`

## Local dev environment via docker-compose

1. Prepare `.env` file. If you want setup testnet environment, just copy: `.env-sample`
1. `docker-compose up -d`

# Support

Support the original developer of BTC RPC Explorer by donating BTC to:
Expand Down
19 changes: 0 additions & 19 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ var bodyParser = require('body-parser');
var session = require('cookie-session')
var csurf = require("csurf");
var config = require("./app/config.js");
var simpleGit = require('simple-git');
var utils = require("./app/utils.js");
var moment = require("moment");
var Decimal = require('decimal.js');
Expand Down Expand Up @@ -207,24 +206,6 @@ app.runOnStartup = function() {

loadMiningPoolConfigs();

if (global.sourcecodeVersion == null && fs.existsSync('.git')) {
simpleGit(".").log(["-n 1"], function(err, log) {
if (err) {
utils.logError("3fehge9ee", err, {desc:"Error accessing git repo"});

return;
}

global.sourcecodeVersion = log.all[0].hash.substring(0, 10);
global.sourcecodeDate = log.all[0].date.substring(0, "0000-00-00".length);
});
}

if (config.demoSite) {
getSourcecodeProjectMetadata();
setInterval(getSourcecodeProjectMetadata, 3600000);
}

if (!global.exchangeRates) {
utils.refreshExchangeRates();
}
Expand Down
25 changes: 11 additions & 14 deletions app/coins.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
var btc = require("./coins/btc.js");
var ltc = require("./coins/ltc.js");
const btcv = require("./coins/btcv.js");

module.exports = {
"BTCV": btc,
"BTC": btc,
"LTC": ltc,
"BTCV": btcv,

"coins":["BTCV", "BTC", "LTC"],
"currency": {
"eur": "eur",
"btc": "btc",
"btceur": "btceur",
"usd": "usd",
"usdt": "usdt",
"usdtusd": "usdtusd"
}
"coins": ["BTCV"],
"currency": {
"eur": "eur",
"btc": "btc",
"btceur": "btceur",
"usd": "usd",
"usdt": "usdt",
"usdtusd": "usdtusd"
}
};
File renamed without changes.
120 changes: 0 additions & 120 deletions app/coins/ltc.js

This file was deleted.

Loading

0 comments on commit 943df05

Please sign in to comment.