Run your own Bitcoin and Electrumx node with DockersteemCreated with Sketch.

in #bitcoin7 years ago


I use Docker on my server to run my Bitcoin and Electrumx nodes and I will show you how to get (and tune) my Docker images and how to run them.

1. The images

Bitcoin

I created my own image based on the Alpine Linux base image to minimize its size and build time. You can see them on my GitHub repo. I use Bitcoin Classic but you are free to change it by any other implementation you like. Just fork it and replace the git URL and the version tag on line 16.

Also the bitcoin node is compiled with GUI, wallet and upnp functionalities disabled, as we don't need them to work with electrumx.

Electrumx

This image is based on debian + python because I didn't manage to install libleveldb-dev easily in alpine. All the other requirements are fetched by pip.

Building

Nothing special about the building, you can use the commands in the correct folders:
docker build -t bitcoind .
docker build -t electrumx .

2. Run it !

Create the Electrumx certificates, they can be self signed without repercutions as explained in the official doc : https://github.com/kyuupichan/electrumx/blob/master/docs/HOWTO.rst#creating-an-self-signed-ssl-certificate
You just have to put them in the folder that will be mounted in the Electrumx container

First you need to create the Docker network that will allow the two containers to communicate :
docker network create bitcoin-net

Starting the new containers

docker run -d \
   --name bitcoind \
   --net bitcoin-net \
   -v /var/bitcoin:/root/.bitcoin \
   -p 8333:8333 \
   bitcoin \
   -rpcuser=electrumx \
   -rpcpassword=electrumx \
   -printtoconsole \
   -txindex

docker run -d \
   --name electrumx \
   --net bitcoin-net \
   -v /var/electrumx:/srv/db \
   -p 50001-50002:50001-50002 \
   electrumx

Electrumx take no arguments because everything is setup in environment variables in the Dockerfile

The name of the bitcoin container must match with the environment variable DAEMON_URL of electrumx

I hope this will be useful to some of you and don't hesitate to suggest any improvement of my system :)

Sort:  

Following you! I give you a vote!

Congratulations @nyanloutre! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 3 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 57651.10
ETH 2377.43
USDT 1.00
SBD 2.42