Configuring a Supply Chain demo app with Strato in Azure

Originally written in 2018, here:

*The STRATO tool suite in Azure allows developers to speed up the various processes and workflows associated with developing decentralized applications. For more information, see: *https://azure.microsoft.com/en-us/blog/blockapps-strato-smd-upgrade/

Getting Started

The Marketplace in Azure Government contains a Resource Template for developers to generate a production environment for a simple, turn-key way to develop, manage and enable enterprise-capable Blockchain applications. Azure Government uses the same underlying technologies as commercial Azure, enabling you to use the development tools you’re already familiar with.

This quickstart guide will help you get started implementing an Ethereum Consortium blockchain network on Azure Government. Developers also have the option to create Hyperledger Fabric, Quorum, and Corda blockchain networks. Quickstart guides for these platforms will also be posted.

Prerequisites

Before configuring the sample, you must have the following:

Background on BlockApps

This Azure Government Marketplace template offering generates all of the necessary compute, storage, and networking components to create a private ethereum network on which you can form a shared global ledger state and deploy smart contracts and transactions amongst participating members.

…

Install the STRATO single node offer in Azure

To start the demo, the user must configure a STRATO blockchain Singlenode — Developer Edition resource.

  • Navigate to the Azure Portal in a web browser
  • Click the ‘+’ button in the upper left hand corner to create a new resource
  • Search the Marketplace for ‘STRATO Blockchain Singlenode — Developer Edition’
  • Click the resource, and hit ‘create’ in the pull-out blade

Once selected, it is time to configure the network topology and basic settings. The Template Deployment will walk you through configuring the network. The deployment flow is ordered into three blades: Basics, Network configuration, and Ethereum configuration.

1. Under the first blade, ‘Basics’:

  • Specify values for Resource prefix, VM username, and Authentication type (using a password — or SSH pubkey for greater security).
  • For Resource group, use the one configured at the start of the guide, or select ‘Create new’ and specify the value for the parameter name.
  • For Location, select the geographical location in which you wish to host your virtual machines and network to be hosted.

2. Under the ‘**Virtual Machine size and performance’ **blade:

  • Select the Storage Performance and Virtual Machine size.
  • For this demo, the default configuration options should be fine.

3. Under the ‘STRATO Settings’ blade:

  • The admin password setting will be used secure the STRATO account

4. In the next blade, you will see a summary of the inputs specified. Hit ‘OK’ to move on to the final blade

5. Select ‘Create’ to deploy STRATO node. The resources may take a few minutes to finish deployment.

  • Once the resources have been deployed, we will receive a notification and should navigate to the resource group blade for our recent deployment.
  • After navigating to the resource group , select the ‘Public IP address’ resource (highlighted).
  • Copy the listed IP address, and paste it into a tab in the browser
  • here should be a pop-up asking for username/password
  • The username is ‘admin’
  • The password is the value which you provisioned previously in the template
  • If successful, you should will taken to the STRATO Management Dashboard portal

Create a User Account

In the STRATO Management Dashboard, click on accounts

Next, click on ‘Create User’ on the upper right-hand corner of the screen

  • Make the username ‘test’
  • Fill in a value for the password
  • To fund the new user account, hit the blue ‘faucet’ button on the left side of the account row.

Deploy a test contract

Navigate to the Contracts tab, and try deploying a sample contract to the newly funded node (see Ethereum Quickstart guide for a test contract).

Install an UBUNTU 16.04 LTS VM

  • Navigate back to the Azure Portal and search for Ubuntu Server 16.04 LTS VM
  • Configure the various VM settings under the basics blade
  • Make sure that you put the VM in the same resource group that you deployed the Strato Singlenode template into
  • Complete the next two blades with the default config settings
  • Install the VM

SSH into the VM

Navigate to the newly deployed virtual machine by looking for it in your resource group

  • After opening it, click the connect button (as shown) this will give you an ssh command that you can use from a terminal to connect to the vm
  • We will eventually need two Terminal windows (one to run the API, another to run the app itself), so make sure you ssh into the VM twice

Now that we have connected to the VM via SSH, Run these series of commands:

$ sudo apt-get update
  • This updates the virtual machine
$ curl -sL https://deb/.nodesource.com/setup_8.x | sudo bash
  • This pulls the Node.JS volume 8 package
$ sudo apt-get install nodejs
  • This installs the Node.JS volume 8 package
$ sudo apt-get install build-essential$ Sudo apt-get install npm

Next, clone this repo:

$ git clone https://github.com/blockapps/blockapps-ba.git
  • This is a public repo for BlockApps SupplyChain demo app– this includes the source, JavaScript, etc. that install the application

Now that we have cloned the demo app, we need to install the dependencies and configure the server.

Navigate to the blockapps directory:

$ ls$ cd blocksapps-ba$ npm install$ cd ui$ npm install$ cd ..$ Cd server/config
  • Use a text editor to edit the config file (i.e. Vim, nano, etc.)
$ nano 192.config.yaml
  • Update the ‘nodes’ section to reflect the public IP of your strato Public IP Address (copied in previous section)
  • Update the IP addresses for ‘explorerUrl’, ‘stratoUrl’, ‘blocUrl’, and ‘searchUrl’

Once you are done, save the config file and navigate back to root directory. Next, Run:

$ cd ..$ cd ..

Bootstrap the Backend

To start the bootstrap the backend for the BA Supply Chain application, enter:

$ SERVER=192 npm run deploy

Now, if we navigate back to the STRATO Management dashboard and look at the accounts — we find that the personas (admins, buyers, suppliers, etc.) have been generated. By navigating to the contracts tab, we find that a series of contracts (AdminInterface, ProjectManager, etc.) have been generated.

Now that the backend has been deployed, we just need to start it up. To do this, navigate back to the terminal and run:

$ npm run start
  • This should return with a bunch of information and end with ‘listening on port 3031’

Open up the ports

  • Navigate to your Ubuntu VM in the Azure Portal
  • Hit Settings -> ‘Networking’->’Add inbound Port Rule’
  • Add IP Ports 3030 (for the App UI) and 3031 (for the API)
  • All the ports on the Strato node are preconfigured by default

Point the Ubuntu Box toward the API

  • Grab the public IP of the Ubuntu box

Open a new putty session, run:

$ cd blockcapps-ba/ui$ API_URL=http://<public-ip_of_ubuntu_VM>:3031 npm run start

Navigate to the application

To navigate to the application, enter the public ip of the ubunut VM with port 3031 into the URL in the browser.

http://<public-ip_of_ubuntu_VM>:3031

This should bring us to the login for our application, enter the username ‘Buyer1’ and password ‘1234’ (as configured in the Server config file). Once we log in, we can enter a request for a new project and allow suppliers to bid on it. See the screen below for an example project.

If we now log out, and log back in as a supplier (username: Supplier1, password: 1234). We can see the open projects we can bid on.

We can bid on the project by entering a bid as the supplier. Let’s enter a bid of $400 for the test shipment.

If we log back in as the buyer, we can accept or deny the bid. Hopefully this gives us a great example of what a sample app using a Supply chain running on the blockchain might look like. Using this example application, we can easily visualize all of the contract data in the Strato Management dashboard without having to use geth, etc.

Subscribe to Kevin Leffew
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.