This is a Docker image that runs the Bitcoin -0.21.0 bitcoind node in a container. The checksum have been verfied during the docker image build stageitself.
The image contains the main binaries from the Bitcoin Core project - bitcoind
, bitcoin-cli
and bitcoin-tx
. It behaves like a binary, so We can pass any arguments to the image and they will be forwarded to the bitcoind
binary. We need to open the requisite ports in docker file
Clone the repository & issue following commands, Note we are implementing CI-CD through GitHub Actions in upcoming publications. say:
docker build -t bitcoinimg:latest .
We do have 442 Security Tests while building Docker Image in dockerfile whereas we also do some Security test on docker images once we complete the dockerbuild. We have put Image test results in test_results file. We also verify the checksum from main bitcoin website before building the fresh image from there.
1. Check dockerfile log, I have attached screenshot in document for 442 tests from main Bitcoin Org.
2. Post Image build we can do image tests by running test/run.sh bitcoinimg:latest
* Physical machine, cloud instance, or VPS that supports Docker , KVM or XEN based VMs) running Ubuntu 14.04 or later (*not OpenVZ containers!*)
* At least 100 GB to store the block chain files (and always growing!)
* At least 1 GB RAM + 2 GB swap file
-
We need to Create a
data
volume to persist the bitcoind blockchain data. It will store the data in case of container reboot. Then we will run below commandssh docker volume create --name=data docker run -v data:/bitcoin --name=bitcoin-node -d -p 8333:8333 -p 127.0.0.1:8332:8332 bitcoinimg:latest
sh -
We can identify the running container
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d0e1076b2dca bitcoin:latest "btc_oneshot" 2 seconds ago Up 1 seconds 127.0.0.1:8332->8332/tcp, 0.0.0.0:8333->8333/tcp bitcoin-node
-
We can then access the daemon's output with below
docker logs -f bitcoin-node
There are two communications methods to interact with a running Bitcoin Core daemon.
The first one which we have tested is using a cookie-based local authentication. It doesn't require any special authentication information as running a process locally under the same user that was used to launch the Bitcoin Core daemon allows it to read the cookie file previously generated by the daemon for clients. The downside of this method is that it requires local machine access.
The second option is making a remote procedure call using a username and password combination. This has the advantage of not requiring local machine access, but in order to keep Wer credentials safe We should use the newer rpcauth
authentication mechanism.
Start by launch the Bitcoin Core daemon:
❯ docker run --rm --name bitcoin-server -it ruimarinho/bitcoin-core \
-printtoconsole \
-regtest=1
Then, inside the running bitcoin-server
container, locally execute the query to the daemon using bitcoin-cli
:
❯ docker exec --user bitcoin bitcoin-server bitcoin-cli -regtest getmininginfo
OutPut will be as mentioned below
=========================================
{
"blocks": 0,
"currentblocksize": 0,
"currentblockweight": 0,
"currentblocktx": 0,
"difficulty": 4.656542373906925e-10,
"errors": "",
"networkhashps": 0,
"pooledtx": 0,
"chain": "regtest"
}
-----