Hyperledger Fabric is a platform for distributed ledger solutions with high degrees of confidentiality, resiliency, flexibility, and scalability. It is designed to support pluggable implementations of different components and accommodate the complexity and intricacies that exist across the economic ecosystem.

What is a Blockchain?

A Distributed Ledger

A blockchain ledger is often described as decentralized because it is replicated across many network participants, each of whom collaborate in its maintenance.

Smart Contracts

To support the consistent update of information — and to enable a whole host of ledger functions (transacting, querying, etc) — a blockchain network uses smart contracts to provide controlled access to the ledger.

mart contracts are not only a key mechanism for encapsulating information and keeping it simple across the network, they can also be written to allow participants to execute certain aspects of transactions automatically.

A smart contract can, for example, be written to stipulate the cost of shipping an item where the shipping charge changes depending on how quickly the item arrives. With the terms agreed to by both parties and written to the ledger, the appropriate funds change hands automatically when the item is received.


The process of keeping the ledger transactions synchronized across the network — to ensure that ledgers update only when transactions are approved by the appropriate participants, and that when ledgers do update, they update with the same transactions in the same order — is called consensus.

What is Hyperledger Fabric?

The Linux Foundation founded the Hyperledger project in 2015 to advance cross-industry blockchain technologies. Rather than declaring a single blockchain standard, it encourages a collaborative approach to developing blockchain technologies via a community process, with intellectual property rights that encourage open development and the adoption of key standards over time.

Hyperledger Fabric is one of the blockchain projects within Hyperledger. Like other blockchain technologies, it has a ledger, uses smart contracts, and is a system by which participants manage their transactions,but it is private and permissioned.

Rather than an open permissionless system that allows unknown identities to participate in the network (requiring protocols like “proof of work” to validate transactions and secure the network), the members of a Hyperledger Fabric network enroll through a trusted Membership Service Provider (MSP).

Hyperledger Fabric also offers several pluggable options. Ledger data can be stored in multiple formats, consensus mechanisms can be swapped in and out, and different MSPs are supported.

Hyperledger Fabric also offers the ability to create channels, allowing a group of participants to create a separate ledger of transactions. This is an especially important option for networks where some participants might be competitors and not want every transaction they make — a special price they’re offering to some participants and not others, for example — known to every participant. If two participants form a channel, then those participants — and no others — have copies of the ledger for that channel.

Hyperledger Fabric smart contracts are written in chaincode and are invoked by an application external to the blockchain when that application needs to interact with the ledger. Chaincode can be implemented in several programming languages. Currently, Go and Node are supported.

Key benefits of Hyperledger fabric:

Hyperledger Fabric Model

Following are the key features of Hyperledger Fabric that fulfill its promise of customizable enterprise Blockchain

  • Assets: Enable the exchange of monetary value over the network
  • Chaincode: Partitioned from transaction ordering, limiting the required levels of trust and verification across node types, and optimizing network scalability and performance
  • Ledger Features: Encodes the entire transaction history for each channel, and includes SQL-like query capability Privacy through
  • Channels: Enable multi-lateral transactions with the high degrees of privacy and confidentiality
  • Security & Membership Services: In Permissioned membership participants know that all transactions can be detected and traced by authorized regulators and auditors
  • Consensus: Allow network starters to choose a consensus mechanism that best represents the relationships that exist between participants

Hyperledger Fabric was designed to be a truly modular, scalable and secure foundation for industrial Blockchain solutions. Maybe the most notable change in the upgrade from Fabric version0.6 to Fabric 1.0 is that the peers are now decoupled into two separate runtimes with three distinct roles.

Types of Peers

  1. Committer peer: Commits transactions, maintains ledger and state
  2. Endorsing peer: Receives a transaction proposal for endorsement, responds granting or denying endorsement
  3. Ordering peer: Approves the inclusion of transaction blocks into the ledger and communicates with peer and endorsing peer nodes

What is a Ledger?

A ledger contains the current state of a business as a journal of transactions. This is a real life example of a ledger — a state (your bank balance), and a set of ordered transactions (credits and debits) that determine it. Hyperledger Fabric is motivated by these same two concerns — to present the current value of a set of ledger states, and to capture the history of the transactions that determined these states. A ledger doesn’t literally store business objects — instead it stores facts about those objects. When we say “we store a business object in a ledger” what we really mean is that we’re recording the facts about the current state of an object, and the facts about the history of transactions that led to the current state. While the facts about the current state of a business object may change, the history of facts about it is immutable, it can be added to, but it cannot be retrospectively changed.

