Hyperledger Fabric

How it Works, Made Easy

Hyperledger Fabric is becoming the most popular blockchain framework used by enterprises and medium-sized companies. Due to its flexibility and power, however, it can be difficult to understand. In this article we will be looking at its components and parts, and provide a gentle guide to getting started.

A Blockchain Primer

Before we delve into the good stuff, it is essential to understand what blockchain is, why it's important, and how it works. These are the first steps for getting into the world of blockchain and the frameworks which allow you to build on top of it.

Blockchain is a technology that allows for a distributed ledger that keeps track of all changes, or transactions that occur within a network. This ledger is decentralized and is hosted on every system that is a part of it (members of the system are known as nodes or peers), rather than one isolated server.

A blockchain network also uses a software module called a smart contract (also referred to as chaincode within Fabric), that allows for controlling access to the distributed ledger, automating processes, controlling aspects of transactions, and executing certain actions if defined conditions are met. Changes or transactions that take place within the network are ratified or rejected via consensus between all the members of a network. Once ratified, a transaction is then recorded to the ledger. Data or transactions occurring within the network and entered into the ledger get encrypted, stored into a block, and then become non-modifiable (or immutable).

For a more detailed overview of what blockchain is, how it works and why it is an incredibly revolutionary technology, please check out this article.

What is Hyperledger Fabric?

Hyperledger Fabric is a private blockchain framework and is one of many projects within the Hyperledger blockchain platform. The framework is used as a foundation from which to develop blockchain-based applications, networks, and more. Fabric (as it is often shortened to) was designed for creating private blockchains that can be used within a single organization or group of aligned organizations that link to other blockchain implementations. Fabric prioritizes several key features as part of its architecture:

  • Privacy: Fabric requires all computers within its network to be identified; the prospective members of a Fabric supported network must join and identify themselves via a Membership Service Provider (MSP). This is what is called a "permissioned" membership. Maintaining the privacy of data is essential to many industries and this aspect alone makes Fabric an attractive option. It is important to note that Fabric does not require all parts of a blockchain to be permissioned; the necessity for permissions is decided at the discretion of whoever designs the network.
  • Channels: Fabric provides the ability to partition ledgers into “channels,” where members of the network may create a separate set of transactions that are not visible to the larger network. This allows for more sensitive data to be segregated from nodes who do not require access.
  • Scalability: Another appealing characteristic of Fabric for larger enterprises is the immensely scalable network that Fabric provides. Like other implementations, the number of nodes participating in the network can quickly scale; but the system is capable of still processing large amounts of data with a smaller set of resources. This allows for a best of both worlds approach. The blockchain can be created with a small set of nodes, and scale on demand.
  • Modularity: Fabric’s architecture is designed to allow separate components to be added and implemented at different times. Many of the components are optional, and can be omitted completely or introduced later without affecting functionality. This feature is intended to give a company power over what is and is not necessary to implement. Some of the components that are considered modular, or "plug-and-play", include the method of achieving consensus, membership services for identification, the ledger store itself, specific access APIs, and chaincode integration.

With the aim of developing an incredibly scalable, permissioned, and secure framework powered by blockchain’s distributed ledger technology, Hyperledger Fabric is poised to take the world of corporate networks by storm. Fabric is already finding itself at the center of some incredible industry projects.

What Hyperledger Fabric is Not

With some idea of what Fabric provides, it's also important to understand what Fabric is not. Hyperledger Fabric is a block chain framework. It works together with other Hyperledger projects such as Burrow and Sawtooth to provide a scalable data platform. Hyperledger Fabric is a platform on which applications may be developed. Other members of the ecosystem, such as Composer, Quilt, and Explorer consume data from Fabric networks.

Hyperledger Platforms

  • Hyperledger Burrow: A modular client designed to function as permisssioned Ethereum smart contract interpreter as a node on a blockchain. Burrow executes smart contract code on a Ethereum Virtual Machine. Burrow is not considered a fix-all, or highly pluggable.
  • Hyperledger Sawtooth: This modular Hyperledger platform is designed for creating, and deploying blockchains; it is also a platform for coding applications to interact with the blockchain. It also supports a number of different, pluggable approaches to reaching consensus.

Together (or apart), the platforms of Burrow, Sawtooth, and Fabric are either clients, or were created to advance the designing, implementation, and deployment of clients, applications, and blockchain solutions.

Hyperledger Tools

  • Hyperledger Composer: Composer was a collection of tools for constructing the actual blockchain network used by Hyperledger platforms (primarily Fabric). Since August 2019, Composer has been phased out of use, and the functionality provided by Composer has been folded into Fabric itself.
  • Hyperledger Quilt: Quilt is a Hyperledger tool that is meant to facilitate transfer of transactions between different blockchain networks, and even between blockchains and non-distributed networks. This is made possible by using the Interledger protocol.
  • Hyperledger Explorer: This tool was developed primarily for accessing every bit of information within a blockchain network; the querying of blocks, accessing transactional data, members and respective nodes, info about the network itself, and just about everything that is part of that specific blockchain.

In this sense, it becomes easier to see the total role of Fabric within a blockchain networks' functionality. Whereas Fabric is a platform that allows for the definition, acceptance, and construction of data, the tools under the project of Hyperledger are geared toward accessing and consuming the data of a blockchain.

A Note on Hyperledger and Cryptocurrency

A central facet of Hyperledger is that as a project, Hyperledger is not a cryptocurrency. It does not use cryptocurrency in any form and was purposefully designed this way. Hyperledger is developed simply for advancing the technology of blockchain and providing a robust implementation of a highly scalable data storage technology. Fabric, of course, is merely a blockchain framework under the umbrella project.

It is important to keep in mind that blockchain provides just the foundation for an immutable database with a distributed ledger, and in turn for a decentralized form of currency to be developed as well. Blockchain itself is not Bitcoin or cryptocurrency in general. Hyperledger Fabric takes the foundation of blockchain and provides a framework on top of it, utilizing its qualities as a network. I this context, Cryptocurrency is a specific application of the technology, rather than the primary motivation.

Understanding that Hyperledger does not rely on a "proof of work" system that involves bitcoin mining, and by circumventing a reliance on any form of crypto (unlike blockchain frameworks under Ethereum), Fabric is more attractive to enterprises looking to adopt a new form of business-to-business transaction networking rather than a whole new currency.

Fabric Smart Contracts (Chaincode)

Smart contracts (frequently referred to within Hyperledger Fabric as chaincode), along with the ledger, are the most vital aspects of a Fabric network. In blockchain, smart contracts take on the role of lawyers, helping to trade money, goods, or whatever other assets are represented within the network. These contracts may set prices, lay out rules, outline agreements, and even delegate actions to be done when certain requirements are met. These can be limitless and as simple as paying a certain amount, getting a refund if goods aren't delivered, or giving digital receipts. These contracts take place within a blockchain as executable code.

These smart contracts take on a more familiar role within Fabric, acting as the literal contracts agreed upon between two professional entities when making a trade. Having smart contracts significantly simplifies the process of trading by automating processes and handling exchanges of payment. While the smart contract code handles executing all of the above, the chaincode is what deploys the smart contract into the network, so although they are developed together they tend to do different things.

Smart Contracts Simplified
A smart contract acts not only as overseer of a transaction, but enacts conditions as well.
blockgeeks.com

Hyperledger Fabric Components

Like all blockchain-based technologies or platforms, Hyperledger Fabric is built upon a few central components:

  • a distributed ledger for all data recorded about the transactions
  • multiple peers (or nodes)
  • smart contracts that maintain transaction logic

Also like most blockchain networks, transactions must be ratified by a consensus of all nodes entered to the ledger. In Fabric, this is referred to as an endorsement.

Peers (or Nodes)

Organizations and members are represented by peers themselves. Peers play an integral role within a blockchain network -- that is, they host instances of ledgers and smart contracts. In this way, peers are most vital in a Fabric blockchain when relating to transactions or the transaction workflow.

When a transaction is to take place the transaction must first be validated by a majority of the members of a network (represented as endorser peers), or a channel within a network. This process is called consensus. If you're a bit confused, don't worry - this complicated procedure is explained in depth later in the article.

In addition to consensus, peers take on additional roles within the transaction workflow. Within a channel they act as components, and provide infrastructure for the movement and processing of data. Some examples of these roles include:

  • Orderer Peers - The peers (or nodes) that are specially designated as orderers, ensure that all the peers within a channel have the same updated ledger. In this sense, orderer peers ensure consistency of data and protect integrity of the ledger. Orderers also construct the blocks after the endorsement of a transaction and enter the record into them. The orderer peers, which are collectively known as the ordering service when working in cohesion, then mail out the new blocks to each peer within a channel to update their respective ledgers. The ordering service is a modular component. It is important to acknowledge that there are several methods for implementing this ordering service within a Fabric network:
    • Solo - The Solo method is built upon utilizing only one orderer node within a network. It is simple to set up and just as easy to manage. This is useful for development environments, although becomes a bottleneck in larger networks. Worse, the solo method has no security in crash tolerance which puts production data at risk. As such, Solo is only recommended for testing and development purposes. It is recommended not to design upon Solo in a project in which you intend to later expand.
    • Raft - Raft implementations are well suited to being used as a single node for both development, and being extended to multiple nodes within a production environment. Raft also includes some built-in crash fault tolerance. Raft implementations are simpler than setting up Kafka nodes as well and occasionally versatile in deployment.
    • Kafka - Used primarily for production, Kafka is a sturdy distributed streaming platform that may publish to records, store records and process records. Like Raft implementations, Kafka is crash-tolerant. This comes at the expense of requiring that Kafka cluster be deployed and managed.
  • Endorser Peers - Peers can be designated in the Endorser role. This is within the transaction workflow to either ratify a transaction request as valid and accept it to be added to the ledger, or refuse it outright. They handle execution of chaincode to do so.
