Setup BTC RPC Explorer

Install BTC RPC Explorer on your Bitcoin node.

BTC RPC Explorer is essentially a web GUI for the Bitcoin JSON-RPC API. It is highly useful for node monitoring, management, and as a blockchain explorer.

Before you start make sure you've installed Node.js.

Install BTC RPC Explorer

Get the latest stable release

Clone the repo:

cd ~
git clone https://github.com/janoside/btc-rpc-explorer.git
cd btc-rpc-explorer/

Show the latest version tags:

git describe --tags `git rev-list --tags --max-count=20`

Switch to the latest stable version:

git checkout -f <version-tag>

Install

Update local dependencies within version ranges specified in package.json:

npm update

Install:

npm install
npm install zeromq@latest
npm install nan@latest

Then try installing again:

npm install

Configure

Create the config file:

touch .env

Add the following:

BTCEXP_HOST=192.168.1.52
BTCEXP_PORT=3002
BTCEXP_BITCOIND_HOST=127.0.0.1
BTCEXP_BITCOIND_PORT=8332
BTCEXP_BITCOIND_COOKIE=/home/your_user/.bitcoin/.cookie
BTCEXP_BITCOIND_RPC_TIMEOUT=5000
BTCEXP_PRIVACY_MODE=true
BTCEXP_BASIC_AUTH_PASSWORD=your_secure_password
BTCEXP_ADDRESS_API=electrum
BTCEXP_ELECTRUM_SERVERS=tcp://127.0.0.1:50001
  • BTCEXP_HOST: Replace with your Pi's local IP to make BTC RPC Explorer accessible on your LAN.

  • BTCEXP_BITCOIND_COOKIE: Update the path with your own user.

  • BTCEXP_BASIC_AUTH_PASSWORD: Set a strong password to secure access.

With this setup, BTC RPC Explorer is accessible from any machine on our LAN, is password-protected, and also connected to our Electrum server.

Configure systemd service

Create the service file:

sudo cat /etc/systemd/system/btc-rpc-explorer.service

Add the following:

[Unit]
Description=BTC-RPC-Explorer
Requires=electrs.service
After=electrs.service
[Service]
WorkingDirectory=/home/your_user/btc-rpc-explorer
ExecStart=npm run start
User=your_user
Group=your_user
Type=simple
Restart=on-failure
TimeoutSec=120
RestartSec=30
[Install]
WantedBy=multi-user.target

Line 6,8 and 9 make sure to replace your_user by your own user.

See .env-sample to discover more options.

Finally, reload systemd:

sudo systemctl daemon-reload

Startup

Configure BTC-RPC Explorer to automatically start at boot:

sudo systemctl enable btc-rpc-explorer.service

Start BTC-RPC Explorer:

sudo systemctl start btc-rpc-explorer.service

You'll see a popup asking you to enter a username and password. The username doesn't matter; just use the password you set up in the .env file.

Issue with Node Details page

The page /node-details of BTC RPC Explorer throws an error. I suck at coding but I was able to fix it with ChatGPT.

Edit the below file:

vim views/node-details.pug

At line 29, replace this block of code:

if (getblockchaininfo.warnings && getblockchaininfo.warnings.trim().length > 0)
	+contentSection("Active Warnings")
		if (getblockchaininfo.warnings && getblockchaininfo.warnings.trim().length > 0)
			span.text-danger #{getblockchaininfo.warnings}
		else
			span.text-success None

By this one:

if (getblockchaininfo.warnings)
	+contentSection("Active Warnings")
		if (getblockchaininfo.warnings)
			span.text-danger #{getblockchaininfo.warnings}
		else
			span.text-success None

(Basically I removed getblockchaininfo.warnings.trim().length > 0 in both if statements).

Make sure to restart BTC RPC Explorer and the page should be working:

sudo systemctl restart btc-rpc-explorer.service

Tor

I personally wouldn't risk exposing this app to the outside world. It has some bugs, is vulnerable to brute-force attacks, and stores the password in a plain text .env file.

If I ever do, I will ensure that the features enabling manual Bitcoin JSON-RPC API calls are disabled.

Last updated

Was this helpful?