Running Quorum in a Single Docker Container Configuration

Itay Podhajcer
3 min readFeb 18, 2020

J.P. Morgan Chase’s Quorum is one of the currently available permissioned Ethereum clients, forked from the Go Ethereum client. When you decide to run a containerized version of it, the first example you’ll encounter is probably their 7nodes example located at the quorum-examples GitHub repository.

But, what if you just need a simple single container configuration, to be used during development or small demos of your blockchain integrated system? You’ll either need to cleanup the 7nodes example (which can turn out to be pretty messy)or, as what will be doing in this article, create a single container configuration from scratch.

Example Repository

The scripts and configuration files (and a matching wallet) discussed in this article are available at this GitHub repository:

Configuration

As some of the steps for creating the initial configuration of the node require commands that are part of the Quorum package, but, on the other hand, one of the reasons for using Docker, is so we don’t need to install anything on the host machine (apart from Docker itself), we will be using the quorumengineering/quorum Docker image in an interactive manner with a host folder mounted into it to generated the required files.

We will start by running the container and get an interactive command line shell on it:

Once started we will need to generate a node key:

And copy the address displayed by running the following command:

This sums up what we needed from the container and we can now exit it and remove it.

We will now create a datadir folder which will hold the following:

  • The nodekey file.
  • The genesis.json file, containing the initialization information of the network, including a balance for a wallet of our choosing (you can use any Ethereum wallet software you want to generate a wallet):
  • And a static-nodes.json file, created using the address we got from running the bootnode --writeaddress command earlier, which defines the nodes allowed in our network, one node in our case, using the 0.0.0.0 IP address (bind to container external address):

Next we will create a bash startup script (outside of the datadir), which initializes the node, if it is not already initialized (by checking the existence of a file the script generates after initialization), and then runs the node:

And lastly, we will create a docker-compose file, that will start our container using start.sh as our entrypoint:

Note that we are using PRIVATE_CONFIG set to ignore, meaning we will be running without privacy mechanisms and QUORUM_CONSENSUS set to raft, as it simplifies the configuration process and allows as to run with a single container without the need of an additional transactions manager container.

Now the only thing left is to run the docker-compose and, hopefully, the container will start, initialize and the run the node (some error messages related to ports used by inter-node communication might be displayed, but can be ignored for this single container scenario).

Conclusion

The above example helps us create a container which is very comfortable for everyday development tasks. It can even be further customized by deploying a few demo contracts during initialization (you can use the geth command to execute a web3.js script that does that), further simplifying development of components which interact with Quorum and demo deployments.

Sign up to discover human stories that deepen your understanding of the world.

Written by Itay Podhajcer

Tech expert with 20+ years’ experience as CTO, Chief Architect, and Consultant. 3x Microsoft MVP award winner. Passionate blogger and open-source contributor

No responses yet

Write a response