Blogs

Test deploy your CorDapp with Corda network bootstrapper

Peter Li, Developer July 29 2022 | 5 min read

The Corda network bootstrapper is a tool that allows you to quickly bootstrap a Corda test network. The reason it is only recommended to be used as a test network is that it uses all the development java keystores to sign the nodes, CorDapp, transactions, etc as default. And managing to upgrade the development keystore to production keystore is not supported out of the box. The Corda network bootstrapper primarily comes in handy when you plan to deploy your CorDapp into virtual machines to present a demo or PoC. In this article, we will be walking through the steps of setting up Corda network with the network bootstrapper tool.

Using network bootstrapper locally

Pre-deployment

1. Download the Corda Network Bootstrapper from here.

2. Prepare the node.conf file for each. Here is a sample config. (This template is for local deployment. We will show another example of remote deployment in the later section of this blog)

3. Build and place the CorDapps next to the node.config files.

The project folder should look like this:

Run the bootstrapper

Result folder structure

Based on the input of the network bootstrapping process, you should be expecting the following items in the result folder.

Post bootstrapping

Before we can start the node and run our app in the terminal, we have to do another step. (It is optional) We need to installed the standalone-node-shell to the node. There are two options to do so:

  1. Copy/paste the driver’s folder from any samples. (It will appear in the node directory after deployNodes)
  2. Download the standalone node shell and run it separately in another terminal. Instruction here.

Run the app

Rather than having the option of running all the nodes together (as shown in all the samples), you will have to start each node manually. Go into each node folder and run:

Your nodes will be up. And now you have a local bootstrapped network!

Using the network bootstrapper with VMs

Step 1: Create a VM, and get the public IP address. (For the simple demo purpose, I disabled all the security rules, allowing all inbound and outbound traffic to these VMs. Never do this in production!)

Step 2: Install java 1.8 at the VM

Step 3: Bootstrap the Corda network (generating all the node files)

Except for this time, we will need to modify the node.config files with the VM’s public IPs. For example, we designate the above VM (13.71.147.131)to host node A. We will put the public IP in the p2pAddress field.

Step 4: Paste the standalone node shell drivers into the node folders (described above)


Step 5: Drop the node folder to the designated hosting VMs.

We are dropping PartyA’s entire folder to the VM home directory.

Step 6: Go into the node folder and run the node (Same as local deployment)

You will need to perform the exact same procedure for PartyB and Notary. Once you start both nodes and notary service, you should have successfully deployed a test Corda network on remote VMs.

DevModes

devMode must be disabled on all production nodes. In development mode (i.e. when devMode = true), the certificates the directory is filled with pre-configured keystores if they do not already exist to ensure that developers can get the nodes working as quickly as possible. More details.

You can in fact turn the devMode to false by changing the node.config flag to false:

However, this will need a few additional steps to ensure your CorDapp continues to function normally.

Step 1: You will have to sign the CorDapp with a non-dev key, more specifically we only care about the contracts.jar. And, FYI, the workflow jars typically do not need to be signed with any keys. So how do you sign the contract jars? You can simply use the Gradle to do it. Just edit the build.gradle file for the contracts package:

and the gradle.preperties the file will have the information of the place of Keystore and the password:

See the full tutorial of signing a CorDapp jar here. Once you have the CorDapp jars correctly signed, simply replace the old CorDapp jars with the lately signed jars.

Step 2: You will have to either use the standalone-node-shell outside of the starting terminal or use ssh to connect to the node because a devMode=false node does not allow shell interface upon start. More standalone-node-shell details refer to here. But in this blog, we will simply use the ssh connection. We need to modify the node.config once again, set a port at 2222.

Now we are ready to run the node with devMode=false. Since we are not expecting any shell interaction, we will just run it in the background.

Then it will prompt you for the node user’s password. Then you are in!

In summary, this blog teaches:

  1. How to use the Corda Network Bootstrapper to test and deploy a local Corda network.
  2. How to use the Corda Network Bootstrapper to test and deploy a Corda network onto remote VMs.
  3. How to set the devMode of a Corda node to false.

Last Note: A Corda Node with devMode set to false does not mean it is production use ready. A production-level Corda network is more about setting up all the certificates, signing components, network identities, and network management. If you are interested to deploy your CorDapp to a production level, please contact us at: [email protected].

We would love to help!

Tags:
Share: