You are on page 1of 214

Hyperledger Fabric

Developer Revision 6.0

www.blockchaintrainingalliance.com
Who is this course for?

• Familiar with C#, Java, JavaScript, or other C-derivative language


• Some familiarity with Linux (Ubuntu) command line operations
• An understanding of blockchain fundamentals such as:
• Immutability
• Group Consensus
• Cryptographic Hashing
• Smart Contracts
• Data Transparency
• Developers > Admins
• Hyperledger administration / operations is an entirely different course

Page 3 © Copyright 2020 | All Rights Reserved


What are the goals for this course?

• Learn the difference between anonymous and permissioned


blockchains
• Identify the value of permissioned blockchains in the enterprise
• Identify and evaluate use cases in the environment around you
• Identify solution objects for a given use case
• Create a working proof-of-concept in Composer
• Deploy your POC to a Fabric / Composer environment for further
testing and development

Page 4 © Copyright 2020 | All Rights Reserved


Blockchain 101
www.blockchaintrainingalliance.com
Blockchain Basics

 Think of a “Block” as a sheet of paper with 25 recorded transactions.


 Each of the 25 lines has a complete transaction record
 Each record is complete with time, data, all transaction details.
 When a sheet is filled (25 transactions), the Nodes “validate” the
transactions on the current page and post it on the Blockchain.
 All Nodes must agree (have Consensus) on the transaction content

Page 6 © Copyright 2020 | All Rights Reserved


What is in a Block?

 A ‘magic number’ (0xD9B4BEF9) to show it’s a Bitcoin block

 A size number to specify how much data is coming next

 Some metadata:
 A version number of the block format
 A link to the previous block that came immediately before it
 Merkle root of all the transactions in the block
 Timestamp of when the block was created
 Mining difficulty (more about this later)
 Nonce for proof-of-work (more about this later)
 All the data of the 25 transactions recorded in this block

Page 7 © Copyright 2020 | All Rights Reserved


The “Blocks” of a Blockchain

Transactions are grouped


together into a Block
25 Transactions per Block

0 1 2 3 4 5

Page 8 © Copyright 2020 | All Rights Reserved


Blockchain Blocks

0 1 2 3 4 5

 Blocks are numbered in ascending order, 0 is first/oldest

 The number is the ‘height’ of the block

 Arrows only go from newer to older blocks - a block only


directly links to the one immediately before it

 Once a block is stored, it’s read-only (which is why it doesn’t


link to the ones after it - that would require you to update it)
Page 9 © Copyright 2020 | All Rights Reserved
Blockchain Blocks

0 1 2 3 4 5

 Blocks store data, in Bitcoin, it’s the transactions, but it could


be any digital data

 Blocks are created periodically (on average, 10mins for


Bitcoin) by a process called ‘mining’

 A block represents a set of events that have occurred over a


particular time frame (usually, since the previous block)

Page 10 © Copyright 2020 | All Rights Reserved


Blockchain Blocks

0 1 2 3 4 5

 Blocks aren't identified by their height, but by their id

 Block id is the hash of the data in the block


 0=000000000019D6689C085AE165831E934FF763AE46A2A6C172B3F1B60A8CE26F
 1=00000000839A8E6886AB5951D76F411475428AFC90947EE320161BBF18EB6048
 2=000000006A625F06636B8BB6AC7B960A8D03705D1ACE08B1A19DA3FDCC99DDBD

 Block id is a digital fingerprint of that block

Page 11 © Copyright 2020 | All Rights Reserved


MERKLE TREE - HASH OF HASHES

Top hash

 Multiple blocks of data, in Hash Hash


a certain order, into a 0 1
single hash
Hash Hash Hash Hash
 Allows you to work out 0-0 0-1 1-0 1-1

which block has changed


Data Data Data Data
block block block block
1 2 3 4

Page 12 © Copyright 2020 | All Rights Reserved


Blockchain IS

 A record keeping system – of Any Asset

 to record the transactions of importance (Non-


Monetary)

 Update to a medical record


 Transfer of ownership
 Training certification on Blockchain
 Recording important single-party announcements

Page 13 © Copyright 2020 | All Rights Reserved


How Blockchain Works?

Page 14 © Copyright 2020 | All Rights Reserved


Consensus Algorithms

Proof of Work Proof of Stake Solo

Kafka / Proof of
BFT / PBFT
Zookeeper Elapsed Time

Page 15 © Copyright 2020 | All Rights Reserved


Summary Proof of Work (PoW)

 Proof of Work Consensus


 When a block is full, each node competes to solve a
guessing game problem
 This problem is non-computational, random guesses are

most efficient
 Miners try to guess the “nonce”

 All block data plus the current guess (nonce) are run

through a cryptographic hash


 If the result matches the current level of “difficulty”, the
miner has guessed the right answer
 The miner with the answer shares it with all other miners,
Miners will confirm the answer is correct by using the
nonce with their block data to try and get the correct result

Page 16 © Copyright 2020 | All Rights Reserved


Proof of Stake (PoS)

 Proof of Stake Consensus


 Proposed as an alternative to Proof of Work
 Attempt to overcome scalability concerns imposed by PoW
consensus
 Removes the guessing game from consensus
 Mining no longer requires specialized and powerful hardware
 Many feel that specialized hardware requirements lead to

centralization
 Blockchain is about de-centralization

 Less energy intensive form of consensus


 Addresses concerns about “green” mining

Page 17 © Copyright 2020 | All Rights Reserved


Other Consensus Mechanisms

 Other consensus mechanisms


 Proof of Capacity (aka. Space)
 Pay to play with hard drive space or memory

 The most space you ‘stake’ the better your odds of being

selected to mine the next block


 Consensus algorithm generates large data sets called ‘plots’

which consume storage


 Major criticism – this method has no real deterrent for bad

actors

Page 18 © Copyright 2020 | All Rights Reserved


Other Consensus Mechanisms

 Other consensus mechanisms


 Proof of Elapsed Time
 Created by Intel to run on their trusted execution environment

 Similar to PoW, far more energy efficient

 Major criticism – requires trust in Intel, places power back in

the hands of a central authority

 Proof of Authority
 Uses a set of “authorities” – nodes that are explicitly allowed to

create new blocks and secure the blockchain


 Replacement for PoW - Private blockchains only

 Earn the right to become a validator/authority

