SlideShare a Scribd company logo
Blockchain Technology
and
Applications
Dr Shoab Ahmed Khan
Lecture 8
11/19/22 1
1. UTXOs and HODL
2. Central Bank Digital Currency (CBDC)
3. Hands on Smart Contract
Outline Lec 7
11/19/22 2
1. Permissioned Blockchain
2. Hyperledger Fabric
3. Example
Outline Lec 8
11/19/22 3
Hyperledger Fabric: Permissioned
Blockchain
Smart Contract
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
What is Hyperledger Fabric?
•The Linux Foundation founded the
Hyperledger project in 2015 to advance
cross-industry blockchain technologies
Private and Permissioned
• Unlike permissionless blockchain networks,
not everyone can become part of the
network
•It is private and permissioned
Final State of Sample Network
Final State of Sample Network
CASE-FAST
FAST-NUST
CASE
Student
NUST
Student
FAST Student
CASE/FAST
Registration
FAST/NUST
Registration
HEC
R1: CASE
R2: FAST
R3: NUST
R4: HEC
Hyperledger Fabric
• Organizations R1, R2, R3 and R4 contribute infrastructure to the network
• The organizations have jointly decided, that they will set up a Hyperledger Fabric
network.
• R4 has been assigned to be the network initiator
• it has been given the power to set up the initial version of the network.
• R4 has no intention to perform business transactions on the network.
• R1 and R2 have a need for a private communications within the overall network, as do R2 and R3.
• Organization R1 has a client application that can perform business transactions within channel C1.
• Organization R2 has a client application that can do similar work both in channel C1 and C2.
• Organization R3 has a client application that can do this on channel C2.
Setting Blockchain Network
• CASE, FAST, NUST, HEC
• HEC is the Initiator
•R1 -> CASE
•R2 -> FAST
•R3 -> NUST
•R4-> HEC
Hyperledger Fabric
• Organizations CASE, FAST, NUST and HEC contribute infrastructure to the network
• The organizations have jointly decided, that they will set up a Hyperledger Fabric
network.
• HEC has been assigned to be the network initiator
• it has been given the power to set up the initial version of the network.
• HEC has no intention to perform business transactions on the network.
• CASE and FAST have a need for a private communications within the overall network, as do FAST
and NUST.
• Organization CASE has a client application that can perform business transactions within channel
C1.
• Organization FAST has a client application that can do similar work both in channel C1 and C2.
• Organization NUST has a client application that can do this on channel C2.
Hyperledger Fabric
• Peer node P1 maintains a copy of the ledger L1 associated with C1.
• Peer node P2 maintains a copy of the ledger L1 associated with C1 and a
copy of ledger L2 associated with C2.
• Peer node P3 maintains a copy of the ledger L2 associated with C2.
• Channel C1 is governed according to the policy rules specified in channel
configuration CC1
• The channel is under the control of organizations R1 and R2.
• Channel C2 is governed according to the policy rules specified in channel
configuration CC2
• the channel is under the control of organizations R2 and R3.
Hyperledger Fabric
• There is an ordering service O4 that services as a network administration
point for N, and uses the system channel.
• The ordering service also supports application channels C1 and C2, for the
purposes of transaction ordering into blocks for distribution
• Each of the four organizations has a preferred Certificate Authority.
Who gives permission? MSP
• The members of a Hyperledger Fabric
network enroll through a trusted
Membership Service Provider (MSP)
Channels
• Ability to create channels, allowing a group
of participants to create a separate ledger of
transactions
Smart Contract
• Hyperledger Fabric smart contracts are
written in chaincode
• They are invoked by an application external
to the blockchain
•when that application needs to interact with
the ledger
Chaincode
•Jave
•Node.JS
•GO
Designing Blockchain on
Hyperledger Fabric
Blockchain
Blockchain Nodes
• Consists of three different types of nodes
1. Peer
2. Orderer
3. Client
•All nodes are identified by a Membership
Service Provider (MSP) and owned by
different organizations
Nodes
•Client submits transactions
•Peer maintains the blockchain ledger in the form
of a hash chain and records the current state
with a key-value store
•Endorser is responsible for executing chaincode
to endorse transaction proposals
•Committer just updates the ledger state by
validating and committing transactions
Orderer
•Orderer implements the ordering service
•produces the total sequence for all the
transactions and batch them into blocks
Endorsement policy
•The endorsement policy specifies a set of peers
that are required to endorse transaction
proposals
•Transactions are marked as valid only if they
have been properly endorsed by specified peers
based on the endorsement policy
•It is formed by the monotone logical expression
on sets, such as “AND” and “OR”.
Ledger
•In Fabric, a ledger consists of two parts
•world state
•blockchain
•World state holds the latest ledger state in
the form of a versioned key-value store
•The blockchain ledger is maintained by all
peers,
Channel
•Channel is a logical structure formed by a collection
of specific network members
•Each channel allows a group of peers to create a
completely separate ledger
•In Fabric, a subset of organizations that want to
conduct business transactions privately can
generate a channel, thus maintaining a partition
ledger
•One organization can join multiple channels
simultaneously for a distinct purpose
Processing of Transaction
Hyperledger Fabric has three major stages in processing a transaction, namely, endorsing, ordering/batching
and validating/committing
Lecture  8  Hyperledger Fabric 2022f.pdf
Overview
Source:https://arxiv.org/pdf/1801.10228.pdf
•https://hyperledger-
fabric.readthedocs.io/it/latest/peers/peers.h
tml
Blockchain
A peer hosts instances of ledgers and instances of chaincodes
Key-Value Pair
•A key-value pair consists of two related data
elements
•A key, which is a constant that defines the data
set (e.g., gender, color, price)
• A value, which is a variable that belongs to the
set (e.g., male/female, green, 100)
Key Value Pair
•gender = male
•color = green
•price > 100
WorldState
World State
• An application program can invoke a smart
contract which uses simple ledger APIs
to get, put and delete states.
•Notice how a state value can be simple (Audi…)
or compound (type:BMW…)
•The world state is often queried to retrieve
objects with certain attributes, for example to
find all red BMWs
World State
Only transactions that are signed by the
required set of endorsing organizations will
result in an update to the world state
Lecture  8  Hyperledger Fabric 2022f.pdf
•The ledger, L, comprises a world state, W and
a blockchain, B. W contains four states with
keys: ASSET1, ASSET2, ASSET3, and ASSET4.
B contains two blocks, 0 and 1. Block 1
contains four transactions: T1, T2, T3, T4
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
file:///Users/yourusername/Downloads/electronics-08-00467.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Multiple Peers
A Peer with Multiple Ledgers
• A peer hosting multiple ledgers.
• Peers host one or more ledgers, and each
ledger has zero or more chaincodes that
apply to them.
Peer P1 hosts ledgers L1 and L2.
Ledger L1 is accessed using chaincode S1
Ledger L2 can be accessed using chaincodes S1 and S2.
A peer may have many ledger and chaincode
• Peer P1 hosts ledgers L1 and L2
• L1 is accessed by chaincodes S1 and S2,
L2 is accessed by S1 and S3.
• S1 can access both L1 and L2.
Application Interacting with the Peers
Peers and Channels
Channels allow a specific set of peers and applications to communicate with each other within a blockchain network.
application A can communicate directly with peers P1 and P2 using channel
Peers and Organizations
• Four organizations contributing eight peers to form a network.
• The channel C connects five of these peers in the network N — P1, P3, P5, P7 and P8.
• The other peers owned by these organizations have not been joined to this channel, but are typically joined to at
least one other channel.
Peers and Identity
• P1 and P2 have identities issued by CA1
• Channel C determines from a policy in its channel configuration that identities from CA1 should be associated with Org1
using ORG1.MSP.
• Similarly, P3 and P4 are identified by ORG2.MSP as being part of Org2.
Peers and Orderers
•An update transaction is quite different from a query
transaction because a single peer cannot, on its own,
update the ledger
•updating requires the consent of other peers in the
network.
•This process is called consensus, which takes much longer
to complete than a simple query.
•But when all the peers required to approve the
transaction do so, and the transaction is committed to the
ledger, peers will notify their connected applications that
the ledger has been updated.
Phase 1: Proposal
Phase 2: Ordering and packaging transactions into blocks
Ordering Service Implementation
•Raft (recommended)
•Kafka (deprecated in v2.x)
•Solo (deprecated in v2.x)
Phase 3: Validation and commit
Read-Write Set
Read-Write Set
Note: the version number is based on incremental order which basically derived from the
height of committing transactions.
•validation is done for stopping Double
spending
Lecture  8  Hyperledger Fabric 2022f.pdf
Read-Write Set
Write Set stored in World State DB
Tx 2 will get decline and thus double spending will
be avoided.
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Lecture  8  Hyperledger Fabric 2022f.pdf
Summary
11/20/22 75
https://www.ibm.com/downloads/cas/APGWOG5A
IBM Blockchain Services for SCM
11/20/22 76
11/20/22 77
IBM Blockchain Services for SCM
Supply Chain Management
Blockchain for SCM in Textile Industry
Blockchain for SCM in Textile Industry & Stakeholders
Blockchain
for
SCM
in
Textile
Industry
Blockchain
for
SCM
in
Textile
Industry
Generating Public/Private Key Pair for Blockchain SCM
A Typical Transaction
•A blockchain would not replace the broad range
of transaction-processing, accounting, and
management-control functions performed by
ERP systems, such as invoicing, payment, and
reporting.
Blockchain and ERP
•The blockchain would interface with legacy
systems across participating firms.
•Each firm would generate blocks of transactions
from its internal ERP system and add them to the
blockchain.
•This would make it easy to integrate various flows
of transactions across firms.
Blockchain and ERP

More Related Content

PDF
Blockchain Application Design and Development, and the Case of Programmable M...
PPTX
CCS339 Unit IV HYPERLEDGER FABRIC & ETHEREUM
PDF
An introduction to blockchain and hyperledger v ru
PPTX
Blockchain on the oracle cloud, the next big thing
PPTX
BlockChain-1.pptx
PPTX
Blockchain explored
PDF
Analysing Data from Blockchains - Keynote @ SOCCA 2020
PPTX
Block chain fundamentals and hyperledger
Blockchain Application Design and Development, and the Case of Programmable M...
CCS339 Unit IV HYPERLEDGER FABRIC & ETHEREUM
An introduction to blockchain and hyperledger v ru
Blockchain on the oracle cloud, the next big thing
BlockChain-1.pptx
Blockchain explored
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Block chain fundamentals and hyperledger

Similar to Lecture 8 Hyperledger Fabric 2022f.pdf (20)

PPTX
BlockChain-1.pptx
PDF
blockchain unit 3
PDF
Wwc developing hyperledger applications v4
PPTX
Blockchain Technology: Adoption Challenges, Platform and Applications
PPTX
Blockchain Technology: Adoption Challenges, Platform and Applications
PDF
Ibp technical introduction
PPTX
Anatomy of a hyperledger application
PDF
Module 2 - Protocols and Models.pdf (cisco)
PDF
Hyperledger Fabric Technical Deep Dive 20190618
PPSX
Blockchain HyperLedger Fabric Internals - Clavent
PDF
Blockchain and BPM - Reflections on Four Years of Research and Applications
PDF
IBM Blockchain Platform - Architectural Good Practices v1.0
PPTX
Introducing r3 corda™ a distributed ledger designed for financial services
PDF
Introduction to Blockchain Governance Models
PDF
Wwc developing hyperledger applications v2
PDF
Wwc developing hyperledger applications v4
PDF
Blockchain Tech Approach Whitepaper
PDF
Blockchain technology application in drones and cybersecurity
PPTX
MODULE-5_CCN.pptx
PDF
Learn Basics & advances of Hyperledger - 101-Blockchains
BlockChain-1.pptx
blockchain unit 3
Wwc developing hyperledger applications v4
Blockchain Technology: Adoption Challenges, Platform and Applications
Blockchain Technology: Adoption Challenges, Platform and Applications
Ibp technical introduction
Anatomy of a hyperledger application
Module 2 - Protocols and Models.pdf (cisco)
Hyperledger Fabric Technical Deep Dive 20190618
Blockchain HyperLedger Fabric Internals - Clavent
Blockchain and BPM - Reflections on Four Years of Research and Applications
IBM Blockchain Platform - Architectural Good Practices v1.0
Introducing r3 corda™ a distributed ledger designed for financial services
Introduction to Blockchain Governance Models
Wwc developing hyperledger applications v2
Wwc developing hyperledger applications v4
Blockchain Tech Approach Whitepaper
Blockchain technology application in drones and cybersecurity
MODULE-5_CCN.pptx
Learn Basics & advances of Hyperledger - 101-Blockchains
Ad

Recently uploaded (20)

PDF
Understanding University Research Expenditures (1)_compressed.pdf
PDF
Q2 2025 :Lundin Gold Conference Call Presentation_Final.pdf
PDF
ssrn-3708.kefbkjbeakjfiuheioufh ioehoih134.pdf
PDF
how_to_earn_50k_monthly_investment_guide.pdf
PPTX
Who’s winning the race to be the world’s first trillionaire.pptx
PPTX
Unilever_Financial_Analysis_Presentation.pptx
PDF
Dr Tran Quoc Bao the first Vietnamese speaker at GITEX DigiHealth Conference ...
PDF
caregiving tools.pdf...........................
PPTX
The discussion on the Economic in transportation .pptx
PDF
final_dropping_the_baton_-_how_america_is_failing_to_use_russia_sanctions_and...
PDF
illuminati Uganda brotherhood agent in Kampala call 0756664682,0782561496
PPTX
Introduction to Managemeng Chapter 1..pptx
PDF
1a In Search of the Numbers ssrn 1488130 Oct 2009.pdf
PPT
E commerce busin and some important issues
PDF
Lecture1.pdf buss1040 uses economics introduction
PDF
Why Ignoring Passive Income for Retirees Could Cost You Big.pdf
PDF
Circular Flow of Income by Dr. S. Malini
PPTX
Globalization-of-Religion. Contemporary World
PPTX
Session 11-13. Working Capital Management and Cash Budget.pptx
PPTX
kyc aml guideline a detailed pt onthat.pptx
Understanding University Research Expenditures (1)_compressed.pdf
Q2 2025 :Lundin Gold Conference Call Presentation_Final.pdf
ssrn-3708.kefbkjbeakjfiuheioufh ioehoih134.pdf
how_to_earn_50k_monthly_investment_guide.pdf
Who’s winning the race to be the world’s first trillionaire.pptx
Unilever_Financial_Analysis_Presentation.pptx
Dr Tran Quoc Bao the first Vietnamese speaker at GITEX DigiHealth Conference ...
caregiving tools.pdf...........................
The discussion on the Economic in transportation .pptx
final_dropping_the_baton_-_how_america_is_failing_to_use_russia_sanctions_and...
illuminati Uganda brotherhood agent in Kampala call 0756664682,0782561496
Introduction to Managemeng Chapter 1..pptx
1a In Search of the Numbers ssrn 1488130 Oct 2009.pdf
E commerce busin and some important issues
Lecture1.pdf buss1040 uses economics introduction
Why Ignoring Passive Income for Retirees Could Cost You Big.pdf
Circular Flow of Income by Dr. S. Malini
Globalization-of-Religion. Contemporary World
Session 11-13. Working Capital Management and Cash Budget.pptx
kyc aml guideline a detailed pt onthat.pptx
Ad

Lecture 8 Hyperledger Fabric 2022f.pdf

  • 1. Blockchain Technology and Applications Dr Shoab Ahmed Khan Lecture 8 11/19/22 1
  • 2. 1. UTXOs and HODL 2. Central Bank Digital Currency (CBDC) 3. Hands on Smart Contract Outline Lec 7 11/19/22 2
  • 3. 1. Permissioned Blockchain 2. Hyperledger Fabric 3. Example Outline Lec 8 11/19/22 3
  • 7. What is Hyperledger Fabric? •The Linux Foundation founded the Hyperledger project in 2015 to advance cross-industry blockchain technologies
  • 8. Private and Permissioned • Unlike permissionless blockchain networks, not everyone can become part of the network •It is private and permissioned
  • 9. Final State of Sample Network
  • 10. Final State of Sample Network CASE-FAST FAST-NUST CASE Student NUST Student FAST Student CASE/FAST Registration FAST/NUST Registration HEC R1: CASE R2: FAST R3: NUST R4: HEC
  • 11. Hyperledger Fabric • Organizations R1, R2, R3 and R4 contribute infrastructure to the network • The organizations have jointly decided, that they will set up a Hyperledger Fabric network. • R4 has been assigned to be the network initiator • it has been given the power to set up the initial version of the network. • R4 has no intention to perform business transactions on the network. • R1 and R2 have a need for a private communications within the overall network, as do R2 and R3. • Organization R1 has a client application that can perform business transactions within channel C1. • Organization R2 has a client application that can do similar work both in channel C1 and C2. • Organization R3 has a client application that can do this on channel C2.
  • 12. Setting Blockchain Network • CASE, FAST, NUST, HEC • HEC is the Initiator •R1 -> CASE •R2 -> FAST •R3 -> NUST •R4-> HEC
  • 13. Hyperledger Fabric • Organizations CASE, FAST, NUST and HEC contribute infrastructure to the network • The organizations have jointly decided, that they will set up a Hyperledger Fabric network. • HEC has been assigned to be the network initiator • it has been given the power to set up the initial version of the network. • HEC has no intention to perform business transactions on the network. • CASE and FAST have a need for a private communications within the overall network, as do FAST and NUST. • Organization CASE has a client application that can perform business transactions within channel C1. • Organization FAST has a client application that can do similar work both in channel C1 and C2. • Organization NUST has a client application that can do this on channel C2.
  • 14. Hyperledger Fabric • Peer node P1 maintains a copy of the ledger L1 associated with C1. • Peer node P2 maintains a copy of the ledger L1 associated with C1 and a copy of ledger L2 associated with C2. • Peer node P3 maintains a copy of the ledger L2 associated with C2. • Channel C1 is governed according to the policy rules specified in channel configuration CC1 • The channel is under the control of organizations R1 and R2. • Channel C2 is governed according to the policy rules specified in channel configuration CC2 • the channel is under the control of organizations R2 and R3.
  • 15. Hyperledger Fabric • There is an ordering service O4 that services as a network administration point for N, and uses the system channel. • The ordering service also supports application channels C1 and C2, for the purposes of transaction ordering into blocks for distribution • Each of the four organizations has a preferred Certificate Authority.
  • 16. Who gives permission? MSP • The members of a Hyperledger Fabric network enroll through a trusted Membership Service Provider (MSP)
  • 17. Channels • Ability to create channels, allowing a group of participants to create a separate ledger of transactions
  • 18. Smart Contract • Hyperledger Fabric smart contracts are written in chaincode • They are invoked by an application external to the blockchain •when that application needs to interact with the ledger
  • 22. Blockchain Nodes • Consists of three different types of nodes 1. Peer 2. Orderer 3. Client •All nodes are identified by a Membership Service Provider (MSP) and owned by different organizations
  • 23. Nodes •Client submits transactions •Peer maintains the blockchain ledger in the form of a hash chain and records the current state with a key-value store •Endorser is responsible for executing chaincode to endorse transaction proposals •Committer just updates the ledger state by validating and committing transactions
  • 24. Orderer •Orderer implements the ordering service •produces the total sequence for all the transactions and batch them into blocks
  • 25. Endorsement policy •The endorsement policy specifies a set of peers that are required to endorse transaction proposals •Transactions are marked as valid only if they have been properly endorsed by specified peers based on the endorsement policy •It is formed by the monotone logical expression on sets, such as “AND” and “OR”.
  • 26. Ledger •In Fabric, a ledger consists of two parts •world state •blockchain •World state holds the latest ledger state in the form of a versioned key-value store •The blockchain ledger is maintained by all peers,
  • 27. Channel •Channel is a logical structure formed by a collection of specific network members •Each channel allows a group of peers to create a completely separate ledger •In Fabric, a subset of organizations that want to conduct business transactions privately can generate a channel, thus maintaining a partition ledger •One organization can join multiple channels simultaneously for a distinct purpose
  • 28. Processing of Transaction Hyperledger Fabric has three major stages in processing a transaction, namely, endorsing, ordering/batching and validating/committing
  • 33. A peer hosts instances of ledgers and instances of chaincodes
  • 34. Key-Value Pair •A key-value pair consists of two related data elements •A key, which is a constant that defines the data set (e.g., gender, color, price) • A value, which is a variable that belongs to the set (e.g., male/female, green, 100)
  • 35. Key Value Pair •gender = male •color = green •price > 100
  • 37. World State • An application program can invoke a smart contract which uses simple ledger APIs to get, put and delete states. •Notice how a state value can be simple (Audi…) or compound (type:BMW…) •The world state is often queried to retrieve objects with certain attributes, for example to find all red BMWs
  • 38. World State Only transactions that are signed by the required set of endorsing organizations will result in an update to the world state
  • 40. •The ledger, L, comprises a world state, W and a blockchain, B. W contains four states with keys: ASSET1, ASSET2, ASSET3, and ASSET4. B contains two blocks, 0 and 1. Block 1 contains four transactions: T1, T2, T3, T4
  • 52. A Peer with Multiple Ledgers • A peer hosting multiple ledgers. • Peers host one or more ledgers, and each ledger has zero or more chaincodes that apply to them. Peer P1 hosts ledgers L1 and L2. Ledger L1 is accessed using chaincode S1 Ledger L2 can be accessed using chaincodes S1 and S2.
  • 53. A peer may have many ledger and chaincode • Peer P1 hosts ledgers L1 and L2 • L1 is accessed by chaincodes S1 and S2, L2 is accessed by S1 and S3. • S1 can access both L1 and L2.
  • 55. Peers and Channels Channels allow a specific set of peers and applications to communicate with each other within a blockchain network. application A can communicate directly with peers P1 and P2 using channel
  • 56. Peers and Organizations • Four organizations contributing eight peers to form a network. • The channel C connects five of these peers in the network N — P1, P3, P5, P7 and P8. • The other peers owned by these organizations have not been joined to this channel, but are typically joined to at least one other channel.
  • 57. Peers and Identity • P1 and P2 have identities issued by CA1 • Channel C determines from a policy in its channel configuration that identities from CA1 should be associated with Org1 using ORG1.MSP. • Similarly, P3 and P4 are identified by ORG2.MSP as being part of Org2.
  • 58. Peers and Orderers •An update transaction is quite different from a query transaction because a single peer cannot, on its own, update the ledger •updating requires the consent of other peers in the network. •This process is called consensus, which takes much longer to complete than a simple query. •But when all the peers required to approve the transaction do so, and the transaction is committed to the ledger, peers will notify their connected applications that the ledger has been updated.
  • 60. Phase 2: Ordering and packaging transactions into blocks
  • 61. Ordering Service Implementation •Raft (recommended) •Kafka (deprecated in v2.x) •Solo (deprecated in v2.x)
  • 62. Phase 3: Validation and commit
  • 64. Read-Write Set Note: the version number is based on incremental order which basically derived from the height of committing transactions.
  • 65. •validation is done for stopping Double spending
  • 68. Write Set stored in World State DB
  • 69. Tx 2 will get decline and thus double spending will be avoided.
  • 77. 11/20/22 77 IBM Blockchain Services for SCM
  • 78. Supply Chain Management Blockchain for SCM in Textile Industry
  • 79. Blockchain for SCM in Textile Industry & Stakeholders
  • 82. Generating Public/Private Key Pair for Blockchain SCM
  • 84. •A blockchain would not replace the broad range of transaction-processing, accounting, and management-control functions performed by ERP systems, such as invoicing, payment, and reporting. Blockchain and ERP
  • 85. •The blockchain would interface with legacy systems across participating firms. •Each firm would generate blocks of transactions from its internal ERP system and add them to the blockchain. •This would make it easy to integrate various flows of transactions across firms. Blockchain and ERP