Often in the realm of technology, especially working with distributed ledgers, we encounter a variety of networks. Corda networks, Business networks, Docker networks, to name just a few. The introduction of each of the above were monumental steps forward in the way business’ organise themselves, communicate and share value. This technical, educational piece attempts to help you discern between each class of network mentioned above as well as illustrate one of the ways they can all work together, seamlessly.
A Corda Network is an internet of Corda nodes operated by its network participants in a peer-to-peer fashion. Corda Networks enable interoperability — the exchange of data or assets via a secure, efficient internet layer — in a way that hasn’t been possible, until now. If you’ve never encountered Corda before, now is always a great time to school up on some awesome blockchain technology, grounded in reality.
Business Networks are a higher level notion. In this context, they can be viewed as collections of Corda nodes working together according to specific rules or governance structures. They collaborate to determine technical policies, pricing, membership, the development of apps that members will use, among other things. A Corda Network Foundation director discuss’ business network consortia in more detail here. It’s helpful, from developer perspective, to view them as application level concepts.
One the most common uses of a business network is membership management. One implementation of this has been proposed in the “memberships management” CorDapp. This app is open source and available, along with a suite of other business network related tools, here. This application needs to be present on all participant nodes and most importantly, on the business network operator node. This is the application that I’ll demo later on.
In a similar fashion to how docker allows you to manage a single container, Docker Compose makes it easy to control not just one, but networks of containers that make up a distributed system. This includes volume mounts, service definitionsand other related settings. Its main purpose is to issue multiple commands much more quickly to groups of containers.
Docker Compose will set up a single network by default, adding each container to it. Containers on a single network can reach and discover every other container on the network.
Docker-compose moves many of the options you would enter on the docker run cli into the docker-compose.yml file for easier reuse. It works as a front end script on top of the same api used by docker, so you can do everything docker-compose does with docker commands and a lot of shell scripting.
Combining these concepts together is fairly easy thanks to Corda running on the JVM and employing industry standard technologies. Here’s a visual as to how your network set-up may look. This is slightly more detailed than the demo I will do but, not a major stretch in imagination.
The directory structure is detailed below. You’ll notice a shared folder for CorDapps used by each node, a docker-compose yaml file which will draw in the Dockerfile and CorDapp jars it needs when building the containers . The Corda Network Bootstrapper tool was used so that each node has the necessary certificates, node-infos of other nodes, network parameters file. Each actor Alice, Bob and Charly have their own directory storing their certificates and node configuration files.
The network blueprint is can be laid out in a docker-compose.yaml file. Check out this configuration of a Corda network with all the things a Corda node needs to function mounted into the container definitions i.e. CorDapps, node-infos, logs, network-parameters etc.
Although this is manually done now there are tools, namely Dockerform, that can generate these for you straight out of gradle! It’s a really handy tool.
Bootstrap the network
To get going we can start the network simply by running the command docker-compose up This will provision a four-node network with two conventional nodes Alice and Bob , a business network operator node Charly and a notary Notary.
In a single command we’ll be able to launch a network of docker containers running Corda nodes. Check out the running process’ as normal
Interact with the containers and nodes
All nodes can be accessed via SSH with the user name userand password secret. Each node expose ports to the host system, so a connection can be made like this:
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@localhost -p 10004
Follow this sequence of steps to get a feel for the characteristics of a business network, the constraints on members vs. non-members in addition to the membership lifecycle itself. Remember, just because we’ve launch a Corda node with the business network membership management CorDapps installed doesn’t mean we are instantly part of a business network. It is through the invocation of flows can we begin to request, activate and evolve our membership to a given business network. In this example, Charly is the Business Network Operator but, equally, any node has the capability of running their own business network.
Why do this?
If you need to deploy and demo a running Corda network fast, perhaps for a hackathon, a stakeholder demonstration or even just for having the pleasure of sending an URL of your CorDapp to your friends for play with, by using the Corda Network Bootstrapper in combination with Docker Compose you have a swifter way to get a mini network up and going on in a way that is portable. The bootstrapper will generate certificates, node-infos and network parameters. Docker compose will take care of networking, connectivity between containers and dependency encapsulation while retrieving the require materials from a single shared directory. You could do a lot of this with Dockerform but it’s good to try for yourself 🙂
If you are targeting a CorDapp testing pipeline, having a parameterised docker-compose set-up may give consistency when getting a Corda network deployed and operating in order to test the latest build of your CorDapp. Furthermore, not having to connect to a foreign network services every run, having control over the notary, preserving resources by shutting down when needed could all be achieved with a docker compose based deployment. Food for thought!
The beauty of Corda being a distributed ledger designed from the ground up with business in mind means it works side by side with many of the technologies, networks and tools you trust across your development lifecycle. R3 has many tools available to accomplish similar feats depending on what you’re after. I would recommend checking out Dockerform for that. Hopefully this gives you a better glimpse of how things can work together on a slightly lower level. Thanks!
All the code used in this blog can be found on Github here
Special thanks to Moritz Platt for his advice and technical rigour
R3 is a growing, fast — become part of making blockchain real. Learn more from this post from R3’s Head of Engineering!