Page 19 © Copyright 2020 | All Rights Reserved


Types of System

i) Centralized iii) Distributed

ii) Decentralized

Page 20 © Copyright 2020 | All Rights Reserved


Single (no consensus) Authority

Page 21 © Copyright 2020 | All Rights Reserved


Multiple (Flatter) Authorities

Page 22 © Copyright 2020 | All Rights Reserved


Distributed System Authorities

Page 23 © Copyright 2020 | All Rights Reserved


Types of Blockchain Network

 Public vs Private
 Who can write data to the Blockchain?
 Public – everyone can add a record
 Private – only certain participants can write data

 Open vs Closed
 Who can read data from the Blockchain?
 Open – everyone can read Blockchain data
 Closed – only certain participants can read data

Page 24 © Copyright 2020 | All Rights Reserved


Public or Private Blockchain

 Hyperledger vs Ethereum
 These are discussion points, NOT absolutes

 Ethereum
 Music and content distribution
 Digital currency or asset-backed token
 Blockchain-enabled mobile data service
 Gambling and on-line gaming
 Authoring, editing, and amending a piece of legislation
 Group consensus is needed/required

Page 25 © Copyright 2020 | All Rights Reserved


Public or Private Blockchain

 Hyperledger vs Ethereum
 These are discussion points, NOT absolutes

 Hyperledger
Supply Chain
Supplier / Manufacturer inventory management
Managing internal business processes across
geographically distributed locations
Allowing elected officials to vote on initiatives without
being present

Page 26 © Copyright 2020 | All Rights Reserved


Public vs. Private Blockchains

Page 27 © Copyright 2020 | All Rights Reserved


Blockchain Decision Matrix

Public
Public & Closed Public & Open

• Voting • Currencies
• Voting records • Betting
• Whistleblowers • Video games

Private & Closed Private & Open

• Construction • Supply Chain


• National defense • Government
• Law enforcement financial records
• Military • Corporate earning
Private

• Tax Returns statements

Closed Open

Page 28 © Copyright 2020 | All Rights Reserved


Benefits of Blockchain

 What are the benefits of Blockchain?


 Publicly verifiable
 Accountability to customers and end-users
 (permission-less)
 Secure
 Control who sees what data when (permissioned)
 Quality assurance
 Track origin of all supply chain components
 Example – Food origin and/or safety recalls
 Smart Contracts as a replacement for middlemen operators
 Lower transactions costs
 Removing middlemen reduces cost

Page 29 © Copyright 2020 | All Rights Reserved


Blockchain for Business
www.blockchaintrainingalliance.com
Problem
Problem - Difficult to monitor asset ownership and transfers in a trusted
business network

31

Inefficient, expensive, vulnerable


Page 31 © Copyright 2020 | All Rights Reserved
Solution
Solution – a permissioned, replicated, shared ledger

32

Consensus, provenance, immutability, finality


Page 32 © Copyright 2020 | All Rights Reserved
Let’s Recap
• What is blockchain? (public, open, permissionless)
• Decentralized ledger
• Can store any type of data
• Shared ledger
• Immutable
• Anonymous
• Fully-Transparent
• Group Consensus
• Nodes only verify data was recorded correctly
• No ability to verify truth of the data itself
• Smart Contracts
• Ability to automate processes
• Blockchain as workflow / BPM

Page 33 © Copyright 2020 | All Rights Reserved


Blockchain for Business
• Are these properties good or bad?
• Decentralized ledger
• Can store any type of data
• Shared ledger
• Immutable
• Anonymous
• Fully-Transparent
• Group Consensus
• Nodes only verify data was recorded correctly
• No ability to verify truth of the data itself
• Smart Contracts
• Ability to automate processes
• Blockchain as workflow / BPM

Page 34 © Copyright 2020 | All Rights Reserved


Why Not a Database

 Blockchains solve specific problems:

 Fully distributed - highly fault tolerant


 No centralized authority
 3rd party trust without trust
 Low barrier to entry - computer + internet = win
 Instant, Global transactional capability
 No double spending
 Very low transaction costs

 Traditional Databases have centralized control and do not perform


these functions.

Page 35 © Copyright 2020 | All Rights Reserved


Four elements
characterize Blockchain

Replicated ledger Cryptography


● History of all transactions ● Integrity of ledger
● Append-only with immutable past ● Authenticity of transactions
● Distributed and replicated ● Privacy of transactions
● Identity of participants

Consensus Business logic


● Decentralized protocol ● Logic embedded in the ledger
● Shared control tolerating disruption ● Executed together with transactions
● Transactions validated ●
From simple "coins" to self-enforcing
"smart contracts"

Page 36 © Copyright 2020 | All Rights Reserved


Industrial Blockchain Benefits

Why?

Reduce costs and complexity Trusted recordkeeping

Improve discoverability Shared trusted processes

37

Page 37 © Copyright 2020 | All Rights Reserved


Business Networks, Markets &
Wealth

What?

• Business Networks benefit from connectivity


– Connected customers, suppliers, banks,
partners
– Cross geography & regulatory boundary
• Wealth is generated by the flow of goods &
services across business network
• Markets are central to this process:
– Public (fruit market, car auction), or
– Private (supply chain financing, bonds)
38

Page 38 © Copyright 2020 | All Rights Reserved


Transferring Assets, building Value

What?

• Anything that is capable of being owned or


controlled to produce value, is an asset
• Two fundamental types of asset
– Tangible, e.g. a house
– Intangible e.g. a mortgage
• Intangible assets subdivide
– Financial, e.g. bond
– Intellectual e.g. patents
– Digital e.g. music
• Cash is also an asset
39
– Has property of anonymity

Page 39 © Copyright 2020 | All Rights Reserved


Types of Asset

Page 40 © Copyright 2020 | All Rights Reserved


Participants, Transactions &
Contracts

What?

• Participants - members of a business


network
– Customer, Supplier, Government, Regulator
– Usually resides in an organization
– Has specific identities and roles
• Transaction - an asset transfer
– John gives a car to Anthony (simple)
• Contract - conditions for transaction to
occur
– If Anthony pays John money, then car passes
from John to Anthony (simple)
– If car won't start, funds do not pass to John (as
decided by third party arbitrator) (more
41

complex)

Page 41 © Copyright 2020 | All Rights Reserved


Blockchain Business Requirements

What?

Append-only distributed Business terms embedded


system of record shared in transaction database &
across business network
Shared Smart
executed with transactions
Ledger Contract

Ensuring appropriate All parties agree to


visibility; transactions are network verified
secure, authenticated & Privacy Validation transaction
verifiable

Broader participation, lower cost, increased efficiency


42

Page 42 © Copyright 2020 | All Rights Reserved


Shared Ledger

What?

• Records all transactions across


business network
• Shared between participants
• Participants have own copy through
replication
• Permissioned, so participants see
only appropriate transactions
• THE shared system of record

43

Page 43 © Copyright 2020 | All Rights Reserved


Smart Contract

What?

• Business rules implied by the


contract . .
• . . embedded in the Blockchain &
• executed with the transaction
• Verifiable, signed
• Encoded in programming language
• Example:
– Defines contractual conditions under
which corporate Bond transfer occurs 44

Page 44 © Copyright 2020 | All Rights Reserved


Privacy

What?

• Ledger is shared, but participants require


privacy
• Participants need:
– Transactions to be private
– Identity not linked to a transaction
• Transactions need to be authenticated
• Cryptography central to these processes

45

Page 45 © Copyright 2020 | All Rights Reserved


Validation

• Transaction verification & commitment


• When participants are anonymous What?
– Commitment is expensive
– cryptographic mining provides verification for
anonymous participants but at significant compute
cost (proof of work)
• When participants are known & trusted
– Commitment possible at low cost
• Multiple alternatives
– proof of stake where fraudulent transactions cost
validators (e.g. transaction bond)
– multi-signature (e.g. 3 out of 5 participants agree)

• Industrial Blockchain needs “pluggable”


consensus
46

Page 46 © Copyright 2020 | All Rights Reserved


Where are private blockchain a
good fit?
• Large business networks / consortium
• Each participant wants to retain ownership/control of their data
• Many different audience types (each of whom will need to see or edit
different parts of the data)
• Desire to standardize (and automate) business processes
• Process requires audit, need to prove you did what you said you did
• Need a permanent record of how business assets evolve over time
• Need a system of record between multiple organizations / groups

Page 47 © Copyright 2020 | All Rights Reserved


Where are private blockchains not a
good fit?
• Requirement for high performance
• Millisecond transactions, tens or hundreds of transactions per second
• Use within a single organization
• Use case can be handled by a simple database
• Little to no need for data after transaction is complete
• No audit required

Page 48 © Copyright 2020 | All Rights Reserved


Hyperledger Use Cases
• Letter of Credit
• Purchase Fulfillment
• Smart Devices, appliances making their own purchases
• Supply chain
• Aircraft Maintenance
• National Association of Realtors
• Mercedes-Benz North America
• Walmart / Carrefour
• Food provenance
• FedEx
• Contracted last-mile delivery tracking

Page 49 © Copyright 2020 | All Rights Reserved


Actors in a Blockchain Solution

R Regulator
U
B2B Blockchain
performs transactions User
A
oversight
Blockchain
Architect
designs ✓

Membership

D Blockchain accesses
security
Services

Blockchain
creates certificates
Developer
applications

access to
operates data Traditional
Data
access to logic Sources
O
Blockchain
Traditional
Network
Processing
Operator
Platforms 3

Page 50 © Copyright 2020 | All Rights Reserved


Actors in a Blockchain Solution

Blockchain Responsible for the architecture and design of the blockchain solution
A
Architect

The business user, operating in a business network. This role interacts with the Blockchain using an
Blockchain application. They are not aware of the Blockchain.
U
User

The overall authority in a business network. Specifically, regulators may require broad access to
Blockchain
R the ledger’s contents.
Regulator

Blockchain The developer of applications and smart contracts that interact with the Blockchain and are
D used by Blockchain users.
Developer

Blockchain Manages and monitors the Blockchain network. Each business in the network has a Blockchain
Operator
O Network operator.

Membership Manages the different types of certificates required to run a permissioned Blockchain.

Services

Traditional
An existing computer system which may be used by the Blockchain to augment processing. This
Processing
system may also need to initiate requests into the Blockchain.
Platform

Traditional An existing data system which may provide data to influence the behavior of smart contracts.
Data
Sources

Page 51 © Copyright 2020 | All Rights Reserved


Summary of key concepts

D
Blockchain Application Smart
Ledger
Developer Contract
f(abc); …

Traditional Systems
Traditional
Processing Events Integration
O Platforms
Data

Blockchain
Sources !
Operator

Peers Consensus Security

A
Blockchain Business Design
Architect concerns Tradeoffs

Page 52 © Copyright 2020 | All Rights Reserved


The Blockchain Developer
D
Blockchain
Developer
Blockchain developers’ primary interests are…

Application Smart
Contract
f(abc);

…and how they interact with the ledger and other systems of record:

Traditional Traditional Systems


Ledger Processing Data Events Integration

Platforms Sources
!

They should NOT have to care about operational concerns, such


as:
X Peers Consensus Security
5
3

Page 53 © Copyright 2020 | All Rights Reserved


How applications interact with the ledger

Client
Blockchain develops
Application
developer D
SDK
develops submits

Smart emits
Contract !
event
accesses

‘get’, ‘put’, ‘delete’ recorded

Ledger
block
emits
txn txn
!
event
World state txn
Blockchain
Peer

Page 54 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric
www.blockchaintrainingalliance.com

© Copyright 2017 | All Right Reserved


Hyperledger is an Umbrella

Page 56 © Copyright 2020 | All Rights Reserved


Hyperledger History
• Released December 2015
• Open-source project, managed by the Linux Foundation
• Managers of the Linux kernel, Node.js, and more!
• “Hyperledger” is an umbrella term for many projects
• However, when most people use the term “Hyperledger” they’re talking
about Fabric & Composer
• This course focuses on development using Fabric & Composer
• 220+ corporate partners and sponsors
• IBM is the most vocal

Page 57 © Copyright 2020 | All Rights Reserved


Hyperledger Projects
• Frameworks
• Fabric
• A highly modular blockchain platform.
• Sawtooth
• Another highly modular platform which offers a unique consensus method – Proof of
Elapsed Time.
• Iroha
• A blockchain platform offering unique consensus and ordering, and multi-signature
support.
• Burrow
• Allows an EVM to be embedded in a Fabric / Sawtooth solution.
• Indy
• A blockchain platform built for identity management. Used for platform interoperability.

Page 58 © Copyright 2020 | All Rights Reserved


Hyperledger Projects

• Toolsets
• Composer
• Tool for building blockchain business networks and smart contracts.
• Quilt
• Toolset for platform interoperability.
• Explorer
• Used to view or query blocks and transaction history data on the ledger.
• Caliper
• Blockchain benchmarking and performance tuning tool.
• Cello
• Toolset for deploying blockchain infrastructure as a service.

Page 59 © Copyright 2020 | All Rights Reserved


Some Hyperledger members

Page 60 © Copyright 2020 | All Rights Reserved


How are permissioned blockchains different?

• “Public” vs “Private”
• Ethereum vs Hyperledger
• Anonymity vs Identity
• Permissionless vs Permissioned
• Native currency vs no currency
• Native ability to create coins/tokens vs. creating coins/tokens from scratch
• Currency does not provide incentive in Hyperledger solutions

Page 61 © Copyright 2020 | All Rights Reserved


How are permissioned blockchains different?
• Group consensus vs. participant consensus
• Solidity smart contracts vs JavaScript chaincode
• No mutable storage vs mutable storage (world state database)
• No native object modeling vs Composer Modeling Language
• Simple network config vs complex network config
• Transactions fees (gas) vs no transaction fees
• Financial incentive towards honesty vs employment / business
incentive towards honesty

Page 62 © Copyright 2020 | All Rights Reserved


What Hyperledger Fabric?

‣ Blockchain fabric and distributed ledger framework for business


– One of multiple blockchain platforms in the Hyperledger Project
– First "active" platform in Hyperledger project (Mar. '17)
– First "production-ready" platform (Jul. '17)

‣ Developed open-source, by IBM and others (DAH, State Street, HACERA ...)
– github.com/Hyperledger/fabric
– Initially called 'openblockchain' and contributed by IBM to Hyperledger project
– Key technology for IBM's blockchain strategy
– Actively developed, IBM and IBM Zurich play key roles

‣ Technical details
– Programmable, replicated, sharded blockchain state machine; implemented in GO
– Runs smart contracts or "chaincode" within Docker containers
9– Implements consortium blockchain using traditional consensus (BFT,
Kafka/ZooKeeper)

Page 63 © Copyright 2020 | All Rights Reserved


Why Hyperledger Fabric?

• Permissioned Network
• Confidential Transactions
• No cryptocurrency
• Programmable

Page 64 © Copyright 2020 | All Rights Reserved


Permissioned Network

Page 65 © Copyright 2020 | All Rights Reserved


Confidentiality

Page 66 © Copyright 2020 | All Rights Reserved


No Currency

Page 67 © Copyright 2020 | All Rights Reserved


Automated Processes

Page 68 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Features

• Node.js chaincode support


• Developers can now author chaincode using the most popular framework for
the world’s most popular programming language
• Channel based event service
• To enable clients to subscribe to block and block transaction events on a per-
channel basis.
• Ability to package CouchDB indexes with chaincode, to improve performance
• Ability to dynamically update client identities and affiliations
• Node.js SDK connection profiles to simplify connections to Fabric nodes
• Mutual Transport Layer Security (TLS) between Fabric nodes, and between clients
and nodes
• Ability to encrypt ledger data for confidentiality using the chaincode encryption
library
• Attribute-based Access Control in chaincode
• Chaincode APIs to retrieve client identity for access control decisions

Page 69 © Copyright 2020 | All Rights Reserved


Modular consensus in Fabric V1

‣ "Solo orderer"
– One host only
– Used in development scenarios

‣ Apache Kafka, a distributed pub/sub streaming platform


– Tolerates crashes among member nodes, resilience from Apache Zookeeper
inside
– Focus on high throughput

‣ BFT-SMaRt - Research prototype

‣ SBFT - Simple implementation of PBFT (currently under development)


– Focus on resilience

Page 70 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Architecture

External-CA Fabric-CA
Membership optional
optional 
 Services Admin

Peer

Client SDK
Endorser
Application (HFC)
Committer
O O Ledger
Chaincode
A
B

O O Events !

Ordering-Service
Hyperledger Fabric Network

Page 71 © Copyright 2020 | All Rights Reserved


Nodes in a network

Page 72 © Copyright 2020 | All Rights Reserved


Nodes

• All Blockchains have nodes. They form the blockchain and connect to other
nodes
• In blockchain - the nodes are peer to peer (distributed)
• In permissionless networks (BTC and ETH) - ALL NODES ARE EQUAL

Page 73 © Copyright 2020 | All Rights Reserved


Nodes

Page 74 © Copyright 2020 | All Rights Reserved


Nodes: Hyperledger

• In Hyperledger : ALL NODES ARE NOT EQUAL

Page 75 © Copyright 2020 | All Rights Reserved


Nodes Breakdown

Page 76 © Copyright 2020 | All Rights Reserved


Nodes Breakdown

Page 77 © Copyright 2020 | All Rights Reserved


Nodes: Client Nodes

Page 78 © Copyright 2020 | All Rights Reserved


Nodes: Client

Page 79 © Copyright 2020 | All Rights Reserved


Peers: Endorser

Page 80 © Copyright 2020 | All Rights Reserved


Endorsing Peers

• Validates the transaction


• Checks for certificates
• Executes the chaincode but does not SAVE the code to the ledger
• It is stored as a RW set and does a VOTE (endorsed or NOT endorsed)
• They are setup on the channel

Page 81 © Copyright 2020 | All Rights Reserved


Peers: Endorser

Page 82 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 1/7

Application proposes transaction

E0 P3 P4 Endorsement policy:
A
B
A • “E0, E1 and E2 must sign”
D
• (P3, P4 are not part of the policy)

Client
Application
S
D E1 Client application submits a transaction
proposal for Smart Contract A. It must
O O
K
A
B target the required peers {E0, E1, E2}

O O
Key:
P
E2 Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


(Chaincode) Policy

Propose transaction (1)

Page 83 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 2/7

Endorsers Execute
Proposals
E0 P3 P4 E0, E1 & E2 will each execute the
A A proposed transaction. None of these
B D
executions will update the ledger

Each execution will capture the set of


Client
Application
S
D E1 Read and Written data, called RW
O O
K
A sets, which will now flow in the fabric.
B

Transactions can be signed & encrypted

O O
Key:
P
E2 Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


(Chaincode) Policy

Execute Proposal (2)

Page 84 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 3/7

Application receives responses

E0 P3 P4 RW sets are asynchronously returned to


A
B
A
D application

The RW sets are signed by each


Client
Application
S
D E endorser, and also includes each record
version number
O O
K
A
1 B

(This information will be checked much


later in the consensus process)
E2
P
O O Key:
Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


(Chaincode) Policy
Proposal Response (3)

Page 85 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 4/7

Application submits responses for ordering

E0 P3 P4 Application submits responses as a


A
B
A
D transaction to be ordered.

Ordering happens across the fabric in


Client
Application
S
D E parallel with transactions submitted by
other applications
O O
K
A
1 B

O O
Key:
P
E2 Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


(Chaincode) Policy
Order Transaction (4) (other applications)

Page 86 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 5/7

Orderer delivers to all committing peers

E0 P3 P4 Ordering service collects transactions


A A into proposed blocks for distribution to
B D
committing peers. Peers can deliver to
other peers in a hierarchy (not shown)
Client
Application
S
D
K
E
A
* O O
Different ordering algorithms available:
• SOLO (Single node, development)
1 B
• Kafka (Crash fault tolerance)

O O
Key:
P
E2 Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


Deliver Transaction (5) (Chaincode) Policy

Page 87 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 6/7

Committing peers validate transactions

E0 P3 P4 Every committing peer validates against


A A the endorsement policy. Also check RW
B D
* * * sets are still valid for current world state

Validated transactions are applied to


Client
Application
S
D E1 the world state and retained on the
O O
K
A ledger
B
*
I n v alid transactions are also retained
K e y :

on
E2
P
O O thEnedolresedr ger but do not update
A state
Lwedogerrld
B
* Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


(Chaincode) Policy
Validate Transaction (6)

Page 88 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Transaction Life Cycle: Step 7/7

Committing peers notify applications

!
E0 P3 P4 Applications can register to be notified
A A when transactions succeed or fail, and
B D
when blocks are added to the ledger

Applications will be notified by each


Client
Application
S
D ! ! E peer to which they are connected
O O
K
A
1 B

O O
Key:
P
! E2 Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering Node

Smart Contract Endorsement


(Chaincode) Policy
Notify Transaction (7)

Page 89 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Concepts: Peer Nodes

• Peers receive requests from clients


• No centralization is required
• A microservices architecture

90

Page 90 © Copyright 2020 | All Rights Reserved


Peer Definitions

Page 91 © Copyright 2020 | All Rights Reserved


Peers

Page 92 © Copyright 2020 | All Rights Reserved


Anchor Peers

• Update the other peers in the organization


• They get called by the Orderers
• They receive new blocks
• They should be clusters so as not to be a single point of failure
• They are setup on channels
• Used to bridge channels

Page 93 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Concepts: Endorsement Policy

Page 94 © Copyright 2020 | All Rights Reserved


Endorsement Policy

Page 95 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Concepts : Ledger

• The ledger tracks all of the assets transactions


• Records the state changes of the assets as a result of the execution of
transactions
• All nodes have a copy of the ledger (hence the distribution)

Page 96 © Copyright 2020 | All Rights Reserved


Peers

Page 97 © Copyright 2020 | All Rights Reserved


Transactions Logs

• Transaction Log == The Ledger


• A permanent record of all transactions
• Immutable and distributed amongst nodes on the Channel
• Uses LevelDB with Update & Delete functions removed
• ALL Transactions must be conducted through chaincode

Page 98 © Copyright 2020 | All Rights Reserved


Transaction Logs

Page 99 © Copyright 2020 | All Rights Reserved


Ledger

Page 100 © Copyright 2020 | All Rights Reserved


Writing a Ledger

• Transaction Logs : All Transactions (changes to the asset)


• I.e.: I sell my ownership of my company to party B - that transfer is recorded on the
ledger
• Transaction Log is IMMUTABLE
• Transaction Log can do : CR (NEVER UD)
• Uses the LevelDB and is embedded in the peer (Transactions are inserted into here)
*you can never change this
• State Database : Current state of assets at any point in time
• I.e.: A data file that represents my company (with additional data) with one of
those attributes being the owner
• STATE DB can do: CRUD
• STATE data is: KVV and that KVV is versioned (Key | VERSION | VALUE)

Page 101 © Copyright 2020 | All Rights Reserved


What the Ledger is

Page 102 © Copyright 2020 | All Rights Reserved


Capabilities

Page 103 © Copyright 2020 | All Rights Reserved


Capabilities

Page 104 © Copyright 2020 | All Rights Reserved


Interactivity

Page 105 © Copyright 2020 | All Rights Reserved


Tx Log: Behind the Curtains

Page 106 © Copyright 2020 | All Rights Reserved


World State DB: Behind the Curtains

Page 107 © Copyright 2020 | All Rights Reserved


WorldState
Database
• Pluggable worldstate database
• Default embedded key/value implementation using LevelDB
– Support for keyed queries, but cannot query on value
• Support for Apache CouchDB
– Full query support on key and value (JSON documents)
– Meets a large range of chaincode, auditing, and reporting requirements
– Will support reporting and analytics via data replication to an analytics engine such as Spark (future)
– Id/document data model compatible with existing chaincode key/value programming model

Chaincode SHIM CouchDB

LevelDB

Page 108 © Copyright 2020 | All Rights Reserved


WorldState Database
• Current state data represents the latest values for all assets in the ledger.
• As current state represents all the committed transactions on the channel, it is sometimes
referred to as world state.

• Chaincode invocations execute transactions against the current state data.


• To make these chaincode interactions extremely efficient, the latest key/value pairs
for each asset are stored in a state database.
• The state database is simply an indexed view into the chain’s committed
transactions.
• It can be regenerated from the chain at any time.
• The state database will automatically get recovered (or generated, if needed) upon
peer startup, before new transactions are accepted.

Page 109 © Copyright 2020 | All Rights Reserved


WorldState Database

• The default state database, LevelDB, can be replaced with CouchDB.


• LevelDB is the default key/value state database for Hyperledger Fabric, and simply stores
key/value pairs.
• CouchDB is an alternative to LevelDB.
• Unlike LevelDB, CouchDB stores JSON objects.
• CouchDB supports keyed, composite, key range, and full data-rich queries.

Page 110 © Copyright 2020 | All Rights Reserved


World State DB: Behind the Curtains

Page 111 © Copyright 2020 | All Rights Reserved


World State DB: Configurability

Page 112 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Concepts: MSP

Page 113 © Copyright 2020 | All Rights Reserved


Membership Service Provider (MSP)

Page 114 © Copyright 2020 | All Rights Reserved


Certificate Authorities(CA)

Page 115 © Copyright 2020 | All Rights Reserved


Membership Service Provider (MSP)

Page 116 © Copyright 2020 | All Rights Reserved


Membership Service Provider (MSP)

Page 117 © Copyright 2020 | All Rights Reserved


Hyperledger MSP

• Businesses and Governments interact with KNOWN entities


• Because of this, a mechanism for managing identities is required
• In some cases, regulations mandate that entities know who they are doing business with (KYC,
AML as examples)

• Hyperledger is a Permissioned Network


• All identities are known
• There is no anonymous access
• Roles are defined by the business and Access is restricted
• Access and Role definition is managed by a MSP in Hyperledger

Page 118 © Copyright 2020 | All Rights Reserved


Ledger Access Diagram

119

Page 119 © Copyright 2020 | All Rights Reserved


Hyperledger MSP

• Identities in Hyperledger are managed by X.509 Certificates


• All Members are assigned a unique certificate / public key / private key
• All transactions signed with participant’s private key
• Any component in the solution can validate identity using public key
• Members are assigned certificates to validate public keys
• Even infrastructure components are given keys

• All Certificates are given by the Certificate Authority (CA)


• A trusted party that affirms the identity of an entity by signing the certificate
containing the entity’s public key

Page 120 © Copyright 2020 | All Rights Reserved


Hyperledger Permissioned Network

• Members manage identities within their organization

X509 Member Create and revoke certificates participants


Cert Org and infrastructure

Infrastructure

Participant

Page 121 © Copyright 2020 | All Rights Reserved


Public Key Infrastructure (PKI’s)

Page 122 © Copyright 2020 | All Rights Reserved


Hyperledger MSP

Page 123 © Copyright 2020 | All Rights Reserved


Hyperledger MSP

Page 124 © Copyright 2020 | All Rights Reserved


Fabric Certificate Authority
• In general, Certificate Authorities manage enrollment certificates for a
permissioned blockchain.
• Fabric-CA is the default certificate authority for Hyperledger Fabric, and
handles the registration of user identities.
• The Fabric-CA certificate authority is in charge of issuing and revoking
Enrollment Certificates (E-Certs).
• The current implementation of Fabric-CA only issues E-Certs, which
supply long term identity certificates.
• E-Certs, which are issued by the Enrollment Certificate Authority (E-CA),
assign peers their identity and give them permission to join the network
and submit transactions.
Page 125 © Copyright 2020 | All Rights Reserved
MSPs and CAs

Page 126 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Concepts: Channels

• Members can participate in multiple Hyperledger Blockchain networks


• Transactions in each network are isolated
• Accomlished via channels
• Peers connect to the channels
• Each channel has its own independent ledger (visibility is restricted to the members of each
channel)
• Channels are similar to having MULTIPLE blockchains on the same network

Page 127 © Copyright 2020 | All Rights Reserved


Channels

•Separate channels isolate transactions on different


ledgers
• – Chaincode is installed on peers that need to access
E0 the worldstate
– Chaincode is instantiated on specific channels for
specific peers
E1 – Ledgers exist in the scope of a channel
Ordering-Service • Ledgers can be shared across an entire network of peers
• Ledgers can be included only on a specific set of participants
– Peers can participate in multiple channels
– Concurrent execution for performance and scalability

Page 128 © Copyright 2020 | All Rights Reserved


Single Channel Network

• Similar to v0.6 PBFT model


• All peers connect to the same
system channel (blue).
Client
Application
S
D
K
E0 E2 • All peers have the same
A A
B
chaincode and maintain the same
B
• Endorsement
ledger by peers E0, E
E3 E and
P 1,

E1 E3 Key:

Endorser Ledger
A Ordering-Service A
B B
Committing Peer Application

Hyperledger Fabric
Ordering Node

Smart Contract Endorsement


(Chaincode) Policy

Page 129 © Copyright 2020 | All Rights Reserved


Multi Channel Network

• Peers E0 and E3 connect to the


red channel for chaincodes Y and
Z
Client
Application
S
D
K
E0 E
2 • Peers E1 and E2 connect to the
O
Z A
B
Y
blue channel for chaincodes A and
P O P
B

Client
Application
S
D
K
E O E3 Key:

Endorser Ledger
Ordering-Service
1
A Y

O
B Z
Committing Peer Application

Hyperledger Fabric
Ordering Node

Smart Contract Endorsement


(Chaincode) Policy

Page 130 © Copyright 2020 | All Rights Reserved


Future 2 Network Topology

E E

O O
E P E
O O O O
Ordering Service Ordering Service
E E
Blockchain Network Blockchain Network
1 2
• Peers will be able to connect to channels
served by different ordering services.

Peer • The peer is not connecting the three


blockchain networks but is maintaining a
Endorser
ledger for different channels.
Orderer

Page 131 © Copyright 2020 | All Rights Reserved


Future 3 Network Topology

E E

O P O
E E
O O P O O
Ordering Service Ordering Service
E E
Blockchain Network Blockchain Network
1 2
Orderin
O • Peers will be able to connect to
g
Service channels served by different
ordering services.
O O

Peer
• The peer is not connecting the three
E E E blockchain networks but is
Endorser maintaining a ledger for different
channels.
Orderer

Page 132 © Copyright 2020 | All Rights Reserved


Future Network of Networks

E E

E E E
E P E
E
P
P
E
P
E E

E P P E
E
Peer
E E
Endorser
E E E
Orderering E
Service

Page 133 © Copyright 2020 | All Rights Reserved


Hyperledger Fabric Concepts: Orderer

• Orderer Nodes are the communication backbone of the fabric blockchain


• Service gateway to request txs be added to the blockchain
• Ensures consistent ledger state across the network
• Defines recorded order of transactions
• Creates the blocks and guarantees quantized delivery
• A bit like “miners” on a public blockchain

Page 134 © Copyright 2020 | All Rights Reserved


Orderer Nodes

Page 135 © Copyright 2020 | All Rights Reserved


Orderer Nodes

Page 136 © Copyright 2020 | All Rights Reserved


Client Node to Orderer Nodes

Page 137 © Copyright 2020 | All Rights Reserved


Orderers

• Transactions within a timeframe are sorted into a block and are


committed in sequential order.
• In a blockchain network, transactions have to be written to the shared
ledger in a consistent order.
• The order of transactions has to be established to ensure that the updates to
the world state are valid when they are committed to the network.

Page 138 © Copyright 2020 | All Rights Reserved


Hyperledger Composer
www.blockchaintrainingalliance.com

© Copyright 2017 | All Right Reserved


What is Hyperledger
Composer?

“ Hyperledger Composer is a set of collaboration tools for building


blockchain business networks that make it simple and fast for
business owners and developers to create smart contracts
(Chaincode) and blockchain applications to solve business problems “

Page 140 © Copyright 2020 | All Rights Reserved


Hyperledger Composer Benefits

Increases Saves Reduces Increases


understanding time risk flexibility

Bridges simply from Develop blockchain Well tested, efficient Higher level
business concepts to applications more design conforms to abstraction makes it
blockchain quickly and cheaply best practice easier to iterate

Page 141 © Copyright 2020 | All Rights Reserved


Typical Hyperledger Composer
Architecture

Page 142 © Copyright 2020 | All Rights Reserved


Dependencies & Technologies

Language, Libraries and


Frameworks

Page 143 © Copyright 2020 | All Rights Reserved


BNA(Business Network Archive)
File

Page 144 © Copyright 2020 | All Rights Reserved


Hyperledger Composer Objects

• Business Network
• A collection of entities or organizations working together to accomplish a
common goal.
• A Business Network is made up of Participants.
• Business Networks work with Assets.

Page 145 © Copyright 2020 | All Rights Reserved


Hyperledger Concepts : Business Networks

Page 146 © Copyright 2020 | All Rights Reserved


Business Networks

Page 147 © Copyright 2020 | All Rights Reserved


Business Networks

Page 148 © Copyright 2020 | All Rights Reserved


Hyperledger Composer Objects

• Assets
• Assets have Properties
• Assets can be tangible or intangible
• Intangible assets can include:
• Financial Assets (bonds)
• Intellectual Assets (patent)
• Digital Assets (music)
• Assets are mutable, most often have a finite lifespan
• Assets can be created, read, updated, and deleted
• Represented by JSON object

Page 149 © Copyright 2020 | All Rights Reserved


Hyperledger Concepts : Assets

• Assets (Tangible or Intangible)


• In Hyperledger, assets can be represented in JSON or Binary format
• A transaction can therefore be described a change in ASSET state as
codified by well defined rules

Page 150 © Copyright 2020 | All Rights Reserved


Assets

Page 151 © Copyright 2020 | All Rights Reserved


Assets

Page 152 © Copyright 2020 | All Rights Reserved


Hyperledger Composer Objects

• Participants
• Participants have Properties
• Humans
• Organizations
• LOB Systems
• Participants are mutable, most often have a finite lifespan
• Participants can be created, read, updated, and deleted

Page 153 © Copyright 2020 | All Rights Reserved


Participants in a Business Network &
Assets

Page 154 © Copyright 2020 | All Rights Reserved


Hyperledger Composer Objects

• Transactions
• Defines how a participant can interact with an asset
• Transactions are the intersection of Assets and Participants
• Typically involves updating a property of an asset
• Logic implemented via chaincode (smart contract)
• Chaincode written in JavaScript
• Transaction data (The Ledger) is permanent
• Records can be created or read, cannot be edited or deleted

Page 155 © Copyright 2020 | All Rights Reserved


Hyperledger Composer Objects

• Queries
• Defines how data in a solution will be viewed/presented
• Permissions
• Defines who can do what in a solution
• Events
• Pub/Sub model
• Events can be subscribed to by any application, not just the app that caused
the event

Page 156 © Copyright 2020 | All Rights Reserved


Transaction

Page 157 © Copyright 2020 | All Rights Reserved


Page 158 © Copyright 2020 | All Rights Reserved
Transactions In the Model File

Page 159 © Copyright 2020 | All Rights Reserved


Events In the Model File

Page 160 © Copyright 2020 | All Rights Reserved


Flow Chart

Page 161 © Copyright 2020 | All Rights Reserved


More on this later

Page 162 © Copyright 2020 | All Rights Reserved


More on this later

Page 163 © Copyright 2020 | All Rights Reserved


ACL’s

Page 164 © Copyright 2020 | All Rights Reserved


Access Capability Concerns

Page 165 © Copyright 2020 | All Rights Reserved


Access Control

Page 166 © Copyright 2020 | All Rights Reserved


Access Control Language (ACL)

Page 167 © Copyright 2020 | All Rights Reserved


Access Control Language (ACL)

Page 168 © Copyright 2020 | All Rights Reserved


Access Control Language (ACL)

Page 169 © Copyright 2020 | All Rights Reserved


Access Control Language (ACL)

Page 170 © Copyright 2020 | All Rights Reserved


Access Control Rule

Page 171 © Copyright 2020 | All Rights Reserved


Rule

Page 172 © Copyright 2020 | All Rights Reserved


Rule

Page 173 © Copyright 2020 | All Rights Reserved


Rule

Page 174 © Copyright 2020 | All Rights Reserved


Rule

Page 175 © Copyright 2020 | All Rights Reserved


Rule

Page 176 © Copyright 2020 | All Rights Reserved


Rule

Page 177 © Copyright 2020 | All Rights Reserved


Rule

Page 178 © Copyright 2020 | All Rights Reserved


Rule

Page 179 © Copyright 2020 | All Rights Reserved


Rule

Page 180 © Copyright 2020 | All Rights Reserved


Rule

Page 181 © Copyright 2020 | All Rights Reserved


Page 182 © Copyright 2020 | All Rights Reserved
ACL Summary

Page 183 © Copyright 2020 | All Rights Reserved


Page 184 © Copyright 2020 | All Rights Reserved
Page 185 © Copyright 2020 | All Rights Reserved
Page 186 © Copyright 2020 | All Rights Reserved
Page 187 © Copyright 2020 | All Rights Reserved
Page 188 © Copyright 2020 | All Rights Reserved
Page 189 © Copyright 2020 | All Rights Reserved
Page 190 © Copyright 2020 | All Rights Reserved
Page 191 © Copyright 2020 | All Rights Reserved
Page 192 © Copyright 2020 | All Rights Reserved
Page 193 © Copyright 2020 | All Rights Reserved
Access Control Language (acl)
Hyperledger Composer differentiates between access
control for resources within a business network (business
access control) and access control for network
administrative changes (network access control). Business
access control and network access control are both defined
in the access control file (.acl) for a business network.
Network access control uses the system namespace, which
is implicitly extended by all resources in a business network;
and grants or denies access to specific actions as defined
below, and is intended to allow for more nuanced access to
certain network-level operations.
Document:
https://hyperledger.github.io/composer/reference/acl_lang
uage.html
Page 194 © Copyright 2020 | All Rights Reserved
Hyperledger Concepts: Identities

Page 195 © Copyright 2020 | All Rights Reserved


Identity

Page 196 © Copyright 2020 | All Rights Reserved


Identity

Page 197 © Copyright 2020 | All Rights Reserved


Queries

Page 198 © Copyright 2020 | All Rights Reserved


Queries

Page 199 © Copyright 2020 | All Rights Reserved


Queries

Page 200 © Copyright 2020 | All Rights Reserved


Queries

Page 201 © Copyright 2020 | All Rights Reserved


Historian

Page 202 © Copyright 2020 | All Rights Reserved


Components in a Blockchain Solution

Ledger A ledger is a channel’s chain and current state data which is maintained by each peer on the

channel.

f(abc); Software running on a ledger, to encode assets and the transaction instructions (business
Smart Contract logic) for modifying the assets.

A broader term overarching the entire transactional flow, which serves to generate an
Peer
agreement on the order and to confirm the correctness of the set of transactions constituting a
Network
block.

E Membership Services authenticates, authorizes, and manages identities on a permissioned


Membership
blockchain network.
T

Events ! Creates notifications of significant operations on the blockchain (e.g. a new block), as well as
notifications related to smart contracts.

Systems i Provides the ability to create, change and monitor blockchain components
Management

Wallet Securely manages a user’s security credentials

Systems Responsible for integrating Blockchain bi-directionally with external systems. Not part of
Integration blockchain, but used with it.

Page 203 © Copyright 2020 | All Rights Reserved


How events are used in blockchain

• In computing, an event is an occurrence that can trigger handlers txn txn txn
– e.g. disk full, fail transfer completed, mouse clicked, message received, !
temperature too hot… New
txn

• Events are important in asynchronous processing systems like


blockchain New txn
handler
• The blockchain can emit events that are useful to application
programmers
– e.g. Transaction has been validated or rejected, block has been
added…
• Events from external systems might also trigger blockchain activity
Transfer
– e.g. exchange rate has gone below a threshold, the temperature has gone confirmed

up, a time period has elapsed…

Application
20
4

Page 204 © Copyright 2020 | All Rights Reserved


Integrating with existing systems –
Possibilities

2. Blockchain
1. System
events
! events
! Existing
systems

3. Call into blockchain network


from existing systems

Transform

Blockchain network
Existing
systems

20
5

Page 205 © Copyright 2020 | All Rights Reserved


Non-determinism in Blockchain

• Blockchain is a distributed processing system random()


– Smart contracts are run multiple times and in multiple
places
– As we will see, smart contracts need to run getExchangeRate()
deterministically in order for consensus to work
• Particularly when updating the world state
getDateTime()
• It’s particularly difficult to achieve determinism
with off-chain processing
– Implement services that are guaranteed to be getTemperature()
consistent for a given transaction, or
– Detect duplicates for a transaction in the blockchain,
middleware or external system incrementValue
inExternalSystem(…
)

Page 206 © Copyright 2020 | All Rights Reserved


Network Setup
Installing and Instantiating Smart
Contract Chaincode

Operator installs then instantiates

E0 Operator installs smart contracts with


Ap A A endorsement policies to appropriate
B D
peers: E0, E1, E2, P3, and not P4
A

Operator instantiates smart contract


O E on given channel. One-time
A initialization
1 B

Policy subsequently available to all


p e ers on channel, e.g. including P4
Ke y :

E2 Endorser Ledger
A
B
Ordering-Service Committing Peer Application

Hyperledger Fabric Ordering peer

Smart Contract Endorsement


(Chaincode) Policy

Page 208 © Copyright 2020 | All Rights Reserved


Bootstrapping the Network (1/6)
Configure & Start Ordering Service

Ordering-Service

Hyperledger Fabric

• An Ordering Service is configured and started for other network peers to use

Page 209 © Copyright 2020 | All Rights Reserved


Bootstrapping the Network (2/6)
Configure and Start Peer Nodes

E E
0 2

E Ordering-Service
P4
1
Hyperledger Fabric

• A peer is configured and started for each Endorser or Committer in the network

Page 210 © Copyright 2020 | All Rights Reserved


Bootstrapping the Network (3/6)
Install Chaincode

E E
0 A
B 2 A
B

E Ordering-Service
P4
1 A
B

Hyperledger Fabric

• Chaincode is installed onto each Endorsing Peer that needs to execute it

Page 211 © Copyright 2020 | All Rights Reserved


Bootstrapping the Network (4/6)
Create Channels

E E
0 A
B 2 A
B

E Ordering-Service
P4
1 A
B

Hyperledger Fabric

• Channels are created on the ordering service

Page 212 © Copyright 2020 | All Rights Reserved


Bootstrapping the Network (5/6)
Join Channels

E E
0 A
B 2 A
B

E1 P
Ordering-Service 4
A
B

Hyperledger Fabric

• Peers that are permissioned can then join the channels they want to transact on

Page 213 © Copyright 2020 | All Rights Reserved


Bootstrapping the Network (6/6)
Instantiate Chaincode

E E
0 A
B 2 A
B

E1 P
4 Ordering-Service
A
B

Hyperledger Fabric

• Peers finally instantiate the Chaincode on the channels they want to transact on

• Once instantiated a Chaincode is live and can process transaction requests


• Endorsement Policy is specified at instantiation time

Page 214 © Copyright 2020 | All Rights Reserved

You might also like