2.3 Blockchain explorer: BTC RPC Explorer
Requirements
Others
Introduction
Preparations
Install Node + NPM
With user
admin
, check if you have already installed Node
Example of expected output:
Check if you have already installed NPM
Example of expected output:
-> If the "node -v"
output is >=18
, you can move to the next section.
Update and upgrade your OS
Install the next dependency package. Press "y" and
enter
or directlyenter
when the prompt asks you
Reverse proxy & Firewall
Enable the Nginx reverse proxy to route external encrypted HTTPS traffic internally to the BTC RPC Explorer. The error_page 497
directive instructs browsers that send HTTP requests to resend them over HTTPS.
With user
admin
, create the reverse proxy configuration
Paste the complete following configuration. Save and exit
Create the symbolic link that points to the directory
sites-enabled
Test Nginx configuration
Expected output:
Reload the Nginx configuration to apply changes
Configure the firewall to allow incoming HTTPS requests
Installation
Create the btcrpcexplorer user & group
For improved security, we will create a new user btcrpcexplorer
that will run the block explorer. Using a dedicated user limits potential damage in case there's a security vulnerability in the code. An attacker could not do much within this user's permission settings. We will install BTC RPC Explorer in the home directory since it doesn't need too much space.
Create the
btcrpcexplorer
user and group
Add
btcrpcexplorer
user to the "bitcoin" group, allowing to thebtcrpcexplorer
user read the bitcoind.cookie
file
Change to the new
btcrpcexplorer
user
Set a temporary version environment variable to the installation
Import the GPG key of the developer
Download the source code directly from GitHub and go to the
btc-rpc-explorer
folder
Verify the release
Example of expected output:
Install all dependencies using NPM
Installation can take some time, be patient. There might be a lot of confusing output, but if you see something similar to the following, the installation was successful
Example of expected output:
Check the correct installation by requesting the version
Example of expected output:
Configuration
Copy the configuration template
Edit the
.env
file.
Activate any setting by removing the #
at the beginning of the line or editing directly
Instruct the BTC RPC Explorer to connect to the local Bitcoin Core
To get address balances, either an Electrum server or an external service is necessary. Your local Electrum server can provide address transaction lists, balances, and more
Uncomment this line
Save and exit
Exit the
btcrpcexplorer
user session to return to theadmin
user session
Create systemd service
Now we'll make sure our blockchain explorer starts as a service on the PC so that it's always running.
As user
admin
, create the service file
Paste the following configuration. Save and exit
Enable autoboot (optional)
Prepare "btcrpcexplorer" monitoring by the systemd journal and check the logging output. You can exit monitoring at any time with
Ctrl-C
Run
Start the service
Now point your browser to the secure access point provided by the NGINX web proxy, for example,
"https://minibolt.local:4000"
(or your node IP address) like"https://192.168.x.xxx:4000"
. You should see the home page of BTC RPC Explorer
Your browser will display a warning because we use a self-signed SSL certificate. We can do nothing about that because we would need a proper domain name (e.g. https://yournode.com) to get an official certificate that browsers recognize. Click on "Advanced" and proceed to the Block Explorer web interface
If you see a lot of errors on the MiniBolt command line, then Bitcoin Core might still be indexing the blockchain. You need to wait until reindexing is done before using the BTC RPC Explorer
Ensure the service is working and listening at the default
3002
port and the HTTPS4000
port
Expected output:
Congrats! Now you have a Blockchain Explorer: BTC RPC Explorer running to check the Bitcoin network information directly from your node
Extras (optional)
Privacy
You can decide whether you want to optimize for more information or more privacy.
With user
admin
user, edit the.env
configuration file
More privacy mode, no external queries
More information mode, including Bitcoin exchange rates
Save and exit
Security
You can add password protection to the web interface. Simply add your password [D]
for the following option, for which the browser will then prompt you. You can enter any user name; only the password is checked
With user
admin
user, edit the.env
configuration file
Replace the next line. Save and exit
Theme
Decide whether you prefer a light
or dark
theme by default
With user
admin
user, edit the.env
configuration file
Uncomment and replace this line with your selection. Left uncommented to dark (default is dark). Save and exit
Slow device mode (resource-intensive features are disabled)
Extend the timeout period and enable slow device mode due to the limited resources
With user
admin
user, edit the.env
configuration file
Uncomment and change the value of this line
Comment this line if it is uncommented (default value is true). Save and exit
Sharing your explorer
With user
admin
user, edit the.env
configuration file
Uncomment this line
-> Remember to give them the password [D]
if you added password protection in the reference step
With DEMO mode enabled, the user will see the next message:
"Sorry, that RPC command is blacklisted. If this is your server, you may allow this command by removing it from the 'rpcBlacklist' setting in config.js."
Remote access over Tor
Do you want to access your personal blockchain explorer remotely? You can easily do so by adding a Tor hidden service on the MiniBolt and accessing the BTC RPC Explorer with the Tor browser from any device.
With the user
admin
, edit thetorrc
file
Add the following lines in the "location hidden services" section, below "
## This section is just for location-hidden services ##
" in the torrc file. Save and exit
Reload the Tor configuration
Get your Onion address
Example of expected output:
Upgrade
With
admin
user, stop the service
Change to the
btcrpcexplorer
user
Set a temporary version environment variable to the installation
Go to the
btc-rpc-explorer
folder
Fetch the latest GitHub repository information
Display the release tags (use the latest in this example)
Install dependencies
Come back to the
admin
user
Start the service again
Uninstall
Uninstall service
With the user
admin
, stop btcrpcexplorer
Disable autoboot (if enabled)
Delete the service
Delete user & group
Delete the
btcrpcexplorer
user. Do not worry about theuserdel: btcrpcexplorer mail spool (/var/mail/btcrpcexplorer) not found
Uninstall Tor hidden service
Ensure that you are logged in with the user
admin
and delete or comment on the following lines in the "location hidden services" section, below "## This section is just for location-hidden services ##
" in the torrc file. Save and exit
Reload the tor to apply changes
Uninstall reverse proxy & FW configuration
Ensure you are logged in with the user
admin
, delete the reverse proxy config file
Delete the simbolic link
Test Nginx configuration
Expected output:
Reload the Nginx configuration to apply changes
Display the UFW firewall rules, and note the numbers of the rules for BTC RPC Explorer (e.g. "Y" below)
Expected output:
Delete the rule with the correct number and confirm with "
yes
"
Port reference
Last updated