Mempool
In this section we'll install Mempool, a web-based Bitcoin block explorer. Mempool connects to Bitcoin Core and electrs to provide a graphical view of the blockchain and mempool using your own node.
Before continuing, ensure that Bitcoin Core, electrs and MariaDB have already been installed and are running correctly.
These are the files and directories we'll be using for Mempool:
/etc/mempool/mempool-config.json Configuration
/etc/systemd/system/mempool.service System service
/etc/apache2/sites-available/mempool.conf Apache virtual host
/usr/local/lib/mempool Git clone of source
From the Terminal program on a Mac or Linux computer, or PowerShell on Windows, connect to your Bitcoin node:
ssh nelson@debian.local
Become superuser.
su -
Create an mempool user
Create a dedicated system user for electrs:
useradd \
--system \
--home-dir /var/lib/mempool \
--create-home \
--shell /usr/sbin/nologin \
mempool
chown -R mempool:mempool /usr/local/lib/mempool
Install Node.js
This workshop uses Node.js 24, which is the version supported by the Mempool release being installed.
Install the required packages.
apt install ca-certificates curl gnupg rsync
Add the NodeSource repository.
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
Install Node.js.
apt install nodejs
Verify the installation.
node --version
npm --version
Download and verify Mempool
Change to the installation directory:
cd /usr/local/lib
Clone the Mempool Git repository:
git clone https://github.com/mempool/mempool.git
Change to the Mempool directory:
cd mempool
Choose a release
List the available release tags:
git tag
Press q to exit the list.
For this installation we will use v3.2.1.
Check the release signature
Before installing the release, check whether its Git tag is signed:
git tag --verify v3.2.1
Initially, you should see output similar to:
object 32fadb4846cc214467acfcb6b73e78ea5a63dfef
type commit
tag v3.2.1
tagger wiz <j@wiz.biz> 1744597454 +0900
v3.2.1
This release includes a hotfix for a potential crash loop if the list of
mining pools fails to get updated from our GitHub repo.
gpg: Signature made Mon 14 Apr 2025 10:24:51 AWST
gpg: using RSA key 913C5FF1F579B66CA10378DBA394E332255A6173
gpg: Can't check signature: No public key
The important lines are:
using RSA key 913C5FF1F579B66CA10378DBA394E332255A6173
gpg: Can't check signature: No public key
This tells us that the tag contains a GPG signature, but our system does not yet have the public key required to verify it.
The complete signing-key fingerprint reported by the signature is:
913C 5FF1 F579 B66C A103 78DB A394 E332 255A 6173
The final 16 hexadecimal characters form the key ID:
A394E332255A6173
Import the signing key
Retrieve the public key from the OpenPGP keyserver:
gpg --keyserver keys.openpgp.org --recv-keys A394E332255A6173
Display the fingerprint of the imported key:
gpg --fingerprint A394E332255A6173
Confirm that the fingerprint is:
913C 5FF1 F579 B66C A103 78DB A394 E332 255A 6173
The fingerprint should also be compared with an independently trusted source identifying this as the Mempool maintainer's signing key.
GitHub identifies the v3.2.1 release as having a Verified signature from wiz and identifies the signing key by the key ID:
A394E332255A6173
GitHub's Verified badge means GitHub has cryptographically verified the signature associated with the release. We will still perform the verification ourselves on the Bitcoin node.
Verify the tag
Now that the public key is available, verify the release tag again:
git tag --verify v3.2.1
This time GPG should report a good signature.
Check that the signature was made using:
913C 5FF1 F579 B66C A103 78DB A394 E332 255A 6173
Do not continue if the signature cannot be verified or the signing-key fingerprint is different.
Check out the verified release
Once the tag has been successfully verified, check out that release:
git checkout v3.2.1
Git will report that you are in a detached HEAD state. This is expected because we are checking out a specific release tag rather than working on a development branch.
The source tree is now at the verified Mempool v3.2.1 release and is ready to build.
Verify the signing-key fingerprint
Importing a public key does not by itself prove that the key belongs to the Mempool maintainer. Before trusting the key, its fingerprint should be compared with a fingerprint obtained from an independent, trusted source.
Display the complete fingerprint:
gpg --fingerprint A394E332255A6173
The signing key used for the Mempool v3.2.1 tag has the fingerprint:
913C 5FF1 F579 B66C A103 78DB A394 E332 255A 6173
GitHub identifies the v3.2.1 release as having a Verified signature from wiz using key ID:
A394E332255A6173
The key ID is the final 16 hexadecimal characters of the full fingerprint.
GitHub's Verified badge provides useful confirmation that GitHub associates this signing key with the release author, but it is preferable to compare the complete fingerprint with another authoritative source published independently by the Mempool project or the maintainer.
If such an independent source cannot be found, this limitation should be stated rather than implying that the identity of the signing key has been independently established.
Once the fingerprint has been checked, verify the signed tag locally:
git tag --verify v3.2.1
Confirm that GPG reports a Good signature and that the signature uses the expected key.
Only after successfully verifying the tag should the release be checked out:
git checkout v3.2.1
Build the backend
Change to the backend directory.
cd backend
Install the backend dependencies.
npm install
Build the backend.
npm run build
Build the frontend
Change to the frontend directory.
cd ../frontend
Install the frontend dependencies.
npm install
Build the frontend.
npm run build
Create the configuration directory
Create the configuration directory.
mkdir -p /etc/mempool
Copy the sample configuration.
cp mempool-config.sample.json mempool-config.json
Create a symbolic link to the configuration file.
ln -s /usr/local/lib/mempool/backend/mempool-config.json /etc/mempool/mempool-config.json
Configure Bitcoin Core
Generate an RPC username and password for Mempool.
Change to the Bitcoin Core rpcauth directory.
cd /usr/local/lib/bitcoin
Change to the current Bitcoin Core version directory, then to the rpcauth directory.
cd bitcoin-*/
cd share/rpcauth
Generate the RPC credentials.
./rpcauth mempool
The utility will display two values:
- An
rpcauth=line to add tobitcoin.conf. - A plain-text password.
Add the generated rpcauth= line to /etc/bitcoin.conf.
You'll use the plain-text password later when editing the Mempool configuration.
Restart Bitcoin Core.
systemctl restart bitcoind
Create the MariaDB database
apt install mariadb-server
Start the MariaDB client.
mariadb
Create the database.
CREATE DATABASE mempool;
Create the database user.
CREATE USER 'mempool'@'localhost'
IDENTIFIED BY 'your-database-password';
Grant the required privileges.
GRANT ALL PRIVILEGES ON mempool.* TO 'mempool'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Configure Mempool
Edit the configuration file.
nano /etc/mempool/mempool-config.json
Update the Bitcoin Core RPC section using:
- Username:
mempool - The plain-text password generated by
rpcauth
Update the database section using:
- Database:
mempool - Username:
mempool - Your MariaDB password
- Socket:
/run/mysqld/mysqld.sock
Configure the Electrum server.
"ELECTRUM": {
"HOST": "127.0.0.1",
"PORT": 50001,
"TLS_ENABLED": false
}
Set the Bitcoin Core debug log path.
"DEBUG_LOG_PATH": "/var/log/bitcoin/debug.log"
Disable the optional currency API.
"API_KEY": ""
Save the file.
Protect the configuration file.
chown root:mempool /etc/mempool/mempool-config.json
chmod 640 /etc/mempool/mempool-config.json
Allow Mempool to read the Bitcoin Core debug log.
Install the ACL utilities.
apt install acl
Grant read access to the log.
setfacl -m u:mempool:rx /var/log/bitcoin
setfacl -m u:mempool:r /var/log/bitcoin/debug.log
Create the system service
Create the service file.
nano /etc/systemd/system/mempool.service
Add the following.
[Unit]
Description=Mempool Backend
After=network-online.target bitcoind.service electrs.service mariadb.service
Wants=network-online.target bitcoind.service electrs.service mariadb.service
[Service]
User=mempool
Group=mempool
Type=simple
WorkingDirectory=/usr/local/lib/mempool/backend
ExecStart=/usr/bin/npm run start
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Reload the systemd configuration.
systemctl daemon-reload
Enable and start the service.
systemctl enable --now mempool
Verify that the service is running.
systemctl status mempool
Configure Apache
Enable the required Apache modules.
a2enmod proxy proxy_http proxy_wstunnel
Configure Apache to listen on port 4081.
Edit the Apache ports configuration.
nano /etc/apache2/ports.conf
Add the following line.
Listen 4081
Create the Mempool virtual host.
nano /etc/apache2/sites-available/mempool.conf
Add the following configuration.
<VirtualHost *:4081>
DocumentRoot /usr/local/lib/mempool/frontend/dist/mempool/browser/en-US
<Directory /usr/local/lib/mempool/frontend/dist/mempool/browser/en-US>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /resources/ /usr/local/lib/mempool/frontend/src/resources/
<Directory /usr/local/lib/mempool/frontend/src/resources>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{REQUEST_URI} !^/ws
RewriteCond %{REQUEST_URI} !^/resources/
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^ /index.html [L]
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /api/v1/ws ws://127.0.0.1:8999/
ProxyPassReverse /api/v1/ws ws://127.0.0.1:8999/
ProxyPass /ws ws://127.0.0.1:8999/
ProxyPassReverse /ws ws://127.0.0.1:8999/
ProxyPass /api/v1/ http://127.0.0.1:8999/api/v1/
ProxyPassReverse /api/v1/ http://127.0.0.1:8999/api/v1/
ProxyPass /api/ http://127.0.0.1:8999/api/v1/
ProxyPassReverse /api/ http://127.0.0.1:8999/api/v1/
</VirtualHost>
Enable the site.
a2ensite mempool
a2enmod rewrite
Verify the Apache configuration.
apachectl configtest
Reload Apache.
systemctl reload apache2
Test the installation
Verify that the backend is responding.
curl http://127.0.0.1:8999/api/v1/blocks/tip/height
The command should return the current block height.
Verify that Apache is serving the frontend.
curl -I http://127.0.0.1:4081/
Open a web browser and browse to:
http://debian.local:4081/
You should see the Mempool home page.
Search for a recent block, transaction and address to confirm that Bitcoin Core, electrs and MariaDB are all operating correctly.
Dashboard integration
The dashboard can link directly to the Mempool web interface, or embed it while retaining the dashboard header and navigation.
If embedding Mempool in the dashboard, the dashboard should display the Mempool application directly from the Apache virtual host rather than proxying or rewriting its API or WebSocket requests.
Upgrading Mempool
Future releases can be installed into a new version directory under /usr/local/src/mempool. Once the new version has been built and tested, update the /usr/local/lib/mempool symbolic link to point to the new version and restart the Mempool service.
Because Apache, systemd and the configuration all reference the symbolic link rather than a version-specific directory, no further configuration changes are normally required.
At this point the Mempool installation is complete.