In Hyperledger Fabric, a ledger consists of two distinct, though related, parts — a world state and a blockchain. Each of these represents a set of facts about a set of business objects.

Firstly, there’s a world state — a database that holds a cache of the current values of a set of ledger states. The world state makes it easy for a program to directly access the current value of a state rather than having to calculate it by traversing the entire transaction log. Ledger states are, by default, expressed as key-value pairs. The world state holds the current value of the attributes of a business object as a unique ledger state. The world state can change frequently, as states can be created, updated and deleted.

Secondly, there’s a blockchain — a transaction log that records all the changes that have resulted in the current world state. Transactions are collected inside blocks that are appended to the blockchain — enabling you to understand the history of changes that have resulted in the current world state. The blockchain data structure is very different to the world state because once written, it cannot be modified; it is immutable.

What is Chaincode?

Chaincode is a program, written in Go, node.js, or Java that implements a prescribed interface. Chaincode runs in a secured Docker container isolated from the endorsing peer process. Chaincode initializes and manages the ledger state through transactions submitted by applications. A chaincode typically handles business logic agreed to by members of the network, so it similar to a “smart contract”. A chaincode can be invoked to update or query the ledger in a proposal transaction. Given the appropriate permission, a chaincode may invoke another chaincode, either in the same channel or in different channels, to access its state. Note that, if the called chaincode is on a different channel from the calling chaincode, only read query is allowed. That is, the called chaincode on a different channel is only a Query, which does not participate in state validation checks in subsequent commit phase.

What is private data?

In cases where a group of organizations on a channel need to keep data private from other organizations on that channel, they have the option to create a new channel comprising just the organizations who need access to the data. However, creating separate channels in each of these cases creates additional administrative overhead (maintaining chaincode versions, policies, MSPs, etc), and doesn’t allow for use cases in which you want all channel participants to see a transaction while keeping a portion of the data private.

That’s why, starting in v1.2, Fabric offers the ability to create private data collections, which allow a defined subset of organizations on a channel the ability to endorse, commit, or query private data without having to create a separate channel.

What is a private data collection?

A collection is the combination of two elements:

  1. The actual private data, sent peer-to-peer via gossip protocol to only the organization(s) authorized to see it. This data is stored in a private database on the peer (sometimes called a “side” database, or “SideDB”). The ordering service is not involved here and does not see the private data. Note that setting up gossip requires setting up anchor peers in order to bootstrap cross-organization communication.
  2. A hash of that data, which is endorsed, ordered, and written to the ledgers of every peer on the channel. The hash serves as evidence of the transaction and is used for state validation and can be used for audit purposes.

When to use a collection within a channel vs. a separate channel?

A use case to explain collections

Consider a group of five organizations on a channel who trade produce:

  • A Farmer selling his goods abroad
  • A Distributor moving goods abroad
  • A Shipper moving goods between parties
  • A Wholesaler purchasing goods from distributors
  • A Retailer purchasing goods from shippers and wholesalers

The Distributor might want to make private transactions with the Farmer and Shipper to keep the terms of the trades confidential from the Wholesaler and the Retailer (so as not to expose the markup they’re charging).

The Distributor may also want to have a separate private data relationship with the Wholesalerbecause it charges them a lower price than it does the Retailer.

The Wholesaler may also want to have a private data relationship with the Retailer and the Shipper.

Rather than defining many small channels for each of these relationships, multiple private data collections (PDC) can be defined to share private data between:

  1. Private Data Collection1: Distributor, Farmer and Shipper
  2. Private Data Collection2: Distributor and Wholesaler
  3. Private Data Collection3: Wholesaler, Retailer and Shipper

Block in Hyperledger

Consists of 3 main parts:

  1. Block Header
  2. Block Data
  3. Block Metadata

1)Block Header

This section comprises three fields, written when a block is created.

  • Block number: An integer starting at 0 (the genesis block), and increased by 1 for every new block appended to the blockchain.
  • Current Block Hash: The hash of all the transactions contained in the current block.
  • Previous Block Hash: A copy of the hash from the previous block in the blockchain.
  • These fields are internally derived by cryptographically hashing the block data. They ensure that each and every block is inextricably linked to its neighbour, leading to an immutable ledger.

2)Block Data

  • This section contains a list of transactions arranged in order. It is written when the block is created by the ordering service. These transactions have a rich but straightforward structure, which we describe later in this topic.

3)Block Metadata

  • This section contains the time when the block was written, as well as the certificate, public key and signature of the block writer. Subsequently, the block committer also adds a valid/invalid indicator for every transaction, though this information is not included in the hash, as that is created when the block is created.

Suffering from Knowledge Quest