/
Open in Online IDE

Spin up a VM

Or get your naked Corda up


Reading Time: 8 min

You have the install.sh one-liner script to run on your Corda node. Now what?

Setting up your Corda node on the cloud

Depending on your preferred cloud provider, you can follow the steps declared here to create a node on which to run the script:

Of note during the setup is that you are asked to set a fixed IP address and to open specific TCP ports in the firewall:

  • 10002: for the P2P connections.
  • 10003: for the RPC calls you will make to your node.

You can. But, instead, you may want to keep the 10002 port open and keep the 10003 port closed, so that only you and authorized personel can do anything with it via RPC. For instance, look at doing ssh -L 10003:127.0.0.1:10003 so that your local computer's TCP port at 10003 is tunneled to the VM's 10003.

What the install.sh script will do, among other things, is:

  • Install Java if necessary.
  • Create a corda user.
  • Download Corda and install it in /opt/corda.
  • As part of the download, private keys and signed certificates are downloaded.
  • Start Corda.
info icon

It downloads your private key. That's right, but that's only for the Testnet. In a production network, it would be:

  • Create a private key and certificate.
  • Ask the doorman to sign the certificate.

That's a lot and you can customize the actions. Indeed, beside the ONE_TIME_DOWNLOAD_KEY parameter, you can do:

  • USEORACLEJDK=true if you want it to install the Oracle version of Java SDK. If you used javafx.util.Pair, for instance, this is necessary.
  • WEBSERVER=true if you want also to install the web server, which responds on TCP port 8080.
  • O=MyCompany and OU=SalesDepartment if you want to customize the node party with organization and organization unit. Alas, if you want to replace locality and country, you will have to download the install.sh script and modify it by hand.

When it's all done, you have a running node with the basics and the finance CorDapp example. At this point, check your memory usage, and perhaps adjust down to reduce costs because 2 GB of RAM is possibly enough.

Start and stop Corda

  • If Corda was successfully installed as a service, you can:
    • Start it with sudo systemctl start corda.
    • Stop it with sudo systemctl stop corda.
  • If it was not installed as a service, you can:
    • Start it with sudo /opt/corda/run-corda.sh.
    • Access the running executable with sudo screen -x corda-node. See screen tutorial for what it is. When you disconnect from your screen, the executable keeps running. Even if you close the SSH session.
    • Stop it, in screen, with CTRL-C.

Standalone shell

With your Corda node running, how about you connect to it? Do you remember how you used the node shell when in development mode? Let's do the same but to connect to your remote VM with the standalone node shell.

Let's install it. Here, click the Download link (top right) to get it. Then as per the guide, run on your local computer:

$ java -jar /where/is/corda-tools-shell-cli-4.3-all.jar install-shell-extensions

With the shell installed on your computer, since you closed the 10003 RPC port on your remote VM, first SSH-tunnel to the VM:

$ ssh -i /YOUR/SSH/PRI/KEY -L 10003:127.0.0.1:10003 REMOTE_IP
#                                             ^ That's the port on the VM, keep it.
#                                   ^ That's localhost relative to the remote VM, not to your local computer.
#                             ^ Your local port. Choose another one if you want.

Next, find the RPC username and password in /opt/corda/node.conf. At some later point, you ought to change this password and restart Corda.

Then, in a new shell on your local computer, remember to add a space to skip the history log, and do:

$ corda-shell --host=127.0.0.1 --port=10003 --user=rpcuser --password=password
#                                                                     ^ Put the right one.
#                    ^ That's localhost relative to your local computer.

Node Explorer

With your Corda node running, how about you connect to it? The Node Explorer is a very useful tool that allows you to see all sorts of information about your node, for instance installed CorDapps and finalized transactions, and to start @StartableByRPC flows whose constructor parameter types are compatible. You can see a video about its capabilities here.

Download it now.

Since you closed the 10003 RPC port on your remote VM, first SSH-tunnel to it:

$ ssh -i /YOUR/SSH/PRI/KEY -L 10003:127.0.0.1:10003 REMOTE_IP
#                                             ^ That's the port on the VM, keep it.
#                                   ^ That's localhost relative to the remote VM, not to your local computer.
#                             ^ Your local port. Choose another one if you want.

Next, find the RPC username and password in /opt/corda/node.conf. Later change it and restart Corda. Then on the Node Explorer, connect with these parameters:

Node Explorer connection parameters
Node Explorer connection parameters

The beauty of tuneling is that you tell it that the node is local: 127.0.0.1 here is relative to your local computer. It should show the expected parameters:

Node Explorer dashboard
Node Explorer dashboard

In the settings tab, enter the /opt/corda/cordapps path of your remote VM, and you are all set. The rest of the GUI is self-explanatory.

Securing

When you have confirmed that things are working, try securing more with SSL.

The bootstrapper

For the audacious, you may consider creating a Testnet from scratch. This is in effect what you did in one click when running deployNodes on your local machine. Now, with the bootstrapper you can accomplish the same and then distribute the created files to separate machines, i.e. VM's.

Have a look at the documentation about how to generate the required network map files. Once you have all of the files, you can follow these instructions to copy your nodes to separate VM's.

Whichever data center you choose to install your node, as always, you will need the following:

  • A computer running Linux and with sufficient disk space.
  • A static IP address.

Docker

R3 provides an official Docker image for Corda. You can find detailed instructions about running Corda with Docker here. You can also watch an instructional video.

Conclusion

With a node finally running, albeit with the standard CorDapps, it is time to install your own. That's the subject of the next chapter.

Discuss on Slack
Rate this Page
Would you like to add a message?
Submit
Thank you for your Feedback!