Recipe ID: hsts-r28
Hyperledger Fabric is an open source enterprise-grade platform that leverages a highly-modular and configurable architecture. Hyperledger Fabric is optimized for a broad range of industry use cases, including the finance, banking, healthcare, insurance, and public sectors, as well as supply chains and digital asset management.
For those who are not familiar with Hyperledger project Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem, Hyperledger Design Philosophy and Framework Architecture, The Survey of Hyperledger Fabric Architecture and Components for Blockchain Developers and Overview of Building Blockchain Smart Contracts in Hyperledger articles are strongly recommended.
We have written two sets of tutorials to explore Hyperledger Fabric in depth. First set covered the following six recipes:
It started with installing Hyperledger Fabric on an AWS EC2 virtual machine, setting up the first Hyperledger Fabric network and working with Hyperledger Fabric Command Line Interface or CLI. We learned the following:
We moved on to show you how to Add New Network to a Channel, Use CouchDB as a State Database for Hyperledger Fabric, and Create a Smart Contract and then Deploy it into the Blockchain.
In short, in the previous recipes, we learned about how to set up and configure Hyperledger Fabric. We explored its key components, including channels, Membership Service Providers (MSPs), the ordering service, and Fabric Certificate Authority (CA).
The second set, we will show you how to build a simple device asset management DApp. It consists of 6 recipes as follows:
In summary, in the second set of recipes, we are going to build a simple device asset management DApp. We will exploit this example by writing chaincode implemented by various programming languages and we'll also build, test, and deploy our DApp.
IMPORTANT: Understanding and completing the first set of recipes are required prior to working on second set of recipes.
In this recipe, we will review inventory asset management and chaincode.
Inventory Asset Management Overview
Blockchain technology is considered to be a game-changer for building an immutable, decentralized, trustless, and peer-to-peer ledger for business logic. Records in the blockchain are linked using cryptography. Each block contains a block timestamp, transaction data, and the previous block's cryptographic hash information.
IT asset management is an important part of an organization's strategy. It usually involves incorporating detailed IT assets and inventory information for business practices, such as hardware purchases and redistribution. Typical business practices include the request and approval process, procurement management, life cycle management, and so on.
Today, there are many participants in an asset's life cycle—from the manufacturer, the transporter, the IT service department, all the way to the end user—with each having their own management system. As a result, it's quite difficult to integrate all of these different bits of data to maintain a single version of the truth for the asset's entire life cycle.
By design, blockchain is a shared ledger technology. It is really good at registering, controlling, and transferring assets. Applying blockchain in an asset-tracking management system allows us to track digital transactions more securely and transparently. It provides new opportunities for organizations to correct problems within the asset management industry as it revolves around a single source of truth.
We will look at the processes involved in an IT asset management system. One of the main processes is tracking the complete life cycle of the assets. This includes ordering the asset, shipping the asset, receiving the asset, requesting a new asset, approving the asset, and then recycling and retiring the asset. Other record-tracking activities involve geographically locating the asset across the organization's various locations. This allows organizations to maintain the inventory better, to identify where the asset is currently located, and which asset is available at any time.
For the sake of our demonstration, we are going to simplify the entire process, as it can be very complex in a real-world scenario. In the following school IT-asset management system, we have defined three participants: the School Administrative Office (SAO), the original equipment manufacturer (OEM), and the end user, who is a student. In this scenario, the following occurs:
The overall process is shown in the following diagram:
In the next recipe, we will implement this flow using Fabric chaincode.
Writing Chaincode as a Smart Contract
Chaincode in Hyperledger Fabric is similar to smart contracts. It is a program that implements the business logic and is run on top of blockchain. The application can interact with the blockchain by invoking chaincode to manage the ledger state and keep the transaction record in the ledger. This chaincode needs to be installed on each endorsing peer node that runs in a secured Docker container. The Hyperledger Fabric chaincode can be programmed in Go, Node.js, and Java.
Every chaincode program must implement the Chaincode interface. In the next recipe, we will explore chaincode implementation using Go.
The following recipes are excellent resources for installing other Hyperledger tools:
Blockchain Developer Guide- How to Install and work with Hyperledger Sawtooth
Blockchain Hyperledger Composer Business Network Modeling and Environment Setup
Blockchain Developer Guide- How to Install Hyperledger Burrow on AWS
Blockchain Developer Guide- How to Install Hyperledger Iroha on AWS
Blockchain Developer Guide- How to Install Hyperledger Indy and Indy CLI on AWS
Blockchain Developer Guide- How to Install Hyperledger Seth and Docker on AWS
To conclude this recipe, we like to recommend our Blockchain Hyperledger Development in 30 hours course to those interested in pursuing a blockchain development career. Indeed, as of this writing, Hyperledger Foundation offers the following two Hyperledger certifications: The Certified Hyperledger Fabric Administrator (CHFA) and The Certified Hyperledger Sawtooth Administrator (CHSA), both of which are highly regarded in the industry. Hyperledger Foundation is in the process of creating Hyperledger Developer certification program, which may be released in early or middle of 2020. In short, by taking our hands-on online Hyperledger class, you would be able to obtain CHFA certification.
This recipe is written by Brian Wu who is our senior Hyperledger instructor in Washington DC. His Hyperledger Cookbook with 40+ hands-on recipes is highly recommended.
Hands-on Node.JS, MongoDB and Express.js Training
Learn Hands-on Blockchain Ethereum Development & Get Certified in 30 Hrs
Learn Blockchain Hyperledger Development & Get Certified in 30 Hrs
Become Blockchain Certified Security Architect in 30 hours
Blockchain Certified Solution Architect in 30 hours
Introduction to Python Programming
Object Oriented Programming with UML
We provide private tutoring classes online and offline (at our DC site or your preferred location) with custom curriculum for almost all of our classes for $50 per hour online or $75 per hour in DC. Give us a call or submit our private tutoring registration form to discuss your needs.