Hyperledger Fabric
Hyperledger Fabric
its modular architecture, permissioned network, and smart contract functionality, known as
“chaincode”.
● The platform provides a high degree of security, privacy, and scalability, and it supports
the development of custom blockchain solutions for various use cases across industries
such as finance, supply chain, and healthcare.
● Hyperledger Fabric operates as a network of nodes, where each node performs a
specific function, such as validating transactions, maintaining the ledger, and executing
chaincode.
● Transactions are validated and ordered by a consensus mechanism, which ensures the
integrity and consistency of the ledger.
Components:
Hyperledger fabric is an enterprise-level permission blockchain network. It is made up of various
unique organizations or members that interact with each other to serve a specific purpose. For
example, these organizations can be a bank, financial institution, or a supply chain network.
Each organization is identified and they have a fabric certificate authority. These organizations
are called members.
Each member of the fabric can set up one or more authorized peers to participate in the network
using the fabric certificate authority. All of these peers must be authorized properly.
There is a client-side application connected to the network written with the software
development kit (SDK) of any particular programming language.
Workflow
For each and every transaction in the fabric, the following steps are followed-
Endorsement of the transaction: After the proposal reaches the endorser peers
(peers in each organization for endorsement of a proposal) the peer checks the fabric
certificate authority of the requesting member and other details that are needed to
authenticate the transaction. Then it executes the chain code (a piece of code that is
written in one of the supported languages such as Go or Java) and returns a response.
This response indicates the approval or rejection of the following transaction. The
response is carried out to the client.
Submission to ordering service: After receiving the endorsement output, the
approved transactions are sent to the ordering service by the client-side application.
The peer responsible for the ordering service includes the transaction into a specific
block and sends it to the peer nodes of different members of the network.
Updating the ledger: After receiving this block the peer nodes of such organizations
update their local ledger with this block. Hence the new transactions are now
committed.
1. Peer Node
This is the main component of Hyperledger Fabric. It is responsible for managing the
ledger, executing smart contracts, and participating in the consensus process. A peer
node in Hyperledger Fabric is a server that runs the Hyperledger Fabric software and is
part of a network of peer nodes that make up a Hyperledger Fabric blockchain. Each
peer node stores a copy of the ledger and participates in the consensus process to
validate and endorse transactions, as well as maintain the state of the ledger. Peer
nodes can also run smart contracts, known as chaincode in Hyperledger Fabric, which
define the business logic of the blockchain network.
Endorser Peers: Responsible for endorsing transactions. They execute chaincode and
simulate transactions to verify if they meet the endorsement policy before a transaction
is submitted for ordering.
Committing Peers: Maintain a copy of the ledger and state database. They commit
transactions and blocks to the ledger after they are validated and ordered.
2. Orderer
In Hyperledger Fabric, an orderer is a component that is responsible for ensuring the delivery of
transactions to the appropriate peer nodes for validation and endorsement. The orderer
maintains an ordered log of all transactions that have occurred on the network and provides a
communication channel for the peer nodes to reach a consensus on the order in which
transactions should be processed. The orderer does not validate or endorse transactions but
rather acts as a mediator to facilitate communication between the different peer nodes. There
are 5 types of Orderer:
● Solo Orderer: A solo orderer is a single node that is responsible for maintaining the
ledger and ordering transactions in the network. This type of orderer is typically used in
small or test networks.
● Kafka Orderer: A Kafka orderer is a cluster of orderer nodes that use the Apache Kafka
distributed messaging system to order transactions and maintain the ledger. This type of
orderer is typically used in large or complex networks.
● Raft Orderer: A Raft orderer is a cluster of orderer nodes that use the Raft consensus
algorithm to order transactions and maintain the ledger. This type of orderer is typically
used in networks that require high performance and low latency.
● SNS Orderer: An SNS orderer is a cluster of orderer nodes that use the Amazon Simple
Notification Service (SNS) to order transactions and maintain the ledger. This type of
orderer is typically used in networks that are hosted on Amazon Web Services (AWS).
● CouchDB Orderer: A CouchDB orderer is a cluster of orderer nodes that use the Apache
CouchDB database to store and order transactions in the network. This type of orderer is
typically used in networks that require high availability and scalability
3. Ledger
In Hyperledger Fabric, the ledger is a distributed database that records all of the
transactions that occur on the network. Each peer node maintains a copy of the ledger,
and the ledger is updated whenever a new transaction is endorsed and committed to
the network. The ledger is composed of two parts: the world state, which stores the
current state of all assets on the network, and the transaction log, which stores a record
of all transactions that have occurred on the network.
Blockchain: The core data structure that records all transactions in a sequence of
blocks. Each block contains a batch of transactions, and blocks are linked together to
form a chain.
State Database: An off-chain database that stores the current state of the ledger. It is
used to quickly query and retrieve the current values of assets and other data.
4. Chaincode
In Hyperledger Fabric, chaincode is the term used to refer to smart contracts.
Chaincode is written in Go and defines the business logic of a Hyperledger Fabric
network. It specifies the rules for updating the ledger and determines which transactions
are valid. When a transaction is submitted to the network, it is sent to the appropriate
peer nodes for endorsement. The chaincode is then executed on the endorsing peer
nodes, and the endorsed transaction is sent back to the client for ordering and finally
committed to the ledger. Chaincode is an important part of the Hyperledger Fabric
architecture, as it allows users to define the specific rules and functionality of their
blockchain network. There are two types of chaincode in Hyperledger Fabric:
System Chaincode: This type of chaincode is deployed and managed by the network
administrator and is used to manage the operations of the blockchain network, such as
adding new members or modifying the network configuration.
User Chaincode: This type of chaincode is deployed and managed by the users of the
network and is used to implement the business logic of the applications that run on the
network.
5. Consensus Algorithm
In Hyperledger Fabric, the consensus algorithm is the mechanism by which the peer-
ordering service nodes in a network reach an agreement on the order and validity of
transactions. The consensus algorithm is an important part of the overall architecture of
a Hyperledger Fabric network, as it ensures the integrity and consistency of the ledger
by ensuring that all peer nodes have a consistent view of the state of the network.
Ordering Service is responsible for creating a consensus on the order of transactions.
Fabric supports various consensus protocols, with Raft being the default. The ordering
service organizes transactions into blocks and disseminates them to peers.
6. Channels
In Hyperledger Fabric, a channel is a private “subnet” within a Hyperledger Fabric
network that allows a group of participants to execute transactions and confidentially
share data. Each channel has its separate ledger, and the participants on a channel can
only see the transactions that are submitted to that channel. This allows different groups
of participants within a Hyperledger Fabric network to have their own private,
confidential interactions without revealing sensitive information to the other participants
on the network. Channels provide an additional layer of security and privacy within a
Hyperledger Fabric network. In Hyperledger Fabric, there are three types of channels:
Application Channels: These channels are created by the organizations that are part of
a consortium on the network. They are used for conducting transactions and sharing
data among the members of the consortium.
System Channels: These channels are created by the network administrator and are
used for deploying and updating the network’s shared ledger and other system-level
components.
Private Channels: These channels are created by members of the consortium and are
used for conducting private transactions between two or more specific organizations.
Private channels allow organizations to maintain the confidentiality of their transactions
while still being able to take advantage of the security and immutability of the shared
ledger.
7. Membership Service Provider (MSP)
In Hyperledger Fabric, a Membership Service Provider (MSP) is a component that
defines the rules for identity management and authentication within a Hyperledger
Fabric network. MSPs are used to verify the identity of participants in the network, such
as users, applications, and peer nodes. They do this by managing the certificates and
cryptographic materials that are used to identify and authenticate entities on the
network. MSPs play a crucial role in ensuring the security and integrity of the
Hyperledger Fabric network by ensuring that only authorized entities can access the
network and participate in transactions. There are several types of membership service
providers (MSPs) in Hyperledger, including:
Local MSP: This type of MSP is designed for development and testing purposes and is
used to manage the identities of local users and applications.
File-based MSP: This type of MSP uses a file system to store the identity information of
users and applications.
Certificate Authority-based MSP: This type of MSP uses a certificate authority (CA) to
issue and manage the digital certificates that are used to identify users and applications.
Database-based MSP: This type of MSP uses a database to store the identity
information of users and applications.
External Identity Provider-based MSP: This type of MSP uses an external identity
provider, such as a corporate LDAP server or an external CA, to manage the identities
of users and applications.
Hyperledger Architecture
1. Consensus Layer:
Creates an agreement on the ordering and confirms the accuracy of the transaction
database that comprises a block.
The communication layer is used by the consensus layer to communicate with the client
and other network peers.
Confirms that all transactions in a proposed block are correct according to approval and
consensus policies.
Interfaces with the smart-contract layer and relies on it to validate the accuracy of an
ordered transaction database in a block.
They’re also widely utilized to synchronize data across a decentralized network and
assure transaction consistency and transparency.
The smart contract layer verifies each transaction by guaranteeing that it adheres to the
transaction’s policy and contract and invalid transactions are denied and may be
removed from consideration for inclusion in a block.
Smart contracts are classified into two types:
installed smart contracts- Before the network is launched, installed smart contracts
implement business logic on the validators.
On-chain smart contracts– On-chain smart contracts implement business rules in the
form of a transaction that is committed to the blockchain and then invoked by
subsequent transactions. The code that describes the business logic forms part of the
ledger with on-chain smart contracts.
Responsible for executing transaction requests and determining transaction validity
through the use of business logic.
In Hyperledger Fabric, a smart contract is a program known as chaincode. Chaincode
can be developed in Go, JavaScript (node. js), and, in the future, additional
programming languages such as Java that define a predefined interface. Chaincode is
run in a secure Docker container that is separate from the endorsing peer process.
3. Communication Layer:
5. Crypto Abstraction:
Allows for the substitution of alternative crypto techniques or modules without disrupting
other modules.
Because Fabtoken, a new functionality in Hyperledger Fabric version 2.0 (alpha), allows
you to generate native cryptocurrencies or coins.
Besu Hyperledger is a public Ethereum codebase that is open source and may run on
individual permissionless platforms or the Ethereum public network. The Ethereum
Virtual Machines (EVM), consensus mechanisms, user-facing APIs, and monitoring are
all included.
CPU and GPU mining is supported by Hyperledger Besu and can be enabled using
command-line arguments. Ethminer with both the stratum+tcp and getwork schemes
was utilized for GPU mining support testing.
It does not support cryptocurrencies such as bitcoin, but it functions by providing the
infrastructure and standards required for the development of various blockchain-based
applications and systems for industrial usage.
6. Identity Service:
Allows for the formation of a trusted root during the configuration of a blockchain
instance, the enrolment and registration of identities or systems entities during network
operation, and the administration of changes such as drops, additions, and revocations.
It also offers authentication and permission.
The smart contract layer employs the identity services layer to authenticate and approve
the entity requesting to execute the smart contract while processing the transaction.
Hyperledger Fabric provides a personal identity service that handles user IDs and
authenticates all network participants to enable permissioned networks. Access control
lists can be utilized to add layers of permission by authorizing certain network actions.
Certification Authorities are in charge of managing certificates (or CA). Fabric CA is
Hyperledger’s Certification Authority
7. Policy Service:
Policy Services is in charge of policy management for the system’s numerous policies,
including the endorsement policy, consensus policy, and group management policy. It
communicates with and is dependent on another module to enforce the different
policies.
Fabric policies reflect the process through which members agree to approve or reject
changes to the network, a route, or a smart contract. Policies are agreed upon by
channel members when the channel is first set up, but they can also be changed as the
channel evolves.
Policies are one of the features that distinguish Hyperledger Fabric from other
blockchains such as Ethereum or Bitcoin. Transactions in those systems can be
generated and confirmed by any node in the network.
8. API: It enables clients and applications to interface with blockchains. there are three
types of API used in hyperledger they are:
Hyperledger Tools
Below are some of the hyperledger tools
1. Hyperledger Composer
Hyperledger Caliper is a blockchain benchmarking tool that enables users to assess the
performance of a blockchain implementation against a set of predefined use cases.
Huawei, Hyperchain, and Oracle have contributed to the Hyperledger Caliper
performance benchmark tool for the Hyperledger project.
By boosting the transparency and traceability of network transactions, Hyperledger
Fabric networks can enhance supply chain processes. Companies with access to the
ledger on a Fabric network can see the same immutable data.
5. Hyperledger Ursa
Application of Hyperledger
Finance: Hyperledger can be used to streamline the settlement of transactions,
improved liquidity, and provide increased transparency by eliminating the need for
accounts on particular payment systems at a low cost.
Healthcare: Hyperledger can be utilized to cut expenses, improve patient care, and
increase data accessibility.
Supply Chain: Using Hyperledger, organizations may create initiatives that aim to limit
the prevalence of counterfeit goods while also tracing the provenance of components
and services.
Insurance: The Insurance firm can refer to the transaction data recorded in the ledger
using Hyperledger. Hyperledger Fabric may also use chain code to speed up claim
processing and automate payment.
Digital payment: Interledger and other Hyperledger applications have the potential to set
new standards in the finance sector. More importantly, it has the potential to
revolutionize two-party cross-border payments.
Benefits Of Hyperledger Fabric
1. Open Source: Hyperledger fabric is an open-source blockchain framework hosted by
the Linux foundation. It has an active community of developers The code is designed to
be publicly accessible. Anyone in the community can see, modify, and distribute the
code as they see fit. People across the world can come and help to develop the source
code.
2. Private and Confidential: In a public blockchain network each and every node in the
network is receiving a copy of the whole ledger. Thus keeping privacy becomes a much
bigger concern as everything is open to everyone. In addition to this one, the identities
of all the participating members are not known and authenticated. Anyone can
participate as it is a public blockchain. But in the case of Hyperledger fabric, the
identities of all participating members are authenticated. And the ledger is only exposed
to the authenticated members. This benefit is the most useful in industry-level cases,
like banking, insurance, etc where customer data should be kept private.