2022-02-08 06:24:05 +01:00
# The Mempool Open Source Projectâ„¢ [![mempool](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/ry4br7/master&style=flat-square)](https://dashboard.cypress.io/projects/ry4br7/runs)
2019-08-23 02:51:12 +02:00
2022-05-02 20:15:28 +02:00
Mempool is the fully-featured mempool visualizer, explorer, and API service running at [mempool.space ](https://mempool.space/ ).
2020-03-29 20:58:28 +02:00
2022-05-07 23:20:58 +02:00
It is an open-source project developed and operated for the benefit of the Bitcoin community, with a focus on the emerging transaction fee market that is evolving Bitcoin into a multi-layer ecosystem.
2022-05-02 20:04:21 +02:00
![mempool ](https://mempool.space/resources/screenshots/v2.4.0-dashboard.png )
2020-03-29 20:58:28 +02:00
2022-05-03 19:04:02 +02:00
# Installation Methods
2021-02-11 06:57:43 +01:00
2022-05-02 20:35:03 +02:00
Mempool can be self-hosted on a wide variety of your own hardware, ranging from a simple one-click installation on a Raspberry Pi full-node distro all the way to a robust production instance on a powerful FreeBSD server.
2021-02-11 06:57:43 +01:00
2022-05-02 20:35:03 +02:00
We support the following installation methods, ranked in order from simple to advanced:
2021-02-11 06:57:43 +01:00
2022-05-02 20:35:03 +02:00
1) [One-click installation on full-node distros ](#one-click-installation )
2022-05-03 19:04:02 +02:00
2) [Docker installation on Linux using docker-compose ](./docker )
2022-05-02 20:35:03 +02:00
3) [Manual installation on Linux or FreeBSD ](#manual-installation )
2022-05-03 19:04:02 +02:00
4) [Production installation on a powerful FreeBSD server ](./production )
2022-01-13 02:18:33 +01:00
2022-05-03 06:01:20 +02:00
This doc offers install notes on the one-click method and manual install method. Follow the links above for install notes on Docker and production installations.
2022-01-13 02:18:33 +01:00
2022-05-02 20:35:03 +02:00
< a id = "one-click-installation" > < / a >
2022-05-03 19:04:02 +02:00
## One-Click Installation
2022-01-13 02:18:33 +01:00
2022-05-02 20:35:03 +02:00
Mempool can be conveniently installed on the following full-node distros:
- [Umbrel ](https://github.com/getumbrel/umbrel )
- [RaspiBlitz ](https://github.com/rootzoll/raspiblitz )
- [RoninDojo ](https://code.samourai.io/ronindojo/RoninDojo )
- [myNode ](https://github.com/mynodebtc/mynode )
- [Start9 ](https://github.com/Start9Labs/embassy-os )
2022-01-13 02:18:33 +01:00
2022-05-03 06:01:20 +02:00
< a id = "manual-installation" > < / a >
2022-05-03 19:04:02 +02:00
## Manual Installation
2022-01-13 02:18:33 +01:00
2022-05-03 06:01:20 +02:00
The following instructions are for a manual installation on Linux or FreeBSD. You may need to change file and directory paths to match your OS.
2022-01-13 02:18:33 +01:00
2022-05-04 17:59:23 +02:00
You will need [Bitcoin Core ](https://github.com/bitcoin/bitcoin ), [Electrum Server ](https://github.com/romanz/electrs ), [Node.js ](https://github.com/nodejs/node ), [MariaDB ](https://github.com/mariadb/server ), and [Nginx ](https://github.com/nginx/nginx ). Below, we walk through how to configure each of these.
2022-01-13 02:18:33 +01:00
2022-05-03 19:04:02 +02:00
### 1. Get Latest Mempool Release
2022-01-13 02:18:33 +01:00
2022-05-03 06:52:16 +02:00
Clone the Mempool repo, and checkout the latest release tag:
2022-01-13 02:18:33 +01:00
2020-02-25 18:34:37 +01:00
```bash
2022-05-09 07:13:54 +02:00
git clone https://github.com/mempool/mempool
cd mempool
latestrelease=$(curl -s https://api.github.com/repos/mempool/mempool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
git checkout $latestrelease
2022-01-13 02:18:33 +01:00
```
2022-05-03 19:04:02 +02:00
### 2. Configure Bitcoin Core
2022-01-13 02:18:33 +01:00
2021-01-11 15:07:16 +01:00
Enable RPC and txindex in `bitcoin.conf` :
2022-01-13 02:18:33 +01:00
2019-09-08 19:37:07 +02:00
```bash
2022-05-03 19:04:02 +02:00
rpcuser=mempool
rpcpassword=mempool
txindex=1
2022-01-13 02:18:33 +01:00
```
2022-05-03 19:04:02 +02:00
### 3. Get & Configure MySQL
2022-02-04 08:21:19 +01:00
2022-05-03 06:01:20 +02:00
Install MariaDB from your OS package manager:
2022-01-13 02:18:33 +01:00
2019-09-08 19:37:07 +02:00
```bash
2022-05-03 19:04:02 +02:00
# Debian, Ubuntu, etc.
2022-05-09 07:13:54 +02:00
apt-get install mariadb-server mariadb-client
2022-02-05 07:48:16 +01:00
2022-05-03 19:04:02 +02:00
# macOS
2022-05-09 07:13:54 +02:00
brew install mariadb
mysql.server start
2022-02-05 07:48:16 +01:00
```
2019-07-22 10:46:36 +02:00
2022-05-03 06:52:16 +02:00
Create a database and grant privileges:
2019-07-22 10:46:36 +02:00
2020-02-25 18:34:37 +01:00
```bash
2022-05-03 19:04:02 +02:00
MariaDB [(none)]> drop database mempool;
Query OK, 0 rows affected (0.00 sec)
2020-02-25 18:34:37 +01:00
2022-05-03 19:04:02 +02:00
MariaDB [(none)]> create database mempool;
Query OK, 1 row affected (0.00 sec)
2019-07-22 10:46:36 +02:00
2022-05-03 19:04:02 +02:00
MariaDB [(none)]> grant all privileges on mempool.* to 'mempool'@'%' identified by 'mempool';
Query OK, 0 rows affected (0.00 sec)
2019-07-22 10:46:36 +02:00
```
2022-05-03 19:04:02 +02:00
### 4. Build Mempool Backend
2019-07-22 10:46:36 +02:00
2022-05-03 19:04:02 +02:00
Install Mempool dependencies with npm and build the backend:
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
```bash
2022-05-09 07:13:54 +02:00
cd backend
npm install --prod
npm run build
2019-07-22 10:46:36 +02:00
```
2022-05-03 06:52:16 +02:00
In the `backend` folder, make a copy of the sample config:
2021-01-11 15:07:16 +01:00
```bash
2022-05-09 07:13:54 +02:00
cp mempool-config.sample.json mempool-config.json
2021-01-11 15:07:16 +01:00
```
2022-05-03 06:01:20 +02:00
Edit `mempool-config.json` with your Bitcoin Core node RPC credentials:
2019-09-08 19:37:07 +02:00
```bash
2021-01-11 15:07:16 +01:00
{
"MEMPOOL": {
"NETWORK": "mainnet",
"BACKEND": "electrum",
2021-12-07 15:59:33 +01:00
"HTTP_PORT": 8999
2021-01-11 15:07:16 +01:00
},
"CORE_RPC": {
2021-12-07 15:59:33 +01:00
"HOST": "127.0.0.1",
"PORT": 8332,
2021-01-11 15:07:16 +01:00
"USERNAME": "mempool",
2021-12-07 15:59:33 +01:00
"PASSWORD": "mempool"
2021-01-11 15:07:16 +01:00
},
"ELECTRUM": {
"HOST": "127.0.0.1",
"PORT": 50002,
2021-12-07 15:59:33 +01:00
"TLS_ENABLED": true
2021-01-11 15:07:16 +01:00
},
"DATABASE": {
"ENABLED": true,
2021-01-30 12:43:58 +01:00
"HOST": "127.0.0.1",
2021-01-11 15:07:16 +01:00
"PORT": 3306,
"USERNAME": "mempool",
"PASSWORD": "mempool",
"DATABASE": "mempool"
}
}
2019-07-22 10:46:36 +02:00
```
2021-01-11 15:07:16 +01:00
Start the backend:
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
```bash
2022-05-09 07:13:54 +02:00
npm run start
2019-09-08 19:37:07 +02:00
```
2021-01-11 15:07:16 +01:00
2022-05-03 06:01:20 +02:00
When it's running, you should see output like this:
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
```bash
2022-05-03 19:04:02 +02:00
Mempool updated in 0.189 seconds
Updating mempool
Mempool updated in 0.096 seconds
Updating mempool
Mempool updated in 0.099 seconds
Updating mempool
Calculated fee for transaction 1 / 10
Calculated fee for transaction 2 / 10
Calculated fee for transaction 3 / 10
Calculated fee for transaction 4 / 10
Calculated fee for transaction 5 / 10
Calculated fee for transaction 6 / 10
Calculated fee for transaction 7 / 10
Calculated fee for transaction 8 / 10
Calculated fee for transaction 9 / 10
Calculated fee for transaction 10 / 10
Mempool updated in 0.243 seconds
Updating mempool
2019-09-08 19:37:07 +02:00
```
2022-05-03 19:04:02 +02:00
### 5. Build Mempool Frontend
2019-12-01 03:50:14 +01:00
2022-05-03 06:01:20 +02:00
Install the Mempool dependencies with npm and build the frontend:
2019-12-01 03:50:14 +01:00
2021-01-11 15:07:16 +01:00
```bash
2022-05-09 07:13:54 +02:00
cd frontend
npm install --prod
npm run build
2019-07-22 10:46:36 +02:00
```
2019-08-23 02:51:12 +02:00
2022-05-03 06:01:20 +02:00
Install the output into the nginx webroot folder:
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
```bash
2022-05-09 07:13:54 +02:00
sudo rsync -av --delete dist/ /var/www/
2019-07-22 10:46:36 +02:00
```
2022-05-03 19:04:02 +02:00
### 6. `nginx` + `certbot`
2021-01-11 15:07:16 +01:00
2022-05-03 06:01:20 +02:00
Install the supplied `nginx.conf` and `nginx-mempool.conf` in `/etc/nginx` :
2020-06-22 17:10:49 +02:00
```bash
2022-05-03 19:04:02 +02:00
# install nginx and certbot
2022-05-09 07:13:54 +02:00
apt-get install -y nginx python3-certbot-nginx
2020-06-22 17:10:49 +02:00
2022-05-03 19:04:02 +02:00
# install the mempool configuration for nginx
2022-05-09 07:13:54 +02:00
cp nginx.conf nginx-mempool.conf /etc/nginx/
2021-01-11 15:07:16 +01:00
2022-05-03 19:04:02 +02:00
# replace example.com with your domain name
2022-05-09 07:13:54 +02:00
certbot --nginx -d example.com
2021-01-11 15:07:16 +01:00
```
2019-08-23 02:51:12 +02:00
2022-05-03 06:01:20 +02:00
If everything went well, you should see the beautiful mempool :grin:
2019-07-22 10:46:36 +02:00
2022-05-03 06:01:20 +02:00
If you get stuck on "loading blocks", this means the websocket can't connect. Check your nginx proxy setup, firewalls, etc. and open an issue if you need help.