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
2021-02-11 06:57:43 +01:00
Mempool is the fully featured visualizer, explorer, and API service running on [mempool.space ](https://mempool.space/ ), an open source project developed and operated for the benefit of the Bitcoin community, with a focus on the emerging transaction fee market to help our transition into a multi-layer ecosystem.
2020-03-29 20:58:28 +02:00
2021-12-07 15:59:33 +01:00
![mempool ](https://mempool.space/resources/screenshots/v2.3.0-dashboard.png )
2020-03-29 20:58:28 +02:00
2021-02-11 06:57:43 +01:00
## Installation Methods
Mempool can be self-hosted on a wide variety of your own hardware, ranging from a simple one-click installation on a Raspberry Pi distro, all the way to an advanced high availability cluster of powerful servers for a production instance. We support the following installation methods, ranked in order from simple to advanced:
2021-02-12 08:20:57 +01:00
1) One-click installation on: [Umbrel ](https://github.com/getumbrel/umbrel ), [RaspiBlitz ](https://github.com/rootzoll/raspiblitz ), [RoninDojo ](https://code.samourai.io/ronindojo/RoninDojo ), or [MyNode ](https://github.com/mynodebtc/mynode ).
2021-02-11 06:57:43 +01:00
2) [Docker installation on Linux using docker-compose ](https://github.com/mempool/mempool/tree/master/docker )
3) [Manual installation on Linux or FreeBSD ](https://github.com/mempool/mempool#manual-installation )
4) [Production installation on a powerful FreeBSD server ](https://github.com/mempool/mempool/tree/master/production )
5) [High Availability cluster using powerful FreeBSD servers ](https://github.com/mempool/mempool/tree/master/production#high-availability )
2022-01-13 02:18:33 +01:00
# Docker Installation
The `docker` directory contains the Dockerfiles used to build and release the official images and a `docker-compose.yml` file that is intended for end users to run a Mempool instance with minimal effort.
## bitcoind only configuration
To run an instance with the default settings, use the following command:
```bash
$ docker-compose up
```
The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. It assumes you have added RPC credentials for the `mempool` user with a `mempool` password in your `bitcoin.conf` file:
```
rpcuser=mempool
rpcpassword=mempool
```
If you want to use your current credentials, update them in the `docker-compose.yml` file:
```
api:
environment:
MEMPOOL_BACKEND: "none"
RPC_HOST: "172.27.0.1"
RPC_PORT: "8332"
RPC_USER: "mempool"
RPC_PASS: "mempool"
```
Note: the IP in the example above refers to Docker's default gateway IP address so the container can hit the `bitcoind` instance running on the host machine. If your setup is different, update it accordingly.
You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected.
2022-01-13 14:51:36 +01:00
## bitcoind+electrum configuration
2022-01-13 02:18:33 +01:00
2022-01-13 14:51:36 +01:00
In order to run with a `electrum` compatible server as the backend, in addition to the settings required for running with `bitcoind` above, you will need to make the following changes to the `docker-compose.yml` file:
2022-01-13 02:18:33 +01:00
- Under the `api` service, change the value of the `MEMPOOL_BACKEND` key from `none` to `electrum` :
```
api:
environment:
MEMPOOL_BACKEND: "none"
```
- Under the `api` service, set the `ELECTRUM_HOST` and `ELECTRUM_PORT` keys to your Docker host IP address and set `ELECTRUM_TLS_ENABLED` to `false` :
```
api:
environment:
ELECTRUM_HOST: "172.27.0.1"
ELECTRUM_PORT: "50002"
2022-01-13 14:51:36 +01:00
ELECTRUM_TLS_ENABLED: "false"
2022-01-13 02:18:33 +01:00
```
2022-01-13 14:51:36 +01:00
You can update any of the backend settings in the `mempool-config.json` file using the following environment variables to override them under the same `api` `environment` section.
2022-01-13 02:18:33 +01:00
JSON:
```
"MEMPOOL": {
"NETWORK": "mainnet",
"BACKEND": "electrum",
"HTTP_PORT": 8999,
"SPAWN_CLUSTER_PROCS": 0,
"API_URL_PREFIX": "/api/v1/",
"POLL_RATE_MS": 2000,
"CACHE_DIR": "./cache",
"CLEAR_PROTECTION_MINUTES": 20,
"RECOMMENDED_FEE_PERCENTILE": 50,
"BLOCK_WEIGHT_UNITS": 4000000,
"INITIAL_BLOCKS_AMOUNT": 8,
"MEMPOOL_BLOCKS_AMOUNT": 8,
2022-02-05 09:33:16 +01:00
"PRICE_FEED_UPDATE_INTERVAL": 600,
2022-01-13 02:18:33 +01:00
"USE_SECOND_NODE_FOR_MINFEE": false,
2022-03-17 16:07:58 +01:00
"EXTERNAL_ASSETS": ["https://raw.githubusercontent.com/mempool/mining-pools/master/pools.json"],
2022-02-18 05:51:04 +01:00
"STDOUT_LOG_MIN_PRIORITY": "info"
2022-01-13 02:18:33 +01:00
},
```
2022-02-18 05:51:04 +01:00
docker-compose overrides:
2022-01-13 02:18:33 +01:00
```
2022-01-13 06:20:14 +01:00
MEMPOOL_NETWORK: ""
2022-01-13 02:18:33 +01:00
MEMPOOL_BACKEND: ""
2022-01-13 06:20:14 +01:00
MEMPOOL_HTTP_PORT: ""
2022-01-13 02:18:33 +01:00
MEMPOOL_SPAWN_CLUSTER_PROCS: ""
MEMPOOL_API_URL_PREFIX: ""
MEMPOOL_POLL_RATE_MS: ""
2022-01-13 06:20:14 +01:00
MEMPOOL_CACHE_DIR: ""
2022-01-13 02:18:33 +01:00
MEMPOOL_CLEAR_PROTECTION_MINUTES: ""
MEMPOOL_RECOMMENDED_FEE_PERCENTILE: ""
MEMPOOL_BLOCK_WEIGHT_UNITS: ""
MEMPOOL_INITIAL_BLOCKS_AMOUNT: ""
2022-01-13 06:20:14 +01:00
MEMPOOL_MEMPOOL_BLOCKS_AMOUNT: ""
2022-01-13 02:18:33 +01:00
MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: ""
MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: ""
MEMPOOL_EXTERNAL_ASSETS: ""
2022-02-04 19:19:32 +01:00
MEMPOOL_STDOUT_LOG_MIN_PRIORITY: ""
2022-01-13 02:18:33 +01:00
```
JSON:
```
"CORE_RPC": {
"HOST": "127.0.0.1",
"PORT": 8332,
"USERNAME": "mempool",
"PASSWORD": "mempool"
},
```
docker-compose overrides:
```
2022-01-13 06:20:14 +01:00
CORE_RPC_HOST: ""
CORE_RPC_PORT: ""
CORE_RPC_USERNAME: ""
CORE_RPC_PASSWORD: ""
2022-01-13 02:18:33 +01:00
```
JSON:
```
"ELECTRUM": {
"HOST": "127.0.0.1",
"PORT": 50002,
"TLS_ENABLED": true
},
```
docker-compose overrides:
```
ELECTRUM_HOST: ""
ELECTRUM_PORT: ""
ELECTRUM_TLS: ""
```
JSON:
```
"ESPLORA": {
"REST_API_URL": "http://127.0.0.1:3000"
},
```
docker-compose overrides:
```
ESPLORA_REST_API_URL: ""
```
JSON:
```
"SECOND_CORE_RPC": {
"HOST": "127.0.0.1",
"PORT": 8332,
"USERNAME": "mempool",
"PASSWORD": "mempool"
},
```
docker-compose overrides:
```
2022-01-13 09:08:07 +01:00
SECOND_CORE_RPC_HOST: ""
SECOND_CORE_RPC_PORT: ""
SECOND_CORE_RPC_USERNAME: ""
SECOND_CORE_RPC_PASSWORD: ""
2022-01-13 02:18:33 +01:00
```
JSON:
```
"DATABASE": {
"ENABLED": true,
"HOST": "127.0.0.1",
"PORT": 3306,
"DATABASE": "mempool",
"USERNAME": "mempool",
"PASSWORD": "mempool"
},
```
docker-compose overrides:
```
2022-01-13 06:20:14 +01:00
DATABASE_ENABLED: ""
DATABASE_HOST: ""
DATABASE_PORT: ""
DATABASE_DATABASE: ""
DATABASE_USERAME: ""
DATABASE_PASSWORD: ""
2022-01-13 02:18:33 +01:00
```
JSON:
```
"SYSLOG": {
"ENABLED": true,
"HOST": "127.0.0.1",
"PORT": 514,
"MIN_PRIORITY": "info",
"FACILITY": "local7"
},
```
docker-compose overrides:
```
SYSLOG_ENABLED: ""
SYSLOG_HOST: ""
SYSLOG_PORT: ""
SYSLOG_MIN_PRIORITY: ""
SYSLOG_FACILITY: ""
```
JSON:
```
"STATISTICS": {
"ENABLED": true,
"TX_PER_SECOND_SAMPLE_PERIOD": 150
},
```
docker-compose overrides:
```
STATISTICS_ENABLED: ""
STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD: ""
```
JSON:
```
"BISQ": {
"ENABLED": false,
"DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db"
}
```
docker-compose overrides:
```
BISQ_ENABLED: ""
BISQ_DATA_PATH: ""
```
2022-02-04 08:21:19 +01:00
JSON:
```
"SOCKS5PROXY": {
"ENABLED": false,
"HOST": "127.0.0.1",
"PORT": "9050",
"USERNAME": "",
"PASSWORD": ""
}
```
docker-compose overrides:
```
SOCKS5PROXY_ENABLED: ""
SOCKS5PROXY_HOST: ""
SOCKS5PROXY_PORT: ""
SOCKS5PROXY_USERNAME: ""
SOCKS5PROXY_PASSWORD: ""
```
2022-01-13 02:18:33 +01:00
2022-02-05 07:48:16 +01:00
JSON:
```
2022-02-05 16:58:35 +01:00
"PRICE_DATA_SERVER": {
2022-02-05 07:48:16 +01:00
"TOR_URL": "http://wizpriceje6q5tdrxkyiazsgu7irquiqjy2dptezqhrtu7l2qelqktid.onion/getAllMarketPrices",
"CLEARNET_URL": "https://price.bisq.wiz.biz/getAllMarketPrices"
}
```
docker-compose overrides:
```
2022-02-05 16:58:35 +01:00
PRICE_DATA_SERVER_TOR_URL: ""
PRICE_DATA_SERVER_CLEARNET_URL: ""
2022-02-05 07:48:16 +01:00
```
2022-01-13 02:18:33 +01:00
2021-02-11 06:57:43 +01:00
# Manual Installation
The following instructions are for a manual installation on Linux or FreeBSD. The file and directory paths may need to be changed to match your OS.
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
## Dependencies
2019-07-22 10:46:36 +02:00
2021-12-07 15:59:33 +01:00
* [Bitcoin ](https://github.com/bitcoin/bitcoin )
* [Electrum ](https://github.com/romanz/electrs )
* [NodeJS ](https://github.com/nodejs/node )
* [MariaDB ](https://github.com/mariadb/server )
* [Nginx ](https://github.com/nginx/nginx )
2019-07-22 10:46:36 +02:00
2021-01-11 15:07:16 +01:00
## Mempool
Clone the mempool repo, and checkout the latest release tag:
2020-02-25 18:34:37 +01:00
```bash
2020-10-13 00:51:39 +02:00
git clone https://github.com/mempool/mempool
cd mempool
2020-10-20 04:54:04 +02:00
latestrelease=$(curl -s https://api.github.com/repos/mempool/mempool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
2020-10-13 00:51:39 +02:00
git checkout $latestrelease
2020-02-25 18:34:37 +01:00
```
2019-09-08 19:37:07 +02:00
## Bitcoin Core (bitcoind)
2019-07-22 10:46:36 +02:00
2021-01-11 15:07:16 +01:00
Enable RPC and txindex in `bitcoin.conf` :
2019-09-08 19:37:07 +02:00
```bash
rpcuser=mempool
2021-12-07 15:59:33 +01:00
rpcpassword=mempool
2019-09-08 19:37:07 +02:00
txindex=1
2019-07-22 10:46:36 +02:00
```
2019-09-08 19:37:07 +02:00
## MySQL
2019-07-22 10:46:36 +02:00
2021-01-11 15:07:16 +01:00
Install MariaDB from OS package manager:
2019-09-08 19:37:07 +02:00
```bash
# Linux
apt-get install mariadb-server mariadb-client
# macOS
brew install mariadb
2021-12-07 15:59:33 +01:00
mysql.server start
2019-07-22 10:46:36 +02:00
```
Create database and grant privileges:
2019-09-08 19:37:07 +02:00
```bash
MariaDB [(none)]> drop database mempool;
Query OK, 0 rows affected (0.00 sec)
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
MariaDB [(none)]> create database mempool;
Query OK, 1 row affected (0.00 sec)
2019-07-22 10:46:36 +02:00
2021-01-12 12:49:18 +01:00
MariaDB [(none)]> grant all privileges on mempool.* to 'mempool'@'%' identified by 'mempool';
2019-09-08 19:37:07 +02:00
Query OK, 0 rows affected (0.00 sec)
2019-07-22 10:46:36 +02:00
```
2021-01-11 15:07:16 +01:00
## Mempool Backend
Install mempool dependencies from npm and build the backend:
```bash
# backend
2021-03-18 06:46:16 +01:00
cd backend
2021-12-07 15:59:33 +01:00
npm install --prod
2021-01-11 15:07:16 +01:00
npm run build
```
In the `backend` folder, make a copy of the sample config and modify it to fit your settings.
2019-07-22 10:46:36 +02:00
2021-01-11 15:07:16 +01:00
```bash
cp mempool-config.sample.json mempool-config.json
```
2019-09-08 19:37:07 +02:00
2021-01-11 15:07:16 +01:00
Edit `mempool-config.json` to add 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
2021-01-11 15:07:16 +01:00
npm run start
2019-09-08 19:37:07 +02:00
```
2021-01-11 15:07:16 +01: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
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
```
2021-01-11 15:07:16 +01:00
## Mempool Frontend
2019-12-01 03:50:14 +01:00
2021-01-11 15:07:16 +01:00
Install mempool dependencies from npm and build the frontend static HTML/CSS/JS:
2019-12-01 03:50:14 +01:00
2021-01-11 15:07:16 +01:00
```bash
# frontend
cd frontend
2021-12-07 15:59:33 +01:00
npm install --prod
2021-01-11 15:07:16 +01:00
npm run build
2019-07-22 10:46:36 +02:00
```
2019-08-23 02:51:12 +02:00
2021-01-11 15:07:16 +01:00
Install the output into nginx webroot folder:
2019-07-22 10:46:36 +02:00
2019-09-08 19:37:07 +02:00
```bash
2022-01-13 02:18:33 +01:00
sudo rsync -av --delete dist/ /var/www/
2019-07-22 10:46:36 +02:00
```
2021-01-11 15:07:16 +01:00
## nginx + certbot
Install the supplied nginx.conf and nginx-mempool.conf in /etc/nginx
2020-06-22 17:10:49 +02:00
```bash
2021-01-11 15:07:16 +01:00
# install nginx and certbot
2021-11-02 00:57:20 +01:00
apt-get install -y nginx python3-certbot-nginx
2021-01-11 15:07:16 +01:00
# install the mempool configuration for nginx
2021-07-18 22:54:47 +02:00
cp nginx.conf nginx-mempool.conf /etc/nginx/
2020-06-22 17:10:49 +02:00
2021-01-11 15:07:16 +01:00
# replace example.com with your domain name
certbot --nginx -d example.com
```
2019-08-23 02:51:12 +02:00
If everything went okay you should see the beautiful mempool :grin:
2019-07-22 10:46:36 +02:00
2019-08-23 02:51:12 +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.