Sign inSign up

nexbitio/bitcoind

By nexbitio

•Updated almost 7 years ago

Full Bitcoin Node in Docker. Can use for crypto currency exchange, wallet platform, payment gateway.

Image
1

369

nexbitio/bitcoind repository overview

⁠docker-bitcoind

Docker Stars Docker Pulls

A Docker configuration with sane defaults for running a fully-validating Bitcoin node, based on Alpine Linux⁠.

Warning: older versions of this Dockerfile were based on Ubuntu and included all build dependencies, but due to the ridiculous size of the resulting image I've moved to binaries downloaded to Alpine Linux. If I've screwed up your development workflow somehow, file an issue and we'll get it fixed.

⁠Quick start

Requires that Docker should be installed⁠ on the host machine.

# Create some directory where your bitcoin data will be stored.
$ mkdir /home/youruser/bitcoin_data

$ docker run --name bitcoind -d \
   --env 'BTC_RPCUSER=foo' \
   --env 'BTC_RPCPASSWORD=password' \
   --env 'BTC_TXINDEX=1' \
   --volume /home/youruser/bitcoin_data:/root/.bitcoin \
   -p 127.0.0.1:8332:8332 \
   --publish 8333:8333 \
   nexbitio/bitcoind

$ docker logs -f bitcoind
[ ... ]

⁠Configuration

A custom bitcoin.conf file can be placed in the mounted data directory. Otherwise, a default bitcoin.conf file will be automatically generated based on environment variables passed to the container:

namedefault
BTC_RPCUSERbtc
BTC_RPCPASSWORDchangeme
BTC_RPCPORT8332
BTC_RPCALLOWIP::/0
BTC_RPCCLIENTTIMEOUT30
BTC_DISABLEWALLET1
BTC_TXINDEX0
BTC_TESTNET0
BTC_DBCACHE0
BTC_ZMQPUBHASHTXtcp://0.0.0.0:28333
BTC_ZMQPUBHASHBLOCKtcp://0.0.0.0:28333
BTC_ZMQPUBRAWTXtcp://0.0.0.0:28333
BTC_ZMQPUBRAWBLOCKtcp://0.0.0.0:28333

⁠Daemonizing

The smart thing to do if you're daemonizing is to use Docker's builtin restart policies⁠, but if you're insistent on using systemd, you could do something like

Create a "bitcoind.service"

$ nano /etc/systemd/system/bitcoind.service
$ systemctl start bitcoind
$ systemctl enable bitcoind

⁠bitcoind.service

[Unit]
Description=Bitcoind
After=docker.service
Requires=docker.service

[Service]
ExecStartPre=-/usr/bin/docker kill bitcoind
ExecStartPre=-/usr/bin/docker rm bitcoind
ExecStartPre=/usr/bin/docker pull nexbitio/bitcoind
ExecStart=/usr/bin/docker run \
    --name bitcoind \
    -p 8333:8333 \
    -p 127.0.0.1:8332:8332 \
    -v /data/bitcoind:/root/.bitcoin \
    nexbitio/bitcoind
ExecStop=/usr/bin/docker stop bitcoind

⁠Service file ends

⁠Run : ["docker logs -f bitcoind" to ensure that bitcoind continues to run.]

⁠Implement NGINX

~#apt-get install nginx
~#nano /etc/nginx/nginx.conf

⁠Basic NGINX conf below (can use ssl also)

worker_processes  auto;
daemon off;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  10024;
}
http {
    sendfile      off;
    access_log    off;
    server_tokens off;
    keepalive_timeout  65;
    server {
        charset utf-8;
        client_max_body_size 128M;
        listen 80;
	location / {
		proxy_pass http://127.0.0.1:8332;
		proxy_redirect off;
	}
    }
}

Thank you. For more support and products please visit: https://nexbit.io⁠ Mail me : [email protected]⁠

Tag summary

Content type

Image

Digest

Size

35.8 MB

Last updated

almost 7 years ago

docker pull nexbitio/bitcoind