Skip to content

Bitcoin node Alpine-based docker image optimized for use in projects as RPC API

License

Notifications You must be signed in to change notification settings

xorde-labs/docker-bitcoin-node

Repository files navigation

Bitcoin Docker Node

Main goal of this project is to dockerize blockchain nodes so we could run them in pure DevOps fashion: dockerized, cluster-ready, manageable.

Docker Build

This is a dockerized built from sources bitcoin node.

Installing

Quick start

Standalone Docker

docker run -d -p 8332:8332 -p 8333:8333 --restart unless-stopped ghcr.io/xorde/bitcoin-node:latest

Store all settings and blockchain outside docker container:

docker run -d --name bitcoin-node -v /data/bitcoin:/home/bitcoin/.bitcoin -p 8332:8332 -p 8333:8333 --restart always -e "ENABLE_WALLET=1" -e "RPC_SERVER=1" ghcr.io/xorde/bitcoin-node:latest

Store all settings and blockchain outside docker container and run node on testnet:

docker run -d --name bitcoin-node -v /data1/bitcoin:/home/bitcoin/.bitcoin -p 8332:8332 -p 8333:8333 --restart always -e "TESTNET=1" -e "RPC_SERVER=1" ghcr.io/xorde/bitcoin-node:latest

Docker Compose

git clone https://github.com/xorde-nodes/bitcoin-node.git
cd bitcoin-node
cp example.env .env
# now please edit .env file to your choice, save it, and continue:
# you can skip editing .env file, and leave it unchanged 
# as it is pre-configured to run on testnet
docker compose up -d

Example .env:

WALLET_ENABLE=1
NETWORK=testnet
MAX_CONNECTIONS=50
RPC_ENABLE=1
RPC_USER=rpc-user
RPC_PASSWORD=rpc-password
RPC_ALLOW=0.0.0.0/0
PORT=8333
RPC_PORT=8332

Parameters

Available environment variables (to use with docker "-e" argument):

Configuration File

Default: ${HOME}/.bitcoin/bitcoin.conf

Please note, that startup sequence scripts will create specified config file if it doesn't exist

CONFIG_FILE=/path/bitcoin.conf

Enable Wallet

Default: false

WALLET_ENABLE=Y

Config script will automatically create default_wallet wallet, since bitcoind do not auto create wallets anymore.

Select Network

Default: mainnet

Possible values: testnet, signet, regtest

NETWORK=mainnet

Enable RPC server

Default: false

RPC_ENABLE=Y

Set specific username for RPC server

Default: bitcoinrpc

RPC_USER=user

Set specific password for RPC server

Default: automatically generated, and will be printed to console

RPC_PASSWORD=pa$$word

Set TCP port for RPC server

Default: none

RPC_PORT=8332

Advanced config options

Enable TxIndex

Default: false

TXINDEX_ENABLE=Y

For more info see this: https://bitcoin.stackexchange.com/questions/35707/what-are-pros-and-cons-of-txindex-option

Enable Socks5 Proxy

Default: empty

SOCKS5_PROXY=127.0.0.1:9050

Limit maximum network connections

Default: 125

MAX_CONNECTIONS=30

Upgrading

Simple steps to upgrade to new version of the docker image:

docker compose down \
&& docker compose pull \
&& docker compose up

About

Bitcoin node Alpine-based docker image optimized for use in projects as RPC API

Topics

Resources

License

Stars

Watchers

Forks

Packages