uphold/docker-bitcoin-gold

Name: docker-bitcoin-gold

Owner: Uphold

Description: A Bitcoin Gold docker image.

Created: 2017-11-27 16:55:56.0

Updated: 2018-05-14 03:04:06.0

Pushed: 2018-02-26 11:11:08.0

Homepage:

Size: 10

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

uphold/bitcoin-gold

A Bitcoin Gold docker image.

uphold/bitcoin-gold uphold/bitcoin-gold uphold/bitcoin-gold uphold/bitcoin-gold

Tags
What is Bitcoin Gold?

Bitcoin Gold is a fork of the Bitcoin blockchain. At block 491407, Bitcoin Gold miners began creating blocks with a new proof-of-work algorithm, and this caused a bifurcation of the Bitcoin blockchain. The new branch is a distinct blockchain with the same transaction history as Bitcoin up until the fork, but then diverges from it. As a result of this process, a new cryptocurrency was born. Learn more about Bitcoin Gold.

Usage
How to use this image

This image contains the main binaries from the Bitcoin Gold project - bgoldd, bgold-cli and bitcoin-tx. It behaves like a binary, so you can pass any arguments to the image and they will be forwarded to the bgoldd binary:

cker run --rm -it uphold/bitcoin-gold \
rinttoconsole \
egtest=1 \
pcallowip=172.17.0.0/16 \
pcpassword=bar \
pcuser=foo

By default, bgoldd will run as user bitcoingold for security reasons and with its default data dir (~/.bitcoingold/). If you'd like to customize where bitcoin-gold stores its data, you must use the BITCOIN_GOLD_DATA environment variable. The directory will be automatically created with the correct permissions for the bitcoingold user and bitcoin-gold automatically configured to use it.

cker run --env BITCOIN_GOLD_DATA=/var/lib/bgold --rm -it uphold/bitcoin-gold \
rinttoconsole \
egtest=1

You can also mount a directory it in a volume under /home/bitcoingold/.bitcoingold in case you want to access it on the host:

cker run -v ${PWD}/data:/home/bitcoingold/.bitcoingold -it --rm uphold/bitcoin-gold \
rinttoconsole \
egtest=1

You can optionally create a service using docker-compose:

oin-gold:
age: uphold/bitcoin-gold
mmand:
-printtoconsole
-regtest=1
Using RPC to interact with the daemon

There are two communications methods to interact with a running Bitcoin Gold daemon.

The first one 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 Gold 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 your credentials safe you should use the newer rpcauth authentication mechanism.

Using cookie-based local authentication

Start by launching the Bitcoin Gold daemon:

cker run --rm --name bitcoin-gold-server -it uphold/bitcoin-gold \
rinttoconsole \
egtest=1

Then, inside the running bitcoin-gold-server container, locally execute the query to the daemon using bgold-cli:

cker exec --user bitcoingold bitcoin-gold-server bgold-cli -regtest getmininginfo


locks": 0,
urrentblocksize": 0,
urrentblockweight": 0,
urrentblocktx": 0,
ifficulty": 4.656542373906925e-10,
rrors": "",
etworkhashps": 0,
ooledtx": 0,
hain": "regtest"

In the background, bgold-cli read the information automatically from /home/bitcoingold/.bitcoingold/regtest/.cookie. In production, the path would not contain the regtest part.

Using rpcauth for remote authentication

Before setting up remote authentication, you will need to generate the rpcauth line that will hold the credentials for the Bitcoin Gold daemon. You can either do this yourself by constructing the line with the format <user>:<salt>$<hash> or use the official rpcuser.py script to generate this line for you, including a random password that is printed to the console.

Example:

rl -sSL https://raw.githubusercontent.com/BTCGPU/BTCGPU/master/share/rpcuser/rpcuser.py | python - <username>

ng to be appended to bitcoin.conf:
uth=foo:7d9ba5ae63c3d4dc30583ff4fe65a67e$9e3634e81c11659e3de036d0bf88f89cd169c1039e6e09607562d54765c649cc
 password:
deQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0=

Note that for each run, even if the username remains the same, the output will be always different as a new salt and password are generated.

Now that you have your credentials, you need to start the Bitcoin Gold daemon with the -rpcauth option. Alternatively, you could append the line to a bitcoin.conf file and mount it on the container.

Let's opt for the Docker way:

cker run --rm --name bitcoin-gold-server -it uphold/bitcoin-gold \
rinttoconsole \
egtest=1 \
pcallowip=172.17.0.0/16 \
pcauth='foo:e1fcea9fb59df8b0388f251984fe85$26431097d48c5b6047df8dee64f387f63835c01a2a463728ad75087d0133b8e6'

Two important notes:

  1. Some shells require escaping the rpcauth line (e.g. zsh), as shown above.
  2. It is now perfectly fine to pass the rpcauth line as a command line argument. Unlike -rpcpassword, the content is hashed so even if the arguments would be exposed, they would not allow the attacker to get the actual password.

You can now connect via bgold-cli or any other compatible client. You will still have to define a username and password when connecting to the Bitcoin Gold RPC server.

To avoid any confusion about whether or not a remote call is being made, let's spin up another container to execute bgold-cli and connect it via the Docker network using the password generated above:

cker run --link bitcoin-gold-server --rm uphold/bitcoin-gold bgold-cli -rpcconnect=bitcoin-gold-server -regtest -rpcuser=foo -rpcpassword='j1DuzF7QRUp-iSXjgewO9T_WT1Qgrtz_XWOHCMn_O-Y=' getmininginfo


locks": 0,
urrentblocksize": 0,
urrentblockweight": 0,
urrentblocktx": 0,
ifficulty": 4.656542373906925e-10,
rrors": "",
etworkhashps": 0,
ooledtx": 0,
hain": "regtest"

Done!

Images

The uphold/bitcoin-gold image comes in multiple flavors:

uphold/bitcoin-gold:latest

Points to the latest release available of Bitcoin Gold. Occasionally pre-release versions will be included.

uphold/bitcoin-gold:<version>

Based on a slim Debian image, targets a specific version branch or release of Bitcoin Gold.

uphold/bitcoin-gold:<version>-alpine

Based on Alpine Linux with Berkeley DB 4.8 (cross-compatible build), targets a specific version branch or release of Bitcoin Gold.

Supported Docker versions

This image is officially supported on Docker version 17.09.0-ce, with support for older versions provided on a best-effort basis.

License

License information for the software contained in this image.

License information for the uphold/bitcoin-gold docker project.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.