Skip to content

electricalgrade/btc_datum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin Knots + DATUM Gateway (Docker Compose)

This project sets up a local Bitcoin Knots node and a DATUM Gateway instance using Docker Compose. It allows easy orchestration, persistent volumes, and dynamic configuration using environment variables.


📦 Components

  • Bitcoin Knots (bitcoind)
    A Bitcoin node built from source with --disable-wallet.

  • [DATUM Gateway]
    Decentralized Mining


🚀 Getting Started

1. Clone the Repositories

git clone https://github.com/electricalgrade/bitcoin 
git clone https://github.com/OCEAN-xyz/datum_gateway

Make sure Dockerfiles are present in each directory:

  • bitcoin/contrib/docker/Dockerfile
  • datum_gateway/Dockerfile

2. Build Docker Images

Build the Bitcoin Knots image:

cd bitcoin
docker build -t bitcoinknots-custom .

Build the DATUM Gateway image:

cd ../../datum_gateway
docker build -t datum-gateway-custom .

Generate the rpc credential. refer to the rpc_readme.md


3. Setup .env

update .env file in the same directory as your docker-compose.yml:

# .env

# Host volume for Bitcoin node data
BITCOIN_DATA_PATH=/your/local/path/to/bitcoin-data
BITCOIN_CONF_PATH=/your/local/path/to/bitcoin.conf


# Host volume for DATUM Gateway config
DATUM_CONFIG_PATH=/absolute/path/to/datum_config

# RPC Connection Details
BITCOIN_RPC_HOST=bitcoind
BITCOIN_RPC_PORT=8332
BITCOIN_RPC_USER= Shold be genrated by the script
BITCOIN_RPC_PASSWORD= should be generated by the scipt

✅ Use absolute paths for volume mounts. ❗ Replace RPC credentials to match your bitcoin.conf.


4. Prepare DATUM Config

In your ${DATUM_CONFIG_PATH}/config.json, provide the correct RPC connection:

{
  "rpc_host": "bitcoind",
  "rpc_port": 8332,
  "rpc_user": "bitcoin",
  "rpc_pass": "secret123"
}

Ensure the file exists before you start the containers.


🔔 Blocknotify Setup

In your bitcoin.conf (on the host, within BITCOIN_DATA_PATH), set:

rpcuser=bitcoin
rpcpassword=secret123
blocknotify=wget -q -O /dev/null http://datum_gateway:7152/NOTIFY

5. Run with Docker Compose

docker compose up -d

🔁 Runtime Behavior

  • bitcoind exposes ports:

    • 8333: P2P
    • 8332: RPC
  • datum_gateway exposes:

    • 23334: connect you miners to this port
    • 7152: Notification endpoint

📂 Directory Structure

project-root/
├── docker-compose.yml
├── .env
├── bitcoin_data/               # Mapped volume for bitcoind
├── datum_config/
│   └── config.json             # Your DATUM Gateway config

Miner connections

You get the IP address of the host machine on which docker compose is running. The host port 23334 is connected to datum gateay docker.

In statum IP : port : 23334

🧪 Health Check

You can verify both services are running:

docker ps
docker logs datum_gateway
docker logs bitcoind

🧹 Cleanup

To stop and remove everything:

docker compose down

📄 License

MIT License — your usage may vary depending on upstream licenses of Bitcoin Knots and DATUM Gateway.

About

bitcoin knots and datum docker compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages