Hyperledger Fabric Architecture Part 1

In a previous article, you have learned that Hyperledger Fabric has a highly modular and configurable architecture.  In this article, we shall examine the architecture in more details.

Hyperledger Fabric Network

Hyperledger Fabric is a permissioned blockchain network that provides ledger services to application clients and administrators. It allows multiple organizations to collaborate as a consortium to form the network.  The permissions to join the network are determined by a set of policies that are agreed to by the consortium when the network is configured. The network policies may change over time subject to the agreement of the organizations in the consortium.

The Hyperledger Fabric network comprises the following components:

  • Ledger 
  • Peers
  • Ordering service
  • Chaincode (aka smart contract)
  • Channels
  • Membership service provider

The Hyperledger ecosystem also consists of the client applications that allow users to interact with the network.  Moreover, The Hyperledger Fabric application SDK provides a powerful API for developers to program applications to interact with the blockchain network on behalf of the users.  

Peers

The Fabric network is comprised primarily of a set of peers or nodes. Peers maintain the state of the network and a copy of the ledger. In addition,  they also host smart contracts(chaincode).

There are two different types of peers in Fabric, the endorsing peer and the committing peer. The endorsing peers (aka endorsers) simulate and endorse transactions. On the other hand, the committing peers (aka committers) verify endorsements and validate transactions before committing transactions to the blockchain. On a separate note, the endorsing peers can also commit transactions to the blockchain. Indeed, the endorsers are special kind of committers. However, the committers cannot be the endorsers.  All peers can commit blocks to the distributed ledger.

Ordering Service

The ordering service is  made up of a cluster of special nodes known as orderers. The ordering service accepts the endorsed transactions and specifies the order in which those transactions will be committed to the ledger.  However, It does not process transactions, smart contracts, or maintains the shared ledger. 

The Transaction workflow

Let’s examine the transaction workflow that involves the client applications, the peers and the orderers.  By examining the entire transaction workflow, we will learn how consensus is reached in the process.

The transaction flow to reach consensus consists of three phases:

  • Transaction endorsement
  • Ordering
  • Validation and commitment

Phase 1 Transaction Endorsement

Transactions begin with client applications sending transaction proposals to the endorsing peers, as shown in the following diagram:

Phase 2 Transactions Simulation

At this phase, the endorsers will simulate the proposed transactions, without actually updating the ledger.  The Endorsers must hold smart contracts in order to simulate the transaction proposals. In the simulation process, the endorsing peers will capture the set of Read and Written data, known as RW Sets.

These RW sets contain data that was read from the current world state while simulating the transaction, as well as data that would have been written to the world state had the transaction been executed. The endorsing peers then sign these RW sets and send them back to the client application for use in the next phase of the transaction flow, as shown below:

Phase 3 Ordering 

At this phase,  the client application submits the endorsed transactions and the RW sets to the ordering service. The ordering service will take the endorsed transactions and RW sets and orders them into a block and delivers the block to all committing peers.

The order of transactions needs to be established to ensure that the updates to the world state are valid when they are committed to the network. Unlike the Bitcoin blockchain or Ethereum, where ordering occurs through mining, Hyperledger Fabric allows the organizations to choose the ordering mechanism that best suits that network.

Hyperledger Fabric provides three ordering mechanisms i.e. SOLO, Kafka, and Simplified Byzantine Fault Tolerance (SBFT). However, SOLO is used only for experimentation purposes and SBFT has not yet been implemented. Therefore, Kafka is the default ordering mechanism for production use. The Kafka mechanism provides a crash fault-tolerant solution to ordering.

Phase 4 Transactions Validation

At this final phase, the committing peers validate the transactions by checking that the RW sets still match the current world state. In addition, they need to ensure that Read data that existed during the simulation process is identical to the current world state.

After the committing peers validated the transactions, the transactions are then written to the ledger, and the world state is updated with the Write data from the RW Set. Committing peers are responsible for adding blocks of transactions to the blockchain and updating the world state.  Lastly, the committing peers asynchronously notify the client application the results of the transactions.

I shall discuss channels, membership service provider and chaincode in another article.

Hyperledger Fabric- A Short Introduction

You have learned about Hyperledger in one of my previous articles. Hyperledger is not a platform but it is an umbrella body that incubates and promotes business blockchain technologies.

The Hyperlegder projects,  which is known as The Hyperledger Greenhouse consists of five projects, as follows:

  • Hyperledger Fabric
  • Hyperledger Sawtooth
  • Hyperledger Burrow
  • Hyperledger Iroha
  • Hyperledger Indy

I shall introduce Hyperledger Fabric in this article.

Hyperlegder Fabric Key Features

Hyperledger Fabric is the first blockchain project developed and hosted by the Linux Foundation.  It was initially contributed by Digital Asset and IBM, as a result of the first hackathon. According to the Linux Foundation , it was Intended as a foundation for developing DLT applications or solutions with a modular architecture.

Hyperledger Fabric is an open-source enterprise-grade permissioned distributed ledger technology (DLT) platform, designed for use in developing enterprise applications. It features some key differentiating capabilities over other popular distributed ledger or blockchain platforms.

One special feature of  Hyperledger Fabric is that it allows components, such as consensus and membership services, to be plug-and-play. Besides that, Hyperledger Fabric uses container technology to host smart contracts called chaincode that comprises the application logic of the system.

Channels are another unique feature of Hyperledger Fabric. They allow transactions to be private between two actors, while still being verified and committed to the blockchain.

Hyperledger Fabric Architecture

Hyperledger Fabric has a highly modular and configurable architecture. Therefore, enterprises can make use of its versatility to develop innovative business applications.  Besides that, it can be used to optimize the applications. Indeed, Hyperledger Fabric is well suited to develop a broad range of industry use cases including banking, finance, insurance, healthcare, human resources, supply chain and even digital music delivery.

Like Ethereum, Hyperledger Fabric also features smart contracts. However, it does not use Solidity as the programming language to code smart contracts. Hyperledger Fabric smart contracts are written in general-purpose programming languages such as Java, Go and Node.js. This means that most enterprises already have the skill set needed to develop smart contracts, therefore no additional training to learn a new language is needed.

Unlike Ethereum and many other public blockchains or DLT platforms, Hyperledger Fabric is a permissioned platform. It means the participants are known to each other, rather than anonymous and fully untrusted. In the Hyperledger Fabric ecosystem, while the participants may not fully trust one another, it can be operated under a governance model that is built with trust exist between participants, such as a legal agreement or framework for handling disputes.

Consensus Protocol

One key difference between Hyperledger Fabric and other DLT platforms is its support for pluggable consensus protocols. It enables the platform to be more effectively customized to fit particular use cases and trust models.

For example, when Hyperledger Fabric is implemented within a single enterprise or operated by a trusted authority, fully Byzantine fault tolerant consensus might be considered unnecessary as it might cause excessive drag on performance and throughput. Instead, a crash fault-tolerant (CFT) consensus protocol is more than adequate. However,  in a multi-party, decentralized platform, a more traditional Byzantine fault tolerant (BFT) consensus protocol might be required.

Another significant difference between Hyperledger Fabric and other DLT platforms is that it can implement consensus protocols that do not require a native cryptocurrency. It means it neither need a cryptocurrency to incentivize costly mining nor to fuel smart contract execution.  The avoidance of a cryptocurrency reduces some significant risk due to hacking via attack vector. Besides that, the absence of cryptographic mining operations means that the platform can be deployed with the same operational cost as other distributed platforms.

The combination of the aforementioned differentiating features makes Hyperledger Fabric one of the better performing DLT platforms available today both in terms of transaction processing and transaction confirmation latency. Besides that,  it enables privacy and confidentiality of transactions and the smart contracts (chaincode) that implement them.

I shall discuss the Hyperledger Fabric architecture and chaincode in more details in another article.

Creating a Self-Sustaining School Ecosystem with Blockchain

Abstract

The current school system is too structured, rigid, and inhibits creativity. The current school curriculum inadequately prepares the students to survive the fast-changing world of the 21st century. While schools need to comply with the national education policy to teach designated subjects, schools should include other programs that could help to resolve the aforementioned issue. Therefore, our school proposes building an ecosystem using blockchain technology where students can freely create and share their contents. We believe that the blockchain ecosystem will nurture young children in developing creative minds and entrepreneurial skills.

I have written this white paper for a hypothetical blockchain project. This blockchain project is to build a private blockchain ecosystem for an international school. 

First, we need to conduct a feasibility study before we start planning any blockchain project. Here, I am using a methodology called the CATWOE analysis. It can be applied to any new project.

CATWOE Analysis of  Building a Blockchain School

CATWOE is an acronym that stands for Customers – Actors – Transformation process – Worldview – Owners – Environmental constraints. It’s a simple analytical approach to find solutions to problems. The CATWOE Analysis makes it possible to identify problem areas, look at what an organization wants to achieve, and which solutions can influence the stakeholders. The analysis uses thought methodology from multiple perspectives. It is especially useful for an organization that wants to implement a new project that involves a drastic transformation process. The implementation of the blockchain technologies in a school curriculum qualifies for such transformation. Therefore, there is a need to understand the problems and try to find solutions before we proceed with the project implementation

C – Clients

They are the users and stakeholders of a system. In this case, they are the students, teachers, parents, the management staff, the education department, and others. They will benefit if the change is positive and the problems are solved. However, they may stand to lose or suffer if the change is negative and new problems are created. Therefore, we need to find out whether the blockchain technologies can solve current problems and bring positive changes in the school system. If the outcome could be negative or even damaging, we need to abort the project.

A-Actors

They are usually the employees within an organization, in this case, teachers and support staff. They are responsible for carrying out work and involved with the implementation of the blockchain system. Therefore, we need to conduct an inventory analysis to know their qualities, capabilities, and interests to get a clear picture of their impact on the organization. We may need to hire new employees or retrain the current ones to ensure competency with respect to blockchain implementation. We also need to conduct training for the employees.

T – Transformation Process

Transformation is the change that a system or process leads to. It’s the process in which input (including raw materials, man-hours, knowledge) is transformed by an organization into output (such as a final product or solution to a problem).

To implement the blockchain system, we need to know in advance what kinds of input requires and forecast what the end result (output) will be. Besides that,  we have to carefully consider the intermediate steps. In this case, the input is the blockchain technologies and the output could be a system that churns out an intelligent pool of young entrepreneurs that thrive on co-creating and co-sharing.

W – Worldview

Stakeholders often have different ideas and approaches to the same issue, with other conflicting interests. The goal of the CATWOE analysis is to make their different viewpoint explicit and try to achieve a methodology stand. In this project, we need to achieve consensus among the stakeholders that involve the students themselves, we don’t want to force the ideas on them. Besides that, some teachers might have fear in carrying out the transformation as they have to learn new technologies. Parents would be very concern about the implementation of the blockchain technologies because it will bring profound impacts on their children, either positively or negatively.

In addition, the government might want to regulate the project to ensure it complies with the national education policies and philosophies. On the other hand, business leaders may want to look for financial gains by sponsoring the project or they may refuse to support the project at all. Therefore, there is an urgent need to conduct surveys and research to figure out how to secure agreement from most stakeholders to implement the project.

O – Owners

This usually refers to the owner, entrepreneur or investor of an organisation, who wants to make changes and who decides whether a project should start or stop. As decision makers, they have the highest authorities.  Commitment and support from the aforementioned parties are important to ensure successful implementation of the blockchain project and also long term sustainability of the project.

E – Environmental Constraints

This is the actual environmental elements that may influence the organization and can limit or restrict the implementation of the blockchain technologies in the school system. Examples include political influence, ethical boundaries, regulations from the government, financial constraints and social factors. There is a need to work closely to overcome the constraints via negotiations and other means with the regulators and other parties

After conducted the CATWOE analysis, I have identified the following problems where most schools are facing.

Problems

  • The Current school system is too structured and too rigid, inhibiting creativity
  • The Curriculum methodology too centered on academics and examinations
  • Teacher-centered, lack of peer learning
  • The Administration is centralized and autocratic
  • Does not prepare children for the future
  • Lack of participation from stakeholders

The proposed solution

  • Create a self-perpetuating and self-sustaining ecosystem where students can create and share digital content. It can also include tangible things like arts and craft, scientific inventions, or intangible things like music, song, new ideas, games, and so on. These tangible assets can be digitized and shared among the students.
  • Not only they can share digital content, but they can also buy and sell them. It is akin to an autonomous economic system where students can self-fund their projects by trading their digital assets.
  • The latest technology that can power this system is blockchain, a subset of decentralized ledger technologies.
  • The ecosystem should be enlarged to include the actors of the system – the teachers, coaches, supporting staff and the administrators.
  • The ecosystem must also be connected to stakeholders, including the business owners (who can provide financial support and sponsorship), the government (who may want to regulate the activities in the system), parents (who are concerned with their children development), etc.
  • The ecosystem can be extended to include students from around the world in the future.

† The Architecture

  • Create a permissioned private blockchain platform for the students. The students can interact freely in their own close-loop decentralized and distributed ecosystem.
  • Content or assets can be created and tokenized and shared among the students. They can trade their assets using the tokens, creating a token economic system.
  • Develop APIs so that the stakeholders can interact with the blockchain. Administrators and teachers should be allowed to monitor and delete certain contents that are inappropriate like pornographic materials etc via the API. On the other hand, parents can monitor their children progress but may not be allowed to delete the contents or add comments. In addition, business owners and investors can monitor the progress of the project and provide support and advice if necessary (for example if the system crashed or stalled). In addition, regulators might want to monitor the blockchain for compliance.
  • Proposed using Ethereum Proof of Authority(PoA) protocol known as Clique. The benefits of using PoA are as follows:
    • Saves electricity power
    • Eliminates the need to invest into large numbers of ‘Miners’ servers
    • Increase the transaction speed tremendous compared to Proof-of-Work(PoW)
    • Better security since only members can access the network
  • The ecosystem can be hosted on a cloud server like AWS and Microsoft Azure but you can set up your own servers.  The conceptual model is illustrated in the figure below:

The Legal Framework

Obviously transforming a school into a blockchain school needs to obtain approval from the Ministry of Education. It has to comply with national education policies. Therefore, we need to design the blockchain platform as a new approach in teaching and learning, keeping content within the requirements of the curriculum imposed by the MOE.

**You may use my ideas to write a paper if you are embarking on a similar project, but prior consent from me is necessary.

Hyperledger- A Brief Introduction

Background

In previous articles, we have learned about the bitcoin blockchain, the flagship of cryptocurrency.  Subsequently, we learned about Ethereum that features smart contracts on top of its cryptocurrency Ether. Smart contracts allow developers to create decentralized applications (dapps) on the Ethereum ecosystem.

Both bitcoin and Ethereum are amazing blockchain platforms. However,  both are facing some very challenging issues, one of them is scalability.  According to Wikipedia,  the transaction processing capacity of the bitcoin network is limited by the average block creation time of 10 minutes and the block size limit.  The transaction rate for bitcoin is between 3.3 and 7 transactions per second.

Ethereum does not fare better, its transaction rate is 15 transactions per second. Comparatively, VISA’s transaction rate is 45,000 transactions per second. Therefore, both platforms fall short in developing practical enterprise applications at the moment.

To overcome the limitations of the blockchain technologies for enterprise usage, Hyperledger was created with the vision to provide viable blockchain solutions for industries and businesses. Hyperledger is an open source effort created to advance cross-industry blockchain technologies hosted by The Linux Foundation.

The Mission of Hyperledger

The philosophy of Hyperledger is

“Only an Open Source, collaborative software development approach can ensure the transparency, longevity, interoperability, and support required to bring blockchain technologies forward to mainstream commercial adoption.” –hyperledger.org


Indeed, the Hyperledger project has been a collaboration of players from various industries and organizations in technology, finance, banking, supply chain management, manufacturing, IoT and more. Since its inception in December 2015, it has managed to enlist many prominent members that include IBM, Intel, NEC, Cisco, J.P Morgan, AMN AMRO, ANZ Bank, Wells Fargo, Accenture, SAP and more. For the complete list, please refer to Wikipedia.

The mission of Hyperledger comprises some ambitious goals, as  illustrated in the following figure,

Adapted from Linux foundation

The Hyperledger Greenhouse

Hyperledger itself is not a platform, but it is an umbrella body that incubates and promotes a range of business blockchain technologies. The technologies include distributed ledger frameworks, smart contract engines, client libraries, graphical interfaces, utility libraries, and sample applications. The umbrella strategy was able to accelerate innovation of DLT components by encouraging the re-use of common building blocks and components(hyperledger.org, 2018).

The Hyperlegder projects known as The Hyperledger Greenhouse consists of five projects and five tools, as shown in the figure below:

Adapted from hyperledger.org

Each of the frameworks operates differently but they also allow certain interoperability among themselves. Hyperledger frameworks are generally permissioned (private)blockchains. It means that the parties need authentication and authorization to participate on the blockchain networks.

I will try to explain some of the frameworks and tools in simple language in a series of future articles. I am not an expert on Hyperledger but I have a decent understanding of the technologies via theories and practice. Recently I have enrolled in a Hyperledger course hosted by the Linux Foundation and managed to obtain a certificate of achievement. I am willing to share my knowledge with you.

Certificate  Link:  https://courses.edx.org/certificates/893fe1d735404398b56460873940ca5d

Open Source and Open Governance

The success of Hyperledger is based on the concepts of open source and open governance.  The concept of open source means that an open source software is a software that is made freely available and may be redistributed and modified. In other words, anyone has the ability to view the code, use the code, copy the code, modify the code, and, depending on the open source license, contribute back changes. (hyperledger.org, 2018)

On the other hand, open governance means that technical decisions for an open source project are made by a group of community-elected developers voted in from a pool of active participants. These decisions include things such as which features to add, how, and when to add them.  (hyperledger.org, 2018).  Hyperledger has formed a  Technical Steering Committee(TSC) to implement open governance pertaining to the Hyperledger projects. You can read about Hyperledger’s open governance by following this link

https://www.hyperledger.org/blog/2017/09/06/abcs-of-open-governance

That’s all for now. I will discuss why Hyperledger blockchain frameworks are better designed for enterprises than the public permissionless blockchains in coming articles.

Meanwhile, you may want to register for the Hyperledger Global Forum in Basel, Switzerland in December. I have registered but not sure of going yet as there is an issue with the credit card payment. By the way, there are no free tickets. It is a four days workshop with hands-on practices. 

Tokenization Explained

What is Tokenization?

Tokenization has become a buzzword today due to its adoption in the payment industry and blockchain. However, Its usage is not limited to the aforementioned industries. It can be applied to many other industries such as healthcare, stock trading, gaming and more.

The primary purpose of tokenization is to ensure data security. It is used for handling sensitive data such as payment, medical record, personal ID and more.

According to Wikipedia,

“Tokenization, when applied to data security, is the process of substituting a sensitive data element with a non-sensitive equivalent, referred to as a token, that has no extrinsic or exploitable meaning or value. The token is a reference (i.e. identifier) that maps back to the sensitive data through a tokenization system. The mapping from original data to a token uses methods which render tokens infeasible to reverse in the absence of the tokenization system, for example using tokens created from random numbers.

The tokenization system must be secured and validated using security best practices applicable to sensitive data protection, secure storage, audit, authentication and authorization. The tokenization system provides data processing applications with the authority and interfaces to request tokens, or detokenize back to sensitive data.”

In short, Tokenization is the process of substituting sensitive data with non-sensitive identification symbols known as tokens. Tokenization retains all the essential information of the data without compromising its security.

A Short History

According to Wikipedia, the concept of tokenization has existed since the invention of the currency system centuries ago. It was adopted as a means to reduce risk in handling financial instruments by replacing them with surrogate equivalents.

In addition, coin tokens have a long history of use replacing the financial instrument of minted coins and banknotes. In more recent history, tokens are used in mass rapid transit payment, casino chips and more.  The adoption of the above systems is to replace physical currency and cash for reducing risks such as theft.

In the digital world, tokenization techniques have been used since the 1970s. They were meant to isolate real data elements from exposure to other data systems(Wikipedia, 2018). In databases, surrogate key values have been used since 1976 to isolate data associated with the internal mechanisms of databases and their external equivalents for a variety of uses in data processing.

More recently, these concepts have been extended to consider this isolation tactic to provide a security mechanism for the purposes of data protection. For example, in the payment card industry, tokenization is one means of protecting sensitive cardholder data in order to comply with industry standards and government regulations.

Definition in Blockchain

In blockchain, tokenization is a method that converts rights to an asset into a digital token. Thus, we can take an asset, tokenize it and create its digital representation that lives on Blockchain. Blockchain guarantees that the ownership information is immutable.  The tokens created in this way is also known as crypto tokens.

For example, you can tokenize an asset such as a book that you authored. The book is kept somewhere while the book token is uploaded to the blockchain network. The book crypto token is a representation of the book ownership. You can specify how many tokens need to be transferred to your crypto wallet before you can transfer the book ownership to a buyer by means of a smart contract.

One of the actual use cases is https://stamp.io , a platform where you can store your tokenized documents on the block and certify it, as shown in the following figure:

Cryptokitties is a brilliant example of the crypto token that allows users to acquire an adorable collectible by transferring some cryptocurrencies to the owner. The owner will then transfer the digital collectible to the buyer. The transaction occurs automatically via the smart contract.

Another use case is we can create a crypto token that represents some customer loyalty points on a blockchain. This type of token is also known as utility token. It can be used to manage customers’ reward schemes for the retail chains. Other examples include the crypto token that gives entitlement to the token holder to view certain hours of video streaming on a video-sharing blockchain. A house owner can sell his house by transferring the tokenized house deed to the buyer. Last but not least, a crypto token may even represent another cryptocurrency.