Blog Posts Process Management

Blockchain Made Simple: No-Code Apps with Hyperledger Fabric and Joget

Blog: Joget Unplugged

1. Introduction

Joget is an open source low-code/no-code application platform for faster, simpler digital transformation. In this article, we will look at using a no-code approach to integrating blockchain technology, specifically a Hyperledger Fabric network, into a full-fledged web application.

1.1 Blockchain and Digital Ledger Technology (DLT)

In recent times there have been many predictions on blockchain technology revolutionizing the world, transforming everything from banking to supply chains and even government. Even if you are not familiar with the term, you would probably have heard of the rise of cryptocurrency like Bitcoin which utilizes blockchain technology. So what exactly is a blockchain?

To start, it’s best to understand a broader term called digital ledger technology (DLT). DLT is simply a decentralized database, where data is stored by a network of computers with no central authority. Blockchain is a specific type of DLT, where records in the network are linked using cryptography and cannot be changed. This lends itself to solving problems where there are issues with trust and inefficiencies due to centralized authorities.

There are many blockchain implementations, which are broadly categorized as either permissionless or permissioned. Permissionless blockchain networks are essentially public so anyone can participate, while permissioned ones are for restricted private use. Permissionless networks work well for public areas such as cryptocurrencies, but in an enterprise environment and in many industries, private networks are essential.

Enterprise blockchain networks might typically span across multiple organizations across an entire industry. With the need for permissioned private networks and participation by multiple organizations, how would a blockchain solution gain enough adoption to succeed? This is where Hyperledger comes in.

1.2 Hyperledger and Hyperledger Fabric

Hyperledger is a not a company, nor a specific product, but rather an umbrella of open source blockchain projects for enterprise use cases. Hosted by the Linux Foundation with more than 250 participating organizations, the projects are divided into frameworks and tools. Frameworks are different implementations of blockchain technology, each of which has different strengths for different use cases. Tools, on the other hand, are utilities to help manage or complement the frameworks. 

The most popular and mature framework currently is Hyperledger Fabric. Originally contributed by IBM, Fabric is emerging as the de-facto standard for enterprise blockchain platforms, with commercial implementations and support from major vendors including IBM, Oracle and SAP.

1.3 Hyperledger Fabric Concepts

If you are new to blockchain technology, there are quite of lot concepts to learn and understand. For the purpose of this sample app, here are some of the more important terms that are used to configure the blockchain integration.

  • Blockchain ledger is a journal of all transactions and data that are stored in a distributed network.
  • Peer nodes are the network components where copies of the blockchain ledger are hosted.
  • Members are organizations that are part of the blockchain network
  • Certificate Authority (CA) issues certificates to identify users that belong to an organization.
  • Membership Services Provider (MSP) maps certificates to member organizations.
  • Transactions are requests to read or write data into the ledger
  • Ordering service are nodes that orders transactions into a block to be written into the ledger
  • Channels are private communication mechanisms to keep confidentiality between members in the network.
  • Smart contracts (called chaincode in Fabric) are code within the blockchain network that are invoked to query or update the ledger

The diagram provided by the Hyperledger Fabric project below shows how an application integrates with a blockchain network via smart contracts:

More details are available in the Hyperledger Fabric documentation.

2. Overview of the App

To demonstrate the incorporation of blockchain technology in an app, let’s design a Joget app that makes use of the sample Fabcar network provided by Hyperledger Fabric. The Fabcar sample is basically a minimal stripped-down Fabric network for learning purposes.

To demonstrate reading from and writing to the blockchain network, the app supports the following use cases:

  • Query and list of all records from the blockchain network
  • Query and view a specific record from the blockchain network
  • Write a new record into the blockchain network after an approval process

With Joget, the blockchain app can be developed without coding. A form is visually designed, after which the App Generator is used to quickly create a full working app. The integration to the Hyperledger Fabric blockchain network is then accomplished by simply configuring a set of Joget Hyperledger Fabric plugins.

To install and try out the final working app:

  1. Ensure that a Hyperledger Fabric sample Fabcar network is up and running.
  2. Ensure that an instance of Joget Enterprise Edition is up and running.
  3. Download the Hyperledger Fabric Plugins JAR file, and upload the downloaded jar file through Manage Plugins under System Settings.
  4. Download the Joget jwa app and import it.
  5. Configure the fabric_host environment variable to point to the appropriate IP/hostname.
  6. Publish the app and access it from the App Center.

Here are some screenshots of the app in action:


Welcome: Home page



Fabcar Listing: List of all records from the blockchain network



Fabcar Form: View specific record from the blockchain network



Approval Process: Approve a creation of a new record


The next few sections provide more detailed information to setup the sample Hyperledger Fabric network, as well as to develop and configure the app.

3. Install and Setup a Hyperledger Fabric Network

To begin, install Hyperledger Fabric v1.3 and the Fabcar Network Sample.

The summarized installation steps below were tested on Ubuntu 18.04.

Install cURL:
sudo apt install -y curl

Install Docker and Docker Compose (logout and login after the usermod command):

sudo apt install -y docker.io
sudo apt install -y docker-compose
sudo usermod -aG docker $USER
# logout and login after the usermod command

Install Go:

sudo apt install -y golang

Install NodeJS:

sudo apt install -y nodejs
sudo apt install -y npm

3.2 Install Hyperledger Fabric Samples, Binaries and Docker Images

(https://hyperledger-fabric.readthedocs.io/en/release-1.3/install.html)

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-1.3/scripts/bootstrap.sh | bash -s 1.3.0

3.3 Setup Sample Fabcar Network

(https://hyperledger-fabric.readthedocs.io/en/release-1.3/write_first_app.html)

cd fabric-samples/fabcar
npm install
./startFabric.sh
node enrollAdmin.js
node registerUser.js
node query.js

Upon successful installation and execution of the last command, you should receive the query response from the blockchain network i.e.

Query has completed, checking results

Response is [{“Key”:”CAR0″, “Record”:{“colour”:”blue”,”make”:”Toyota”,”model”:”Prius”,”owner”:”Tomoko”}},{“Key”:”CAR1″, “Record”:{“colour”:”red”,”make”:”Ford”,”model”:”Mustang”,”owner”:”Brad”}},{“Key”:”CAR2″, “Record”:{“colour”:”green”,”make”:”Hyundai”,”model”:”Tucson”,”owner”:”Jin Soo”}},{“Key”:”CAR3″, “Record”:{“colour”:”yellow”,”make”:”Volkswagen”,”model”:”Passat”,”owner”:”Max”}},{“Key”:”CAR4″, “Record”:{“colour”:”black”,”make”:”Tesla”,”model”:”S”,”owner”:”Adriana”}},{“Key”:”CAR5″, “Record”:{“colour”:”purple”,”make”:”Peugeot”,”model”:”205″,”owner”:”Michel”}},{“Key”:”CAR6″, “Record”:{“colour”:”white”,”make”:”Chery”,”model”:”S22L”,”owner”:”Aarav”}},{“Key”:”CAR7″, “Record”:{“colour”:”violet”,”make”:”Fiat”,”model”:”Punto”,”owner”:”Pari”}},{“Key”:”CAR8″, “Record”:{“colour”:”indigo”,”make”:”Tata”,”model”:”Nano”,”owner”:”Valeria”}},{“Key”:”CAR9″, “Record”:{“colour”:”brown”,”make”:”Holden”,”model”:”Barina”,”owner”:”Shotaro”}}]

4. Design Joget App

Now that you have gotten the Fabcar network up and running, let’s start designing the Joget app that will query and update the records in the blockchain ledger. The Joget platform provides a modular dynamic plugin architecture to extend functionality. In this case, we will be using a set of Hyperledger Fabric plugins with Joget Enterprise Edition.

4.1 Design New App

The first step is to design a new Joget app. In the Joget App Center, login as an administrator and click on the Design New App button. Key in the relevant details e.g.

  • App ID: fabcar
  • App Name: Hyperledger Fabric Fabcar Sample

4.2 Design Fabcar Form

Using the Joget Form Builder, design a form with fields matching the properties in a Fabcar record.

In this case create text fields with IDs that match a Fabcar record

  • Key
  • make 
  • model
  • colour
  • owner

Click on the Save button to save the form.

4.3 Use App Generator to Create App

Once the form has been saved, click on the Generate App button to use the App Generator. Check the options for Generate Datalist, Generate CRUD and Generate Process – Approval Process, then Generate.

NOTE: The App Generator is a Joget Enterprise Edition feature, but you can manually create the list, process and UI in the Community Edition as well.

5. Configure Joget Hyperledger Fabric Plugins

At this point, a full app to manage records, along with an approval process to create a new record has been created. These records are in the internal Joget database though, so now we will start configuring Hyperledger Fabric Plugins to directly integrate with the blockchain network.

5.1 Upload Joget Hyperledger Fabric Plugins

Download the Hyperledger Fabric Plugins JAR file, and upload the downloaded jar file through Manage Plugins under System Settings.

5.2 Configure List to Query Hyperledger Fabric Ledger

In the app, enable the Quick Edit Mode so that you can view the editable elements. Browse to the Fabcar Listing and click on the quick edit link for the List to open the Datalist Builder.

Switch to the Source tab, select the Hyperledger Fabric Datalist Binder then click on Next. In the plugin configuration, key in the relevant details.

The values shown here are suitable for the default Fabcar sample network, but change the fabric_host to the correct hostname or IP in your environment:

Hyperledger Fabric User
Property
Value
User ID
hfuser
Affiliation
org1
Membership Service Provider (MSP ID)
Org1MSP
User Enrollment
Register New User
Certificate Authority
http://fabric_host:7054
Admin ID
admin
Admin Secret
adminpw
Channel
Property
Value
Peer Name
peer0.org1.example.com
Peer URL
grpc://fabric_host:7051
Orderer Name
orderer.example.com
Orderer URL
grpc://fabric_host:7050
Channel Name
mychannel
Transaction
Property
Value
Chaincode ID
fabcar
Function Name
queryAllCars
JSON Response Primary Key Property
Key
JSON Response Contains Nested Property
true
Base Nested Property Name
Record


If the configuration is correct, the Design tab will display the appropriate Fabcar columns to be used in the datalist. Add the columns to be displayed as required, then Save.

5.3 Configure Form to View Hyperledger Fabric Ledger Record

In the Fabcar Listing and click on View on a record. Click on the Fabcar Form quick edit link to open the Form Builder.

Switch to the Properties tab, select the Hyperledger Fabric Form Binder as the Load Binder then click on Next.

In the plugin configuration, key in the relevant details. The Hyperledger Fabric User and Channel values are similar to the configuration used for the datalist binder earlier.

Transaction
Property
Value
Chaincode ID
fabcar
Function Name
queryCar
Function Arguments
#requestParam.id#
JSON Response Contains Nested Property
true
Base Nested Property Name
Record


Note: #requestParam.id# is a request parameter hash variable to represent the id parameter in the URL.

Click on Save.

5.4 Configure Process to Update Hyperledger Fabric Ledger

In the Design App > Processes screen, click on Design Process to launch the Process Builder.

In the transition where the status is “Approved”, add a Tool called Invoke Fabric Transaction.

In the Map Tools to Plugins page, select the Hyperledger Fabric Tool for that Tool. In the plugin configuration, key in the relevant details. The Hyperledger Fabric User and Channel values are similar to the configuration used for the datalist binder earlier.

Transaction
Property
Value
Chaincode ID
fabcar
Function Name
updateCar
Function Arguments
#form.fabcar.Key#
#form.fabcar.make#
#form.fabcar.model#
#form.fabcar.colour#
#form.fabcar.owner#
Transaction Type
Update


Note: #form.fabcar.field# is a form hash variable that represents the form field value.

6. What’s Next

This example serves to demonstrate the simplicity of building a blockchain app using the Joget platform without coding.

Download the app and plugin for this sample, and get started with Hyperledger Fabric and Joget.

To get started on the digital transformation journey with Joget:

Leave a Comment

Get the BPI Web Feed

Using the HTML code below, you can display this Business Process Incubator page content with the current filter and sorting inside your web site for FREE.

Copy/Paste this code in your website html code:

<iframe src="https://www.businessprocessincubator.com/content/blockchain-made-simple-no-code-apps-with-hyperledger-fabric-and-joget/?feed=html" frameborder="0" scrolling="auto" width="100%" height="700">

Customizing your BPI Web Feed

You can click on the Get the BPI Web Feed link on any of our page to create the best possible feed for your site. Here are a few tips to customize your BPI Web Feed.

Customizing the Content Filter
On any page, you can add filter criteria using the MORE FILTERS interface:

Customizing the Content Filter

Customizing the Content Sorting
Clicking on the sorting options will also change the way your BPI Web Feed will be ordered on your site:

Get the BPI Web Feed

Some integration examples

BPMN.org

XPDL.org

×