Introduction

If you feel extremely lucky or your have a supercomputer to your disposal you may try to mine for bitcoins to earn some extra cash. The complexity of Bitcoin's block chain hashing algorithm gets stronger every 2 weeks to combat the Moore's law so be sure to bring in some decent hardware. In this article we will show how to easily deploy a Bitcoin mining node with docker.

About

The automated trusted build of the Bitcoin mining node “linuxconfig/bitcoin-node” docker image can be used to instantly deploy a Bitcoin node on any host running docker service.

Configuration

The docker Bitcoin mining node image runs on Debian Linux and includes bitcoin daemon binaries directly downloaded from bitcoin.org. It is deployed under "root" user account. The rpcuser and rpcpassword are automatically generated during a first launch and can be located in /root/.bitcoin/bitcoin.conf.

The Bitcoin node server is configured to listen on 8333 port and this to allow for node to node commutation as well as 8332 port to accept JSON-RPC communications.

Usage

To deploy your Bitcoin node run the following linux command.
# docker run -d --name=bitcoin-node -h bitcoind -p 8332:8332 -p 8333:8333 linuxconfig/bitcoin-node
Alternatively, to start a secure standalone Bitcoin node omit port options to disallow port connection from the external network:
# docker run -d --name=bitcoin-node -h bitcoind linuxconfig/bitcoin-node
The above commands will instantly start and configure your Bitcoin node. Once your Bitcoin has started depending on your environment it will take around 24 hours synchronize with the latest bitcoin block chain. Currently, you can expect your /root/.bitcoin/blocks directory to grow to about 35GB in size.

Getting system information

Using a container name bitcoin-node you can now retrieve various information about your Bitcoin-node. For example:

Obtain rpcuser credentials

#  docker exec bitcoin-node cat /root/.bitcoin/bitcoin.conf

Get bitcoin wallet balance

# docker exec bitcoin-node bitcoin-cli getbalance
0.00000000

Obtain bitcoin mining info

$ docker exec bitcoin-node bitcoin-cli getmininginfo
{
    "blocks" : 341182,
    "currentblocksize" : 0,
    "currentblocktx" : 0,
    "difficulty" : 41272873894.69702148,
    "errors" : "",
    "genproclimit" : -1,
    "networkhashps" : 287000658654314688,
    "pooledtx" : 0,
    "testnet" : false,
    "chain" : "main",
    "generate" : false
}
For more available bitcoin commands run:
$ docker exec bitcoin-node bitcoin-cli help
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: