hx docker environment deploy


Because the server usually uses the linux server, the following ubuntu16.04 server environment serves only as an example about how to compile the docker deployment image of the hx project and start the corresponding container.

Download all resources needed for deployment

1.Download the deployment file deploy_data.zip from official website http://www.hx.cash/ and extract it to the local path. Directory structure as follows:

docker deploy

2.Directory structure discription:

  • Main_chain directory: This directory includes the contents of the hx main chain and the startup script;
  • third_chain directory: This directory includes the content of the third-party chain accessed by hx and the startup script;
  • volumes directory: This directory is mainly used to map the relevant chain data and log in the hx after startup to outside;
  • docker-compose.yml file: used to organize and configure two docker serveice hx-mainchain and hx-thirdchain in hx;
  • Dockerfile_mainchain and Dockerfile_thirdchain files: define docker files for hx_mainchain and hx_thirdchain;
  • sources.list file: A configuration file in Ubuntu system for configuring ubuntu sources.

Configuration file details


(1) For domestic users, the resources.list has been modified in docker in order to faster and better related software installation;

docker deploy

(2)Configure required content of hx_mainchain;

docker deploy

  • Create a /hx/crosschain_midware directory in the docker image to store middleware related data;

  • Copy needed source of hx_mainchain from directory main_chain to docker image;

  • Give start.sh (the script executed after docker starts) and duration_node (the node of mainchain) execute permission;

  • Link the witness_node to /usr/bin for the start.sh script to use.

(2)Configure hx_mainchain to start the execution script.

docker deploy

(3)Hx_mainchain execution script, located under the main_chain directory

docker deploy


Its structure is similar to the above Dockerfile_mainchain, which will not be described repeatly here;


(1) Two services (images) are defined in docker-compose, namely hx_thirdchain and hx_mainchain;

docker deploy


  • Dockerfile_thirdchain in the current directory as its docker file;

docker deploy

  • Define the name and tag of the service (image)

docker deploy

  • Setup port map of thirdchain,These ports correspond to the ports of the relevant chains in the execution script.

docker deploy

Execute port status in script start.sh

docker deploy

  • Set mapped directory

docker deploy

  • Set up name of the docker after the service starts.

docker deploy

  • Set ipv4 address of the service

docker deploy


Similar to the above hx_thirdchain service

  • Set the dependency of the service, hx_mainchain service depends on hx_thirdchain service

docker deploy

  • Set ipv4 address of the service

docker deploy

4.Execute the script (start.sh)

(1)Execution script in main_chain

docker deploy

  • Start the mongo db required to collect the plugin
  • Start acquisition plugin
  • Start the witness_node node of mainchain

(2)Execution script in third_chain

docker deploy

  • start bitcoin node
  • start hc node
  • start litecoin node

Compile the image

Go to deploy_data directory and execute the following command:

sudo docker-compose build [hx_mainchain/hx_thirdchain]


  • [hx_mainchain/hx_thirdchain] is an optional parameter indicating which image should be compiled (service). If it is empty, all images need to be compiled.
  • There are two images in docker compose, hx_mainchain and hx_thirdchain, where hx_mainchain depends on hx_thirdchain. So you can also compile a separate image.

Starting the container

Execute the following command in the deploy_data directory:

sudo docker-compose up –d  [hx_mainchain/hx_thirdchain]


  • [hx_mainchain/hx_thirdchain] is an optional parameter indicating which mirror can be used as base to start container. If it is empty, start all containers.
  • Because hx_mainchain depends on hx_thirdchain, you must first start hx_thirdchain to synchronize the data on the third-party chain. After a period of time (preferably after data synchronization), start hx_mainchain, and the collection program inside start to collect relevant data.

Confirm container status

Use cli_wallet under deploy_data directory (if it does not have execute permission, add the corresponding execute permission), connect to hx chain to check its status.

./cli_wallet -s ws://

Note: The description of above mentioned ip and port of the above command is detailed in the description of the above configuration file.

Last Updated: 6/12/2019, 11:21:09 AM