This repository contains a modular, dockerized development environment for Bitcoin-related services. The environment is designed to be easily deployable, configurable, and extensible.
The environment follows a modular architecture where each service is:
- Independently containerized
- Built from source
- Configurable through environment variables
- Data-persistent
The environment currently includes:
-
Bitcoin Core Node (v31.0)
- Full Bitcoin node with RPC and P2P ports exposed
- ZMQ publishers for rawblock, rawtx, and hashblock
- Built without wallet support; IPC enabled
- Includes transaction indexing and server mode enabled
- Configurable RPC authentication
-
Electrum Server (v0.11.1)
- Built on top of romanz/electrs
- Provides Electrum protocol support
- Connects to a remote Bitcoin node via
BITCOIN_RPC_URL, authenticating withRPC_USER/RPC_PASS
-
Ordinals Server (v0.23.1)
- Built on top of ord
- Provides Ordinals protocol support
- Includes indexing for addresses, runes, sats, and transactions
-
Mempool (v3.3.1)
- Block explorer and mempool visualizer from https://github.com/mempool/mempool
- Built from source: API (Node.js + Rust GBT), web frontend (Angular + nginx), MariaDB
- Configured with
MEMPOOL_BACKEND=esplora, pointing at the existing electrs container's HTTP REST API (enabled via--http-addron port 3000) - Connects to Bitcoin Core RPC for
CORE_RPC_*queries
To add a new service to this environment:
- Create a new
Dockerfile.<service-name>in the root directory - Create a new
docker-compose-<service-name>.ymlfile - Add a new directory for service data persistence
- Update this README with the new service information
- Add any new environment variables to
.env.example
# docker-compose-<service-name>.yml
services:
<service-name>:
build:
context: .
dockerfile: Dockerfile.<service-name>
container_name: <service-name>
volumes:
- ./<service-name>:/path/to/data
ports:
- ${SERVICE_PORT}:<internal_port>
environment:
- VAR1=${VAR1}
- VAR2=${VAR2}
command:
[
"./<service-name>"
]- Docker
- Docker Compose
- Git
Create a .env file in the root directory, copying .env.example with the following variables:
# Bitcoin Core
RPC_PORT=8332
P2P_PORT=8333
ZMQ_RAWBLOCK_PORT=28332
ZMQ_RAWTX_PORT=28333
ZMQ_HASHBLOCK_PORT=28334
RPC_AUTH=<your_rpc_auth_string>
RPC_USER=<your_rpc_username>
RPC_PASS=<your_rpc_password>
# Electrum Server
ELECTRS_PORT=50001
ESPLORA_PORT=3000
BITCOIN_RPC_URL=<host:port of remote bitcoin node, e.g. node.example.com:8332>
# Ordinals Server
ORDINALS_PORT=80
# Mempool
ESPLORA_REST_API_URL=http://host.docker.internal:3000
CORE_RPC_HOST=host.docker.internal
CORE_RPC_PORT=8332
MEMPOOL_WEB_PORT=8081
MEMPOOL_DB_PASSWORD=<mempool db user password>
MEMPOOL_DB_ROOT_PASSWORD=<mempool db root password>
# Add new service variables here.
├── bitcoin/ # Bitcoin Core data directory
├── electrs/ # Electrum server data directory
├── ordinals/ # Ordinals server data directory
├── mempool/ # Mempool data (cache + mariadb)
├── Dockerfile.bitcoin # Bitcoin Core Dockerfile
├── Dockerfile.electrs # Electrum server Dockerfile
├── Dockerfile.ordinals # Ordinals server Dockerfile
├── Dockerfile.mempool-backend # Mempool API Dockerfile
├── Dockerfile.mempool-frontend # Mempool web Dockerfile
├── docker-compose-bitcoin.yml
├── docker-compose-electrs.yml
├── docker-compose-ordinals.yml
└── docker-compose-mempool.yml
Each service can be started independently:
# Start Bitcoin Node
docker compose -f docker-compose-bitcoin.yml up -d
# Start Electrum Server
docker compose -f docker-compose-electrs.yml up -d
# Start Ordinals Server
docker compose -f docker-compose-ordinals.yml up -d
# Start Mempool (electrs must be running with --http-addr enabled)
docker compose -f docker-compose-mempool.yml up -d
# Start a new service
docker compose -f docker-compose-<service-name>.yml up -dEach service exposes its own ports:
- Bitcoin Core RPC: 8332
- Bitcoin Core P2P: 8333
- Bitcoin Core ZMQ rawblock: 28332
- Bitcoin Core ZMQ rawtx: 28333
- Bitcoin Core ZMQ hashblock: 28334
- Electrum Server: 50001
- Electrs HTTP REST (electrum): 3000
- Ordinals Server: 80
- Mempool web: 8081
- New Service:
All services maintain data persistence in their respective directories:
- Bitcoin Core data:
./bitcoin - Electrum server data:
./electrs - Ordinals server data:
./ordinals - Mempool data:
./mempool(./mempool/datafor backend cache,./mempool/mysqlfor mariadb) - New Service data:
./<service-name>
Each service is built from source using their respective Dockerfiles. The build process is service-specific:
- Bitcoin Core: Built from source using CMake
- Electrum Server: Built from source using Cargo (Rust)
- Ordinals Server: Built from source using Cargo (Rust)
- Mempool: Built from source — API via Node.js + Rust (rust-gbt napi-rs addon), frontend via Angular, served by nginx
- New Service:
- Fork the repository
- Create a new branch for your service
- Add your service following the template structure
- Update the README with your service information
- Submit a pull request
- RPC interfaces should be properly secured in production
- Use strong authentication credentials
- Consider using reverse proxies for public-facing services
This project uses components with their respective licenses:
- Bitcoin Core: MIT
- Electrum Server: MIT
- Ordinals: MIT
- Mempool: AGPL-3.0
- New Service: