Deploying Blockchain Applications using Azure Blockchain Workbench — Exploring various possibilities

We started using Microsoft Workbench Blockchain to implement a sample POC application leveraging Blockchain technology. This article illustrates the complete workflow and the various possibilities that have been encountered during the process.

Setup Ethereum Proof-of Authority(POA) network on Azure

Proof-of-authority is a consensus protocol which is more suitable for permissioned networks where all consensus participants are known and reputable. Without the need for mining, Proof-of-authority is more efficient while still retaining Byzantine fault tolerance.

Refer to the following official microsoft documentation for deploying Ethereum POA Consortium on Azure.

https://docs.microsoft.com/en-us/azure/blockchain/templates/ethereum-poa-deployment

Once the deployment has completed, you’ll be able to access the following parameters through the Azure portal.

  • Ethereum RPC endpoint
  • Governance Dashboard URL
  • Azure Monitor URL
  • Data URL
  • VNet Gateway Resource ID (optional)

Please make a note of the Ethereum RPC endpoint as we will be using it for workbench configuration. A remote procedure call (RPC) is a interprocess communication technique that is used for point-to-point communications between software applications. Client and server applications communicate during this process.

Azure AD Configuration

The deployment of Azure Blockchain Workbench requires an Azure Active Directory (Azure AD) tenant to host the necessary Azure AD and Key Vault apps. Please follow the registration steps mentioned in the following article:

https://docs.microsoft.com/en-gb/azure/blockchain/workbench/deploy#azure-ad-configuration

Deploy Blockchain Workbench in Azure

One of the biggest challenges blockchain developers face is creating hardware nodes and deploying blockchain to these nodes. Azure Blockchain Workbench is a tool in the Azure Portal that automates the generation of all of the ‘scaffolding’ around a Dapp instance (like a POA Ethereum blockchain, off chain sql storage, message routing, and sample user interface) — thus reducing the amount of time it takes to create a functioning smart-contract POC around your business logic. The template allows users to pick the modules and components to deploy with Blockchain Workbench, such as blockchain stack, type of client application etc.

Once the Azure AD tenant is setup, follow the official workbench deployment instructions below:

https://docs.microsoft.com/en-us/azure/blockchain-workbench/blockchain-workbench-deploy

While deploying the workbench, make sure that you choose an existing blockchain network under the blockchain settings page.

When you choose “Create New”, it deploys a set of Ethereum PoA nodes within a single member’s subscription. This topology works great for situations where it’s ok to have one member manage all the blockchain nodes. When you choose “Use Existing”, customers will have the choice to deploy Workbench and point that deployment to an existing Ethereum PoA network. The topology of the network can be anything you want, including a multi-member blockchain network. The network can exist anywhere, which means the network can be even on another cloud. In case you want to choose “Create New”, you can skip the first step where we have created a custom Ethereum POA network.

Make sure that the Ethereum RPC Endpoint meet the following requirements.

The endpoint must be an Ethereum Proof-of-Authority (PoA) blockchain network.
The endpoint must be publicly accessible over the network.
The PoA blockchain network should be configured to have gas price set to zero.

In our case, you can input the Ethereum RPC Endpoint which we have noted after the deployment of Ethereum POA Consortium.

Once workbench deployment is completed successfully, you can see below resources.

You can access Azure Blockchain Workbench by navigating to its URL. The following steps show you how to retrieve the web URL of the deployed framework.

  1. There are two resources with type App Service. Select the resource of type App Service without the “-api” suffix.

2. In the App Service Essentials section, copy the URL value, which represents the web URL to your deployed Blockchain Workbench.

When you access the URL, you’ll see an Azure AD-backed login experience where you can enter your work or personal Microsoft account credentials to access the application. Once you’re authenticated, you will be redirected to Workbench dashboard to create blockchain applications that represent multi-party workflows defined by configuration and smart contract code. Once smart contract is instantiated in the workbench, the Administrator can assign users, deploy demo contracts and deploy custom contracts. Deployment of the blockchain application takes a few minutes. When deployment is finished, the new application is displayed in Applications.

Using REST API in Azure Workbench Blockchain

You can also create blockchain applications by using the Azure Blockchain Workbench REST API.

When making a request to the REST API, all URLs have the following base: https://{blockchain-workbench-api-subdomain}/api/v2

The {blockchain-workbench-api-subdomain} is the subdomain of the Blockchain Workbench REST API web service. The REST API web service is created when you deploy Blockchain Workbench. For example, if your Blockchain Workbench URL is https://myblockchain-h7ff.azurewebsites.net, your REST API subdomain is myblockchain-h7ff-api.azurewebsites.net

You can test REST API calls using Swagger UI. The Swagger UI for the Blockchain Workbench deployment is displayed.

URL: {WORKBENCH_URL}/swagger/ui/index.html

Here is a sample code for the Web App (.NET Core) which can be used to interact with the application using the REST API provided by azure workbench, instead of using the administration app provided by default after the creation of the azure workbench.

Conclusion

Microsoft Azure Blockchain Workbench is an excellent piece of engineering, and I admire its creators who want to help us implementing Blockchain on Microsoft Azure.