Deploying a test DAML application on VMware Blockchain 1.6.0.1

In my previous post, VMware Blockchain 1.6.0.1 Install on vSphere 7U3, I walked through the process of deploying VMware Blockchain 1.6.0.1 on vSphere 7. We left with the deployment up and running but no way to test if it was truly functional. In this post, I’ll complete the steps needed for installing a sample DAML application and submit a few transactions.

In order to deploy a DAML application we must have the daml executable installed locally. Before you can install the daml executable though, you must meet a couple of prerequisites:

  • JDK 11 or greater must be installed
  • Visual Studio Code (current version) must be installed

https://docs.daml.com/getting-started/installation.html#install-the-dependencies notes these dependencies and includes links to the download and installation instructions for each.

If you spend much time at https://docs.daml.com, you will notice that there are two different variants available: open-source and enterprise. As you might imagine, the enterprise version has a cost associated but comes with more functionality. For our purposes, the open-source version works fine.

To install the the daml executable on a Linux system (where I run all commands from), is as simple as running: curl -sSL https://get.daml.com/ | sh

You should see output similar to the following:

Determining latest SDK version...
Latest SDK version is 2.3.2
Downloading SDK 2.3.2. This may take a while.
######################################################################## 100.0%
Extracting SDK release tarball.
Installing SDK release from directory.
Please add /home/ubuntu/.daml/bin to your PATH.
Bash completions installed for Daml assistant.
Zsh completions installed for Daml assistant.
To use them, add '~/.daml/zsh' to your $fpath, e.g. by adding the following
to the beginning of '~/.zshrc' before you call 'compinit':
fpath=(~/.daml/zsh $fpath)

Successfully installed Daml.

If you would like to install the daml executable on Windows (and run it out of PowerShell), a Windows installer and instructions are provided at https://docs.daml.com/getting-started/installation.html#windows-10.

With the daml executable installed, we can now use it to create a sample application. I chose the IOU Quickstart application as it was well documented and required little effort to get up and running.

The alias for the IOU Quickstart application is just quickstart-java and you can install it via a simple daml command:

daml new quickstart --template quickstart-java

This results in a folder named quickstart being created with the files necessary to configure and deploy the IOU Quickstart application (it’s similar to git clone). The only output from the previous command is:

Created a new project in "quickstart" based on the template "quickstart-java".

You can cd to the newly created quickstart directory (from whichever directory you ran the daml command) and see that there are a few files created.

ls -lah ~/quickstart

total 48K
drwxrwxr-x 4 ubuntu ubuntu 4.0K Sep  6 10:34 .
drwxrwxr-x 3 ubuntu ubuntu 4.0K Sep  6 10:34 ..
drwxrwxr-x 3 ubuntu ubuntu 4.0K Sep  6 10:34 daml
-rw-rw-r-- 1 ubuntu ubuntu  325 Sep  6 10:34 daml.yaml
-rw-r--r-- 1 ubuntu ubuntu  319 Sep  6 10:34 .dlint.yaml
-rw-r--r-- 1 ubuntu ubuntu 8.6K Sep  6 10:34 frontend-config.js
-rw-r--r-- 1 ubuntu ubuntu  174 Sep  6 10:34 .gitattributes
-rw-r--r-- 1 ubuntu ubuntu   26 Sep  6 10:34 .gitignore
-rw-r--r-- 1 ubuntu ubuntu 4.0K Sep  6 10:34 pom.xml
drwxrwxr-x 3 ubuntu ubuntu 4.0K Sep  6 10:34 src

The main file that we are concerned with is the daml.yaml file as it holds the configurable parameters for the IOU Quickstart application. By default, it should look like the following:

sdk-version: 2.3.2
name: quickstart
source: daml
init-script: Main:initialize
version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
codegen:
  java:
    package-prefix: com.daml.quickstart.model
    output-directory: target/generated-sources/iou
    decoderClass: com.daml.quickstart.iou.TemplateDecoder

You could deploy the IOU Quickstart application with this configuration but it wouldn’t be functional. In order to use the application, we have to define “parties” that can log in and submit transactions. The following is what the file looks like with valid parties configured:

sdk-version: 2.3.2
name: quickstart
source: daml
init-script: Main:initialize
parties:
  - Alice
  - Bob
  - USD_Bank
  - EUR_Bank
version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
codegen:
  java:
    package-prefix: com.daml.quickstart.model
    output-directory: target/generated-sources/iou
    decoderClass: com.daml.quickstart.iou.TemplateDecoder

Alice, Bob, USD_Bank and EUR_Bank are arbitrary names for our purposes and could be changed to suit your needs.

One the daml.yaml file is configured property, we need to determine where we are going to deploy to. Applications are deployed to client nodes and as I only have one in this lab (192.168.100.35), there isn’t really much choice. If you deployed more than one, you could choose any of them. You can also query the deployment metadata file on the Orchestrator appliance if you’re not sure of your options.

grep CLIENT_ENDPOINT /home/blockchain/output/EPG-blockchain-deployment_2022-08-02T16:59:52.25028 |awk -F key: '{print $2}'

CLIENT_ENDPOINT, value: https://192.168.100.35:6865

You can see from this output that the same IP address noted earlier (192.168.100.35) is noted along with port 6865. This port corresponds to the daml_ledger_api container running on the client node. This information is handy to have in the event that your deployment fails and you need to troubleshoot it.

With the correct deployment endpoint address, we can now issue another daml command to deploy the application:

daml deploy --host 192.168.100.35 --port 6865

You should see output similar to the following:

Deploying to 192.168.100.35:6865
Checking party allocation at 192.168.100.35:6865
Allocating party for 'Alice' at 192.168.100.35:6865
Allocated 'Alice' for 'Alice' at 192.168.100.35:6865
Allocating party for 'Bob' at 192.168.100.35:6865
Allocated 'Bob' for 'Bob' at 192.168.100.35:6865
Allocating party for 'USD_Bank' at 192.168.100.35:6865
Allocated 'USD_Bank' for 'USD_Bank' at 192.168.100.35:6865
Allocating party for 'EUR_Bank' at 192.168.100.35:6865
Allocated 'EUR_Bank' for 'EUR_Bank' at 192.168.100.35:6865

2022-08-01 14:33:20.17 [INFO]  [build]
Compiling quickstart to a DAR.

2022-08-01 14:33:21.60 [INFO]  [build]
Created .daml/dist/quickstart-0.0.1.dar
Uploading .daml/dist/quickstart-0.0.1.dar to 192.168.100.35:6865
DAR upload succeeded.
Deploy succeeded.

At this point, the application is deployed. However, there is still no means of accessing it. To get a UI up and running, we use the navigator function of the daml executable along with the same deployment endpoint address noted earlier (192.168.100.35:6865).

daml navigator server 192.168.100.35 6865

You should see output similar to the following:

   _  __          _           __
  / |/ /__ __  __(_)__ ____ _/ /____  ____
 /    / _ `/ |/ / / _ `/ _ `/ __/ _ \/ __/
/_/|_/\_,_/|___/_/\_, /\_,_/\__/\___/_/
                 /___/
Version 2.3.2
Frontend running at http://localhost:4000.

As you can see from the output, there is a UI running at http://localhost:4000 now. Pointing a browser at that address brings up the folllowing:

When you click the “Choose your role” dropdown menu, you’ll see the same parties that we configured in the daml.yaml file earlier. You can choose any of these to log in (no password is required).

Once logged in, you can see that there are three transaction templates available under the Templates section.

It might not seem immediately apparent at first what these each are, but the first bit of text before the @ sign give some clues.

  • Iou:IouTransfer – this would be used to transfer an existing IOU to a different party
  • Iou:Iou – this is used to issue a new IOU
  • IouTrade:IouTrade – this would be used to initiate an IOU trade with another party

Since I’m just starting out, I’m going to choose the Iou:Iou template and create a few IOUs for the Alice party.

I’m going to keep things fairly simple and create IOUs for Alice with USD as the currency.

After each IOU is issued, you should be taken to the Contract page where you will see the related contract to each IOU.

You can’t tell a lot from this page other than that all of these contracts were related to creating IOUs (based on the name of the template used). You can click on any of them to see more details though.

You can also click on the Issued Ious or Owned Ious pages to see more relevant data at a glance.

If you click on any of the issued IOUs, you will notice that there are a series of buttons across the top. These will allow you to initiate various operations against the IOU.

I’m going to transfer this IOU to Bob by clicking the Iou_Transfer button.

Back on the Owned Ious page, you will see that this IOU is no longer present:

You can log out as Alice (the button next the username) and then log in as Bob to see that their is a contract awaiting approval.

By clicking the IouTransfer_Accept button, the IOU is transferred.

And while logged in as Bob, we can see on the Owned Ious page that Bob now has an IOU in USD in the amount of 776.

If you have VMware Aria Operations for Applications (formerly Tanzu Observability and formerly Wavefront) or any other monitoring utility configured, you should see some spikes of activity during this time period.

One important metric to make note of is the sequence number. This should only go up as new transactions are submitted to the blockchain.

Leave a Comment

Your email address will not be published.