Peers Diagram Hyperledger Fabric
Each peer has it's own updated copy of the distributed ledger in addition to the power of executing chaincode for the purpose of endorsement.
https://hyperledger-fabric.readthedocs.io

Hyperledger Fabric CA

The Hyperledger Fabric CA (or Fabric Certificate Authority) acts as the Membership Service Provider for Hyperledger Fabric. It handles registration of members, certification, and regulation of nodes. As such, certificate authorities perform a central role in making Fabric a permissioned blockchain, registering members, keeping track of identities within the network, and removing deprecated accounts.

The Hyperledger Fabric CA server communicates with components of the Fabric network via REST APIs, which in turn interact with either a Fabric SDK that the client application was designed with, or a special instance of the Fabric CA client. The Fabric CA is an optional, modular component. More information may be found within the official documentation.

Fabric CA Diagram
As a modular component of Fabric, the Certificate Authority resides on a separate node than that of the rest of the network and helps to mediate secure interactions.
hyperledger-fabric-ca.readthedocs.io

Ledger

The distributed ledger is what makes blockchain special. This ledger is at the center of what Hyperledger Fabric is all about. It is within this ledger that you will find every record of every transaction to have ever taken place within a channel of the network, including details about a given transaction. These details include when the transaction occurred, between whom, how much it was for, what it was for, and just about anything else you might possibly want to know. It is this ledger (or ledgers, rather) that also protects the security of this data through blockchains famous immutability. Once added into the ledger, data cannot be modified in any way.

Ledgers are composed of the blocks of data. Their most important components include an ID, an up-to-date hash of the integrated transactions, and the hash of the previous block on which the current relies upon.

Interestingly, the blocks within the ledger not only keep a record of all transactions that have been endorsed and successfully entered, but those that were rejected during the endorsement process as well. This helps prevent re-submission and re-evaluation of already unapproved attempted transactions.

Hyperledger Fabric Workflow

How do the components of Fabric work together to enable the write, read,. and processing of data?

Transaction Processing

Fabric uses checks and verification to help validate data prior to submission to the chain. For each transaction, these steps include:

  1. Creation of transaction proposal: Imagine a trade, such as a deal between an automobile company and a car dealership. The life of this transaction begins with its inception by a network peer. The peer creates a proposal within a client application connected to the network written against the SDK of a particular programming language.
  2. Endorsement of transaction: From the client application (or SDK), the proposal is then submitted to the endorsing peers (within the channel that the transaction is taking place) for endorsement. Each endorsing peer executes the proposal (a function defined within the chaincode) and returns the negative or positive response. The responses and results from the chaincode are returned to the client.
  3. Submission to orderer peers: After being endorsed and returned, the transaction is then submitted to the ordering service (or combined group of ordering peers/nodes), which uses consensus to order the transaction into a block within the ledger. Note that unlike other blockchain frameworks, the ordering (block storage) of a validated transaction into the ledger is final - this means that not only is the transactions storage within the block unchangeable, but that the block's place within the ledger is as well, ensuring a new level of immutability.
  4. Commitment of transaction: Once ordered, the stored transaction block is sent to all of the peers as part of the channel. This serves as a final validation step before changes are actually made to the ledger. There may be more than one transaction stored within one of these blocks.
  5. Submission to ledger: Once the transaction(s) within the block sent back to the peers is ratified and finalized, the block is written into the ledger.

Fabric differs slightly from other blockchains in that the chaincode is what runs transactions rather than the smart contracts themselves.

Hyperledger Fabric Transaction Flow Simplified
A transaction proposal is never submitted directly from a client to the endorsing peers. It must first be submitted to an app, which then mediates the network interaction.
ibm.com

Final Notes

Hyperledger is an enormous ecosystem of projects, and this article just scratches the surface. For advanced information please refer to the official documentation for Fabric.

Comments

Loading
Unable to retrieve data due to an error
Retry
No results found
Back to All Comments