This is a fork of jpbriquet/docker-decred 's project so I can play around with it.
Decred is an open and progressive cryptocurrency with a system of community-based governance integrated into its blockchain. The fusion of technology, community, and governance the Decred way means development is self-funding and remains sustainable.
Website: www.decred.org
Documentation : docs.decred.org
Wiki: wiki.decred.org
This Decred docker image is based on the Ubuntu image 16.04 LTS (Xenial Xerus) and contains all binaries in decred releases:
- Decred Daemon (chainserver) / dcrd
- Decred Wallet / dcrwallet
- Decred Controller (rpc client) / dcrctl
Only official Decred release binaries are used to build this image. These binaries are verified based on the recommended binaries verification process. (refer to Dockerfile content for details)
This Decred Docker image can be used to create containers that can start each of the included executables (dcrd, dcrwallet, ...).
The image can be used as follow:
$ docker build -t nolim1t/decred .
$ docker run -it nolim1t/decred dcrd
Or with screen
$ screen docker run -it nolim1t/decred dcrd
This guide describes how to configure a Decred daemon (dcrd) container. The next step will be to connect a Decred wallet (dcrwallet) container on the daemon. Both containers will be manageable with the Decred controller tool (dcrctl), which will give a way to unlock the Decred wallet, or get Decred network information from the Decred daemon.
As it is an advanced configuration, it is strongly recommended to be familiar with Docker and with Decred documentation
Our Decred containers will communicate on their own Docker bridge network called decrednet, they will be isolated from other containers eventually running on the Docker engine.
$ docker network create --driver bridge decrednet
Docker volume will be used to store decred containers data that has to be persistent:
- blockchain data
- wallet data
- ...
For more information about this Docker storage mode refer to Docker data-volume.
#### Create a volume for the Decred daemon container:
$ docker volume create --name dcrd-vol
#### Create a volume for the Decred wallet container:
$ docker volume create --name dcrwallet-vol
In this guide, configuration files are located outside of the containers and are in a "conf" directory. These configuration files will be available to our containers via a host file mount.
`-- conf
|-- dcrctl.conf
|-- dcrd.conf
|-- dcrwallet.conf
`-- ticketbuyer.conf
This chapter describe how to configure and start a Decred daemon container. The Decred daemon container automatically connects to the Decred P2P network and then synchronize to the latest blockchain head block. Later in this guide we will connect a wallet container to the daemon container.
Decred daemon can be started with command line arguments, however, this is not recommended for sensitive information like the RPC user/password. It is possible to set this configuration in a dcrd.conf configuration file:
; -------------------------------------------------------
; RPC server options - The following options control the built-in RPC server
; which is used to control and query information from a running dcrd process.
;
; NOTE: The RPC server is disabled by default if no rpcuser or rpcpass is
; specified.
; -------------------------------------------------------
rpclisten=0.0.0.0:9109
rpcuser=whatever_username_you_want
rpcpass=whatever_password_you_want
Adjust this configuration file to your needs, to view all options available, refer to the sample configuration of the Decred daemon
Save this configuration in the file dcrd.conf (in conf directory).
The daemon container will use the data-volume and the dcrd.conf configuration file created previously.
$ docker run -d --name dcrd --net=decrednet -h dcrd -v dcrd-vol:/home/decred/.dcrd -v $PWD/conf/dcrd.conf:/home/decred/.dcrd/dcrd.conf jpbriquet/decred:latest dcrd
Once launched Decred daemon will read local blockchain data and then will synchronize with the p2p network. This step may take a while depending of the network connection speed. Use docker logs to check what the container is doing.
docker logs dcrd
15:39:18 2016-12-31 [INF] DCRD: Version 0.X.Y-beta
15:39:18 2016-12-31 [INF] DCRD: Home dir: /home/decred/.dcrd
15:39:18 2016-12-31 [INF] DCRD: Loading block database from '/home/decred/.dcrd/data/mainnet/blocks_ffldb'
15:39:18 2016-12-31 [INF] DCRD: Block database loaded
15:39:18 2016-12-31 [INF] INDX: Exists address index is enabled
15:39:18 2016-12-31 [INF] CHAN: Blockchain database version 2 loaded
...
The daemon container is now up and running.
When the container has been created, standard Docker commands can be used.
docker stop dcrd
docker start dcrd
The console can be connected on dcrd to get information about the blockchain.
docker exec -it dcrd dcrctl --terminal
Starting terminal mode.
Enter h for [h]elp.
Enter l for [l]ist of commands.
Enter q for [q]uit.
> getinfo
{
"version": 70000,
"protocolversion": 2,
"blocks": 94999,
"timeoffset": 0,
"connections": 7,
"proxy": "",
"difficulty": 802194.38990989,
"testnet": false,
"relayfee": 0.01,
"errors": ""
}
The Decred wallet container needs to connect on a Decred daemon container to have access to the blockchain and interact with the p2p network.
Decred wallet can be started with command line arguments, however, this is not recommended for sensitive information like the RPC user/password. Prepare the dcrwallet.conf configuration file for the Decred wallet as follow:
; -------------------------------------------------------
; RPC settings (both client and server)
; -------------------------------------------------------
username=whatever_wallet_username_you_want
password=whatever_wallet_password_you_want
dcrdusername=whatever_username_you_want
dcrdpassword=whatever_password_you_want
; ------------------------------------------------------------------------------
; RPC server settings
; ------------------------------------------------------------------------------
rpclisten=0.0.0.0:9110
; -------------------------------------------------------
; RPC client settings
; -------------------------------------------------------
; The server and port used for dcrd websocket connections.
rpcconnect=dcrd:9109
; File containing root certificates to authenticate a TLS connections with dcrd
cafile=~/.dcrd/rpc.cert
- dcrdusername and dcrdpassword are user and password to connect the wallet on the rpc service of the daemon, this variable must have the same value than in dcrd.conf.
- username and password are used to authenticate incoming connections on the rpc service of the wallet.
To view all options available, refer to the sample Decred wallet configuration Adjust it to your needs.
Save this configuration file as dcrwallet.conf in conf directory.
The Decred controller console (dcrctl) needs to know the RPC credentials to connect on the wallet. Create following configuration file and save it as dcrctl.conf in conf directory.
; ------------------------------------------------------------------------------
; RPC client settings
; ------------------------------------------------------------------------------
rpcuser=whatever_wallet_username_you_want
rpcpass=whatever_wallet_password_you_want
The following command will launch the wallet creation assistant that can create a brand new wallet or import an existing wallet seed.
$ docker run -it --rm -v dcrwallet-vol:/home/decred/.dcrwallet jpbriquet/decred:latest dcrwallet --create
Enter the private passphrase for your new wallet:
Confirm passphrase:
Do you want to add an additional layer of encryption for public data? (n/no/y/yes) [no]: no
Do you have an existing wallet seed you want to use? (n/no/y/yes) [no]:
Your wallet generation seed is:
...
Creating the wallet...
The wallet has been created successfully.
The wallet container named 'dcrwallet' uses the wallet volume, the daemon volume (in read-only) and the dcrwallet.conf configuration file previously created.
This container is launched in interactive mode because the Decred wallet needs at first launch to know the wallet passphrase and you have to type it in the console.
$ docker run -it --name dcrwallet --net=decrednet -h dcrwallet -v $PWD/conf/dcrwallet.conf:/home/decred/.dcrwallet/dcrwallet.conf -v $PWD/conf/dcrctl.conf:/home/decred/.dcrctl/dcrctl.conf -v dcrwallet-vol:/home/decred/.dcrwallet -v dcrd-vol:/home/decred/.dcrd:ro jpbriquet/decred:latest dcrwallet
16:23:52 2017-01-01 [INF] DCRW: Version 0.X.Y-beta
16:23:52 2017-01-01 [INF] DCRW: Generating TLS certificates...
16:23:53 2017-01-01 [INF] DCRW: Done generating TLS certificates
16:23:53 2017-01-01 [INF] DCRW: Attempting RPC client connection to dcrd:9109
16:23:53 2017-01-01 [INF] RPCS: Listening on 127.0.0.1:9110
16:23:53 2017-01-01 [INF] RPCS: Listening on [::1]:9110
16:23:53 2017-01-01 [INF] CHNS: Established connection to RPC server dcrd:9109
16:23:53 2017-01-01 [INF] WLLT: Opened wallet
*** ATTENTION ***
Since this is your first time running we need to sync accounts. Please enter
the private wallet passphrase. This will complete syncing of the wallet
accounts and then leave your wallet unlocked. You may relock wallet after by
calling 'walletlock' through the RPC.
*****************
Enter private passphrase:
16:24:00 2017-01-01 [INF] WLLT: The wallet has been unlocked without a time limit
16:24:00 2017-01-01 [INF] WLLT: Beginning a rescan of active addresses using the daemon. This may take a while.
16:24:03 2017-01-01 [INF] WLLT: The last used account was 0. Beginning a rescan for all active addresses in known accounts.
...
16:25:19 2017-01-01 [INF] WLLT: Blockchain sync completed, wallet ready for general usage.
...
Wait for the end of the synchronization, and then hit CTRL+C.
You will need several additional options when launching the container if you would like to do POS mining with the wallet (buying tickets and/or voting on tickets).
Use option --enablevoting
Add this option when you start the container
Example to start the wallet with automatic voting:
$ docker run -it --name dcrwallet --net=decrednet -h dcrwallet -v $PWD/conf/dcrwallet.conf:/home/decred/.dcrwallet/dcrwallet.conf -v $PWD/conf/dcrctl.conf:/home/decred/.dcrctl/dcrctl.conf -v dcrwallet-vol:/home/decred/.dcrwallet -v dcrd-vol:/home/decred/.dcrd:ro jpbriquet/decred:latest dcrwallet --enablevoting
Consult the dcrwallet documentation and choose options related to the ticket buyer. These options starts with "--ticketbuyer." (e.g. --ticketbuyer.maxpriceabsolute=60, ...).
Add these options when you start the container.
When the container has been created, standard Docker commands can be used.
docker stop dcrwallet
docker start dcrwallet
The console can be connected on the dcrwallet to do wallet related operations. For instance unlocking the wallet or creating new transactions.
docker exec -it dcrwallet dcrctl --terminal --wallet
Starting terminal mode.
Enter h for [h]elp.
Enter l for [l]ist of commands.
Enter q for [q]uit.
> getstakeinfo
{
"blockheight": 95000,
"poolsize": 41672,
"difficulty": 56.49212635,
"allmempooltix": 0,
"ownmempooltix": 0,
"immature": 0,
"live": 0,
"proportionlive": 0,
"voted": 0,
"totalsubsidy": 0,
"missed": 0,
"proportionmissed": 0,
"revoked": 0,
"expired": 0
}
View license information for the software contained in this image.
This image is officially supported on Docker version 1.13.x and above.
Support for older versions (down to 1.6) is provided on a best-effort basis.
Please see the Docker installation documentation for details on how to upgrade your Docker daemon.
If you have any problems with or questions about this image, please contact us through a GitHub issue.
If you have any problems with or questions about Decred tools and utilies provided in this image, please contact Decred Developer team on GitHub.
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.