Contenu connexe Similaire à Hyperledger Fabric in a Nutshell (20) Hyperledger Fabric in a Nutshell2. ISEM4035 2© 2019 Daniel K.C. Chan. All rights reserved.
◦ Introduction to Hyperledger
◦ Introduction to Hyperledger Fabric
◦ Key Components
◦ Membership
◦ Ledger
◦ Chaincode
◦ Privacy
◦ Peers
◦ Consensus
◦ Use Cases
◦ Application Development
Contents
Hyperledger Overview
3. ISEM4035 3© 2019 Daniel K.C. Chan. All rights reserved.
Introduction to Hyperledger
Hyperledger Overview
https://www.hyperledger.org/about
4. ISEM4035 4© 2019 Daniel K.C. Chan. All rights reserved.
Shortcomings of Existing Blockchains
Hyperledger Overview
http://yalejreg.com/nc/on-settlement-finality-and-distributed-ledger-technology-by-nancy-liao/
Limited
Throughput
Poor
Governance
No
Privacy
Slow
Transaction
Confirmation
No
Settlement
Finality
Anonymous
Processors
Designed for
Cryptocurrency
5. ISEM4035 5© 2019 Daniel K.C. Chan. All rights reserved.
Introducing Hyperledger
Hyperledger Overview
Open source
collaborative effort to
advance cross-
industry blockchain
technologies
Hosted by The Linux
Foundation, fastest-
growing project in the
Foundation’s history
Global collaboration
spanning finance,
banking, IoT, supply
chains, healthcare,
manufacturing,
technology & more
6. ISEM4035 6© 2019 Daniel K.C. Chan. All rights reserved.
Shared Ledger Database
Hyperledger Overview
Blockchain allows multiple different parties to securely
interact with the same universal source of truth
Finance
Streamline settlement,
improve liquidity, increase
transparency, and new
products/markets
Healthcare
Use disparate processes,
increase data flow & liquidity,
reduce costs, and improve
patient experience &
outcomes
Supply Chain
Track parts & service
provenance, ensure
authenticity of goods, block
counterfeits, reduce conflicts
7. ISEM4035 7© 2019 Daniel K.C. Chan. All rights reserved.
Hyperledger Goals
Hyperledger Overview
Create enterprise grade software
open source, distributed ledger
frameworks & code bases
to support business transactions
Provide community-driven
infrastructures
that are open, neutral and
supported by technical and
business governance
Build technical communities
to develop blockchain and shared
ledger POCs, use cases, field
trials and deployments
Promote our communities
taking a toolkit approach with
many platforms and frameworks
Educate the public
about the market opportunity
for blockchain technology
8. ISEM4035 8© 2019 Daniel K.C. Chan. All rights reserved.
Hyperledger Modular Umbrella Approach
Hyperledger Overview
9. ISEM4035 10© 2019 Daniel K.C. Chan. All rights reserved.
Benefits
Hyperledger Overview
Flexible Modification
of Any Component
Common Functional
Modules and Defined
Interfaces
Re-use of Common
Building Blocks
Diverse Developer
Community
Rapid
Experimentation
Extensible
Codebases
10. ISEM4035 11© 2019 Daniel K.C. Chan. All rights reserved.
Introduction to
Hyperledger Fabric
Hyperledger Overview
https://www.hyperledger.org/projects/fabric
11. ISEM4035 12© 2019 Daniel K.C. Chan. All rights reserved.
▪ A distributed ledger is a type of data structure which resides across multiple
computer devices, generally spread across locations or regions
▪ While distributed ledgers existed prior to Bitcoin, the Bitcoin blockchain marks the
convergence of a host of technologies, including timestamping of transactions, Peer-to-
Peer (P2P) networks, cryptography, and shared computational power, along with a new
consensus algorithm.
▪ DLT generally consists of three basic components
▪ A data model that captures the current state of the ledger - blockchain
▪ A language of transactions that changes the ledger state – smart contracts
▪ A protocol used to build consensus among participants around which transactions will be
accepted, and in what order, by the ledger
Hyperledger is considered a Distributed Ledger Technology
(DLT)
Hyperledger Overview
12. ISEM4035 13© 2019 Daniel K.C. Chan. All rights reserved.
Hyperledger Fabric is a platform for developing distributed
applications with a modular & secure architecture
Hyperledger Overview
Permissioned network
Collectively define
membership & access
rights within the business
network
Confidential transactions
Give businesses the
flexibility & security to make
transactions visible to select
parties with the correct
encryption keys
No cryptocurrency
Require no mining
and expensive
computations to
assure transactions
Programmable
Leverage the embedded
logic in smart contracts to
automate business
processes across the
network
13. ISEM4035 14© 2019 Daniel K.C. Chan. All rights reserved.
▪ Independent and agnostic of all alt-coins, cryptocurrencies, and tokens
▪ Will never issue its own cryptocurrency by design
▪ Hyperledger exists to create enterprise blockchain software, not to administer
any cryptocurrency
▪ Having said that, the design philosophy includes the capability to create a token
used to manage digital objects, which may represent currencies, although this is
not required for the network to operate
Hyperledger Fabric is cryptocurrency-agnostic
Hyperledger Overview
14. ISEM4035 15© 2019 Daniel K.C. Chan. All rights reserved.
▪ Hyperledger Fabric also offers several pluggable options
▪ Ledger data can be stored in multiple formats
▪ Consensus mechanisms can be swapped in and out
▪ Different Membership Service Providers (MSPs) are supported
Hyperledger Fabric is modular and pluggable
Hyperledger Overview
15. ISEM4035 16© 2019 Daniel K.C. Chan. All rights reserved.
Comparing Hyperledger with Bitcoin and Ethereum
Hyperledger Overview
Bitcoin Ethereum Hyperledger Frameworks
Cryptocurrency-based Yes Yes No
Permissioned No No Yes*
Pseudo-anonymous Yes Yes No
Auditable Yes Yes Yes
Modularity No No Yes
Smart contracts No Yes Yes
Consensus protocol PoW PoW Various#
* Sawtooth can be configured to be permissionless.
# Key Hyperledger consensus protocols are Apache Kafka in Hyperledger Fabric, PoET and RAFT in Hyperledger Sawtooth, RBFT (Plenum)
in Hyperledger Indy, Tendermint in Hyperledger Burrow, and Yet Another Consensus (YAC) in Hyperledger Iroha.
16. ISEM4035 17© 2019 Daniel K.C. Chan. All rights reserved. Hyperledger Overview
1) A participant in the member Organization invokes a transaction request through the client application.
2) Client application broadcasts the transaction invocation request to the Endorser peer.
3) Endorser peer checks the Certificate details and others to validate the transaction. Then it executes the Chaincode (i.e. Smart
Contract) and returns the Endorsement responses to the Client. Endorser peer sends transaction approval or rejection as part of
the endorsement response.
4) The client now sends the approved transaction to the Orderer peer for this to be properly ordered and be included in a block.
5) Orderer node includes the transaction into a block and forwards the block to
the Anchor nodes of different member Organizations of the Hyperledger
Fabric network.
6) Anchor nodes then broadcast the block to the other peers inside their own
organization. These individual peers then update their local ledger with the
latest block. Thus all the network gets the ledger synced.
17. ISEM4035 18© 2019 Daniel K.C. Chan. All rights reserved.
Case Study: Cross-Border Payments
Hyperledger Overview
The Challenge
Transferring money across
international borders is still
complicated, time consuming and
expensive.
The Collaboration
A global team of developers from
Hyperledger members SWIFT, ANZ,
BNP Paribas, BNY Mellon and Wells
Fargo create a cross-border POC.
built with Hyperledger Fabric.
The Technology
The blockchain trial was built on
Hyperledger Fabric and is now ready
for its next phase of testing.
18. ISEM4035 19© 2019 Daniel K.C. Chan. All rights reserved.
Case Study: Diamond Supply Chain
Hyperledger Overview
The Challenge
The Kimberley Process Certification
Scheme established in 2003 to
prevent conflict diamonds is a long,
paperwork-heavy process with a
history of fraud from missing
documents.
The Collaboration
Hyperledger members SAP Ariba and
IBM are collaborating with Everledger
on a pilot to prevent blood diamonds
from entering the supply chain.
The Technology
The distributed ledger diamond track
and trace system using Hyperledger
Fabric v1.0 allows everyone in the
industry to write to it, from miners,
distributors and retailers, using the
light pattern that is unique to every
diamond to create an ID.
19. ISEM4035 20© 2019 Daniel K.C. Chan. All rights reserved.
Case Study: Green Assets Management
Hyperledger Overview
The Challenge
Generating carbon assets more
efficiently, helping to build a green,
low-carbon and environmentally-
friendly future in China.
The Collaboration
General Hyperledger member Energy
Blockchain Labs partnered with
Premier member IBM on the world’s
first blockchain-based green assets
management platform. based on
Hyperledger Fabric.
The Technology
Blockchain technology, like the use of
Hyperledger Fabric here, is expected
to become an important means for
effective control of carbon emissions
in China, the world's largest source of
carbon emissions. Carbon asset
development, is one of the most
popular ways of encouraging
enterprises to decrease emissions
and use low carbon emission
technology.
20. ISEM4035 21© 2019 Daniel K.C. Chan. All rights reserved.
Hyperledger Fabric Key
Components
Hyperledger Overview
https://hyperledger-fabric.readthedocs.io/en/release-1.4/key_concepts.html
22. ISEM4035 23© 2019 Daniel K.C. Chan. All rights reserved.
▪ Most cryptocurrencies use permissionless blockchains where anyone can join and
have full rights to use it
▪ e.g. anyone can buy BTC or ETH because those use wide-open, permissionless
blockchains
▪ On the other hand, business blockchains tend to be permissioned
▪ A person needs to meet certain requirements to perform certain actions on the blockchain
▪ Some permissioned blockchains restrict access to pre-verified users who have already
proven they are who they say they are
▪ Others allow anyone to join, but only let trusted identities verify transactions on the
blockchain
▪ Members of a Hyperledger Fabric network enroll through a trusted Membership Service
Provider (MSP)
Trust can be handled through the use of permissionless and
permissioned blockchains
Hyperledger Overview
23. ISEM4035 24© 2019 Daniel K.C. Chan. All rights reserved.
▪ Hyperledger Fabric network has different actors (e.g. peers, orderers, client
applications, and administrators) that can consume services
▪ Each actor has a digital identity encapsulated in an X.509 digital certificate
▪ These identities determine the exact permissions over resources and access to
information that actors have in a blockchain network
▪ A digital identity furthermore has some additional attributes that Hyperledger
Fabric uses to determine permissions, and it gives the union of an identity and
the associated attributes a special name - principal
▪ Principals are just like userIDs or groupIDs, but a little more flexible because they can
include a wide range of properties of an actor’s identity, such as the actor’s
organization, organizational unit, role or even the actor’s specific identity
Each actor in a Hyperledger Fabric network has a digital
identity encapsulated in an X.509 digital certificate
Hyperledger Overview
24. ISEM4035 25© 2019 Daniel K.C. Chan. All rights reserved.
▪ A PKI is comprised of
Certificate Authorities who
issue digital certificates to
parties
▪ Parties then use them to
authenticate themselves in the
messages they exchange with
their environment
▪ A CA’s Certificate Revocation
List (CRL) constitutes a
reference for the certificates
that are no longer valid
Hyperledger Fabric provides a built-in CA component to
allow CAs to be created in your blockchain networks
Hyperledger Overview
▪ For an identity to be verifiable, it must
come from a trusted authority
▪ The default MSP implementation uses
X.509 certificates as identities, adopting a
traditional Public Key Infrastructure (PKI)
25. ISEM4035 26© 2019 Daniel K.C. Chan. All rights reserved.
Permissioned Network
Hyperledger Overview
26. ISEM4035 27© 2019 Daniel K.C. Chan. All rights reserved.
▪ Hyperledger Fabric underpins a transactional network where all participants
have known identities
▪ PKI is used to generate cryptographic certificates which are tied to
organizations, network components, and end users or client applications
▪ As a result, data access control can be manipulated and governed on the
broader network and on channel levels
▪ This permissioned notion of Hyperledger Fabric, coupled with the existence and
capabilities of channels, helps address scenarios where privacy and
confidentiality are paramount concerns
An MSP can identify roles an actor might play and sets the
access privileges in the context of a network and channel
Hyperledger Overview
27. ISEM4035 28© 2019 Daniel K.C. Chan. All rights reserved.
Membership Service
Hyperledger Overview
https://hyperledger-fabric.readthedocs.io/en/release-1.4/idemix.html
29. ISEM4035 30© 2019 Daniel K.C. Chan. All rights reserved.
▪ A Hyperledger Fabric ledger stores important factual information about business
objects; both the current value of the attributes of the objects and the history of
transactions that resulted in these current values
▪ While the facts about the current state of a business object may change, the
history of facts about it is immutable, it can be added to, but it cannot be
retrospectively changed
▪ A blockchain can therefore be understood as an immutable history of facts
about business objects
A blockchain can be understood as an immutable history of
facts about business objects
Hyperledger Overview
30. ISEM4035 31© 2019 Daniel K.C. Chan. All rights reserved.
▪ The ledger is a combination of the world state database and the transaction log
history
▪ Each participant has a copy of the ledger to every Hyperledger Fabric network they
belong to
▪ The world state describes the state of the ledger at a given point in time
▪ It is the database of the ledger
▪ The transaction log records all transactions which have resulted in the current
value of the world state
▪ It is the update history for the world state
Hyperledger Fabric ledger is a combination of the world
state and the transaction log
Hyperledger Overview
31. ISEM4035 32© 2019 Daniel K.C. Chan. All rights reserved.
▪ The ledger has a replaceable data store
for the world state
▪ By default, the world state is a LevelDB
database containing key-value pairs
▪ Production system normally uses
CouchDB
▪ The transaction log does not need to be
pluggable
▪ It simply records the before and after
values of the ledger database being
used by the blockchain network
A Hyperledger Fabric ledger is a blockchain storing the
immutable, sequenced transactions and the current state
Hyperledger Overview
PDC = Private Data Collection
33. ISEM4035 34© 2019 Daniel K.C. Chan. All rights reserved.
▪ Whereas a ledger holds facts about the current and historical state of a set of
business objects, a smart contract defines the executable logic that generates
new facts that are added to the ledger
▪ In general, a smart contract defines the transaction logic that controls the lifecycle
of a business object contained in the world state
▪ A smart contract is then packaged into a chaincode which is then deployed to a
blockchain network.
▪ Chaincodes execute against the ledger’s current state database and are initiated
through a transaction proposal and result in a set of key-value writes (write set)
that can be submitted to the network and applied to the ledger on all peers
Chaincode defines assets & the business logic in the form
of transaction instructions for modifying the assets
Hyperledger Overview
34. ISEM4035 35© 2019 Daniel K.C. Chan. All rights reserved.
▪ Assets enable the exchange of almost anything with monetary value over the
network, from whole foods to antique cars to currency futures
▪ Assets can range from the tangible (real estate and hardware) to the intangible
(contracts and intellectual property)
▪ Hyperledger Fabric provides the ability to define assets using chaincode & the
transaction instructions for modifying the assets
▪ Assets are represented in Hyperledger Fabric as a collection of key-value pairs,
with state changes recorded as transactions on a ledger
▪ Chaincode can be implemented in several programming languages
▪ Currently, Golang, Node.js, and Java are supported
Assets are represented in Hyperledger Fabric as a
collection of key-value pairs
Hyperledger Overview
36. ISEM4035 37© 2019 Daniel K.C. Chan. All rights reserved.
▪ Hyperledger Fabric offers the ability to create channels
▪ A channel allows a group of participants to create a separate blockchain
network
▪ If two participants form a channel, then those participants - and no others - have copies
of the ledger for that channel
▪ This is an especially important option for networks where some participants
might be competitors and not want every transaction they make to be shared - a
special price they are offering to some participants and not others
Channel is used to enforce privacy and control information
sharing
Hyperledger Overview
37. ISEM4035 38© 2019 Daniel K.C. Chan. All rights reserved.
▪ A ledger exists in the scope of a channel
▪ It can be shared across the entire network (assuming every participant is operating on
one common channel)
▪ It can be privatized to include only a specific set of participants
▪ In the latter scenario, these participants would create a separate channel and
thereby isolate/segregate their transactions & ledger
▪ In order to solve scenarios that want to bridge the gap between total
transparency and privacy, chaincode can be installed only on peers that need to
access the asset states to perform reads and writes
▪ In other words, if a chaincode is not installed on a peer, it will not be able to properly
interface with the ledger
There can be multiple channels in the network and each
channel has an isolated ledger
Hyperledger Overview
38. ISEM4035 39© 2019 Daniel K.C. Chan. All rights reserved.
Contract Confidentiality
Hyperledger Overview
39. ISEM4035 40© 2019 Daniel K.C. Chan. All rights reserved.
▪ When a subset of organizations on that channel need to keep their transaction
data confidential, a private data collection (collection) is used
▪ A collection is logically separate from the channel ledger, accessible only to the
authorized subset of organizations
▪ Thus, channels keep transactions private from the broader network whereas
collections keep data private between subsets of organizations on the channel
▪ To further obfuscate the data, values within chaincode can be encrypted (in part
or in total) using common cryptographic algorithms such as AES before sending
transactions to the ordering service and appending blocks to the ledger
▪ Once encrypted data has been written to the ledger, it can be decrypted only by a user
in possession of the corresponding key that was used to generate the cipher text
There can be multiple subsets of an organisation in the
network and each subset can have its own data collection
Hyperledger Overview
41. ISEM4035 42© 2019 Daniel K.C. Chan. All rights reserved.
▪ A blockchain network is comprised
primarily of a set of peer nodes (or,
simply, peers)
▪ Peers are a fundamental element of
the network because they host
ledgers and smart contracts
▪ Smart contracts and ledgers are
used to encapsulate the
shared processes and
shared information in a network,
respectively
A blockchain is comprised of peer nodes, each of which can
hold copies of ledgers and copies of smart contracts
Hyperledger Overview
42. ISEM4035 43© 2019 Daniel K.C. Chan. All rights reserved.
A peer can host multiple ledgers and each ledger can have
one or more chaincodes applicable to it
Hyperledger Overview
▪ A peer is able to host more than one
ledger, which is helpful because it
allows for a flexible system design
▪ Peers host one or more ledgers, and
each ledger has zero or more
chaincodes that apply to them
43. ISEM4035 44© 2019 Daniel K.C. Chan. All rights reserved.
Orderer provides a shared communication channel to clients
& peers and a total order for transactions published
Hyperledger Overview
44. ISEM4035 45© 2019 Daniel K.C. Chan. All rights reserved.
Channels allow a specific set of peers and applications to
communicate with each other within a blockchain network
Hyperledger Overview
45. ISEM4035 46© 2019 Daniel K.C. Chan. All rights reserved.
Blockchain networks are administered by a collection of
organizations rather than a single organization
Hyperledger Overview
46. ISEM4035 47© 2019 Daniel K.C. Chan. All rights reserved.
Each and every peer in the network is assigned a digital
certificate by an administrator from its owning organization
Hyperledger Overview
47. ISEM4035 48© 2019 Daniel K.C. Chan. All rights reserved.
▪ The process aims to ensure that all the peers in a Hyperledger Fabric network
keep their ledgers consistent with each other
1) In the 1st phase, applications work with a subset of endorsing peers, each of which
provide an endorsement of the proposed ledger update to the application, but do not
apply the proposed update to their copy of the ledger
2) In the 2nd phase, these separate endorsements are collected together as transactions
and packaged into blocks
3) In the 3rd phase, these blocks are distributed back to every peer where each
transaction is validated before being applied to that peer’s copy of the ledger
▪ Applications and peers use orderers (that are central to the process) to generate
ledger updates that can be consistently applied to a distributed, replicated
ledger
Applications that want to update the ledger are involved in a
3-phase process
Hyperledger Overview
48. ISEM4035 49© 2019 Daniel K.C. Chan. All rights reserved.
Phase 1 concerns an app asking different endorsing peers
to agree to the results of the proposed chaincode invocation
Hyperledger Overview
Note: it does not involve orderers
The endorsement policy defines the set of organizations that need to endorse a proposed
ledger change before it can be accepted by the network
49. ISEM4035 50© 2019 Daniel K.C. Chan. All rights reserved.
▪ Application clients submit transactions containing endorsed transaction proposal
responses to an ordering service node
▪ The ordering service creates blocks of transactions which will be distributed to
all peers on the channel for final validation and commit in phase three
▪ Ordering service nodes receive transactions from many different application clients
concurrently work together to collectively form the ordering service
▪ The sequencing of transactions in a block is not necessarily the same as the
order received by the ordering service, since there can be multiple ordering
service nodes that receive transactions at approximately the same time
▪ What is important is that the ordering service puts the transactions into a strict
order, and peers will use this order when validating and committing transactions
Phase 2 orders the transactions containing endorsed
transaction proposal responses into blocks
Hyperledger Overview
50. ISEM4035 51© 2019 Daniel K.C. Chan. All rights reserved.
Phase 2 orders the transactions containing endorsed
transaction proposal responses into blocks for distribution
Hyperledger Overview
In Hyperledger Fabric, the blocks generated by the ordering
service are final.
Once a transaction has been written to a block, its
position in the ledger is immutably assured.
51. ISEM4035 52© 2019 Daniel K.C. Chan. All rights reserved.
▪ It begins with the orderer distributing blocks to all peers connected to it
▪ Not every peer needs to be connected to an orderer - peers can cascade blocks to
other peers using the gossip protocol
▪ Each peer will validate distributed blocks independently, but in a deterministic
fashion, ensuring that ledgers remain consistent
▪ Specifically, each peer in the channel will validate each transaction in the block to
ensure it has been endorsed by the required organization’s peers, that its
endorsements match, and that it has not become invalidated by other recently
committed transactions which may have been in-flight when the transaction was
originally endorsed
▪ Invalidated transactions are still retained in the immutable block but they are
marked as invalid by the peer and do not update the ledger’s state
Phase 3 involves the distribution to & subsequent validation
of blocks by peers, where they can be applied to the ledger
Hyperledger Overview
52. ISEM4035 53© 2019 Daniel K.C. Chan. All rights reserved.
Phase 3 sees the blocks generated by the ordering service
applied consistently to the ledger
Hyperledger Overview
The second role of an ordering node is to distribute blocks to peers.
53. ISEM4035 54© 2019 Daniel K.C. Chan. All rights reserved.
Consensus in a
channel
Hyperledger Overview
0) Application & all peers enrol with
their MSP’s
1) Application submits a proposal
in the “blue” channel
2) Endorsing peers in the “blue”
channel endorse the proposal
3) Application submits endorsed
proposal to the Ordering Service
4) Ordering Service orders the
transactions and packages them
as blocks
5) Ordering Service delivers blocks
to all peers on the channel and
the peers commit them to their
ledgers
55. ISEM4035 56© 2019 Daniel K.C. Chan. All rights reserved.
▪ In distributed ledger technology, consensus has recently become synonymous
with a specific algorithm, within a single function
▪ However, consensus encompasses more and this differentiation is highlighted in
Hyperledger Fabric through its fundamental role in the entire transaction flow
▪ Proposal
▪ Endorsement
▪ Ordering
▪ Validation
▪ Commitment
▪ In a nutshell, consensus is defined as the full verification cycle of the
correctness of a set of transactions comprising a block
Consensus is a full verification cycle
Hyperledger Overview
56. ISEM4035 57© 2019 Daniel K.C. Chan. All rights reserved.
▪ Consensus is achieved ultimately when the order and results of a block’s transactions
have met the explicit policy criteria checks
▪ These checks take place during the lifecycle of a transaction, and include the usage of
endorsement policies to dictate which specific members must endorse a certain
transaction class, as well as system chaincodes to ensure the policy enforcement
▪ Prior to commitment, the peers will employ these chaincodes to make sure that enough
endorsements are present, and that they were derived from the appropriate entities
▪ A versioning check will take place during which the current state of the ledger is agreed or
consented upon, before any blocks containing transactions are appended to the ledger
▪ This final check provides protection against double spend operations and other threats
that might compromise data integrity, and allows for functions to be executed against non-
static variables
Transaction endorsement, ordering, validation, and
commitment are governed by policies
Hyperledger Overview
57. ISEM4035 58© 2019 Daniel K.C. Chan. All rights reserved.
▪ In addition to the multitude of endorsement, validity and versioning checks that
take place, there are also ongoing identity verifications happening in all
directions of the transaction flow
▪ Access control lists are implemented on hierarchical layers of the network
(ordering service down to channels), and payloads are repeatedly signed,
verified and authenticated as a transaction proposal passes through the
different architectural components
▪ To conclude, consensus is not merely limited to ordering of transactions; rather,
it is an overarching characterization that is achieved as a byproduct of the
ongoing verifications that take place during a transaction’s journey from
proposal to commitment
Identity verification is an ongoing check during the entire
transaction life cycle
Hyperledger Overview
58. ISEM4035 59© 2019 Daniel K.C. Chan. All rights reserved.
Consensus Service
Hyperledger Overview
59. ISEM4035 60© 2019 Daniel K.C. Chan. All rights reserved.
▪ Lottery-based algorithms are
advantageous in that they can
scale to a large number of
nodes
▪ Voting-based algorithms
provide low-latency finality
▪ The table shows the main
considerations and pros & cons
of different business blockchain
approaches to reaching
consensus
Consensus has different implementations, each targeting
different network requirements & fault tolerance models
Hyperledger Overview
Permissioned
Lottery-Based
Permissioned
Voting-Based
Standard Proof
of Work
Example PoET / PoW SBFT Bitcoin
Speed Good Good Poor
Scalability Good Moderate Good
Finality Moderate Good Poor
60. ISEM4035 61© 2019 Daniel K.C. Chan. All rights reserved.
Use Case – Supply Chain
Hyperledger Overview
62. ISEM4035 63© 2019 Daniel K.C. Chan. All rights reserved.
▪ Final assemblers (e.g. automobile manufacturers) can create a supply chain
network co-managed by its peers and suppliers
▪ A final assembler can better manage its suppliers and be more responsive to
events that would require vehicle recalls (possibly triggered by faulty parts
provided by a supplier)
▪ The blockchain must provide a protocol to allow every participant on the supply
chain network to input and track numbered parts that are produced and used on
a specific vehicle
Supply chain blockchain will require partners along the
chain to input and track numbered items
Hyperledger Overview
63. ISEM4035 64© 2019 Daniel K.C. Chan. All rights reserved.
Backward searching capability is core of establishing
provenance of manufactured goods
Hyperledger Overview
The need to provide deep
searchability backwards through
as many as 5-10 transaction
layers is the core of establishing
provenance of any manufactured
goods that is made up of other
component goods and supplies
64. ISEM4035 65© 2019 Daniel K.C. Chan. All rights reserved.
Persona identified in the use case will be captured as users
and organisations in the blockchain application
Persona Description
Final Assembler The business entity that performs the final assembly of a
product.
Part Supplier Supplier of parts. Part Suppliers can also be Assemblers by
assembling parts that they receive from their sub-suppliers,
and then sending their finished products to the Final
Assembler.
Hyperledger Overview
65. ISEM4035 66© 2019 Daniel K.C. Chan. All rights reserved.
Tasks identified in the use case will be captured as
chaincodes and privacy setting in the blockchain application
Task Description
Payment upon
delivery of goods
Integration with off-chain payment systems is required.
Payment instructions can be sent when parts are received.
Third party audit All supplied parts must be auditable by third parties. For
example, regulators might need to track the total number of
parts supplied by a specific supplier, for tax accounting
purposes.
Obfuscation of
shipments
Balances must be obfuscated so that no supplier can deduce
the business activities of any other supplier.
Hyperledger Overview
66. ISEM4035 67© 2019 Daniel K.C. Chan. All rights reserved.
Tasks identified in the use case will be captured as
chaincodes and privacy setting in the blockchain application
Task Description
Obfuscation of
market size
Total balances must be obfuscated so that part suppliers
cannot deduce their own market share to use as leverage
when negotiating contractual terms.
Validation access Only nodes with validation rights are allowed to validate
transactions (shipment of parts).
View access Only accounts with view access rights are allowed to
interrogate balances of shipped parts and available parts.
Hyperledger Overview
68. ISEM4035 69© 2019 Daniel K.C. Chan. All rights reserved. Hyperledger Overview
How Walmart brought
unprecedented transparency
to the food supply chain with
Hyperledger Fabric
69. ISEM4035 70© 2019 Daniel K.C. Chan. All rights reserved.
Challenge Approach Results
▪ When an outbreak of a
food-borne disease
happens, it can take
days, if not weeks, to
find its source.
▪ Better traceability could
help save lives by
allowing companies to
act faster and protect the
livelihoods of farmers by
only discarding produce
from the affected farms.
▪ For pork, Walmart could
upload certificates of
authenticity to the
blockchain, bringing
more trust to the system.
▪ For mangoes, the time
needed to trace their
provenance went from 7
days to 2.2 seconds.
▪ Walmart can now trace
the origin of over 25
products from 5 different
suppliers.
▪ Walmart created a food
traceability system
based on Hyperledger
Fabric.
▪ Two proof of concept
projects.
▪ One project was about
tracing mangos sold in
Walmart’s US stores.
▪ The other aimed to trace
pork sold in its China
stores.
Hyperledger Overview
70. ISEM4035 71© 2019 Daniel K.C. Chan. All rights reserved.
▪ We rarely think about it, but the modern food
system is a marvel
▪ We have access to fresh produce all year
round, buy exotic food from all around the
world, and have more variety than our
ancestors could ever dream of
▪ Our food is generally safe to eat but still,
occasionally it can make us sick
▪ In 2018 there were at least 18 reported
outbreaks of foodborne illnesses in the USA,
including the E. coli found in romaine lettuce
Our food is generally safe to eat but outbreaks of foodborne
disease do occasionally occur
Hyperledger Overview
71. ISEM4035 72© 2019 Daniel K.C. Chan. All rights reserved.
▪ When an outbreak of a food-borne disease does happen, it can take days, if not
weeks, to find its source
▪ If investigators cannot point to a specific farm or farms, the government usually
advises consumers to avoid products grown in a certain area, or even to avoid
the type of product altogether
▪ According to Walmart, millions of bags or heads of lettuce had to be removed,
and consumers lost confidence in romaine lettuce altogether
▪ Traceability could help save lives by allowing companies to act faster & protect
the livelihoods of farmers by only discarding produce from the affected farms
▪ For this reason, Walmart has always been interested in enhancing transparency
and traceability in the food system
Without traceability, government usually advises consumers
to avoid problematic products or those from a certain area
Hyperledger Overview
72. ISEM4035 73© 2019 Daniel K.C. Chan. All rights reserved.
▪ After reviewing different blockchain
technologies, Walmart decided to go with
Hyperledger Fabric because it met most of
their needs plus being an enterprise-grade
solution supporting permissioned networks
▪ The team also found it important to work with
an open-source, vendor-neutral blockchain
▪ Since the food traceability system was meant
to be used by many parties, including
Walmart’s suppliers and even direct
competitors, the technology ecosystem
underlying it needed to be open
Food traceability needs to be open as it involves a large
number of participants and possibly different technologies
Hyperledger Overview
73. ISEM4035 74© 2019 Daniel K.C. Chan. All rights reserved.
▪ For pork in China, it allowed uploading certificates of authenticity to the
blockchain, bringing more trust to a system where that used to be a serious
issue
▪ For the mango POC, the team started by creating a benchmark
▪ The leader bought a packet of sliced mangoes at a nearby Walmart store and asked his
team to identify which farm they had come from – as fast as possible
▪ The team started calling and emailing distributors and suppliers, and eventually had an
answer almost seven days later
▪ Walmart worked with GS1 to define the data attributes for upload to the
blockchain and IBM wrote the chaincode
▪ Suppliers used new labels & uploaded their data through a web-based interface
In October 2016, Walmart announced the two projects: one
for pork sold in China and one for tracing mangos sold in US
Hyperledger Overview
74. ISEM4035 75© 2019 Daniel K.C. Chan. All rights reserved.
For mangoes in the US, the time needed to trace their
provenance dropped from 7 days to 2.2 seconds
Hyperledger Overview
75. ISEM4035 76© 2019 Daniel K.C. Chan. All rights reserved.
▪ Walmart wanted to make sure that many players could be involved
▪ Walmart reached out to other food companies, including other retailers
▪ Wal-Mart collaborated with IBM and others to set up IBM Food Trust, involving
prominent players in the food industry, like Nestle and Unilever
From POC to production, from Walmart to IBM Food Trust
Hyperledger Overview
76. ISEM4035 77© 2019 Daniel K.C. Chan. All rights reserved.
▪ Walmart now traces over 25 products from 5 different suppliers
▪ The products include produce such as mangoes, strawberries and leafy greens; meat
and poultry such as chicken and pork; dairy such as yogurt and almond milk; and even
multi-ingredient products such as packaged salads and baby foods
▪ This solution allows Walmart to see the whole chain in seconds
▪ Walmart plans to roll out the system to more products and categories in the near
future
▪ Walmart also announced that it will start requiring all of its suppliers of fresh
leafy greens (like salad and spinach) to trace their products using the system
Beyond tracing products’ journey, Walmart might start
tracing other data, like sustainability
Hyperledger Overview
77. ISEM4035 78© 2019 Daniel K.C. Chan. All rights reserved.
1. Let the business lead the project, not the IT department.
2. Understand the business case deeply. Make sure that you know and can
explain why blockchain is the right solution.
3. Think about all the different departments that will be affected by the projects.
Meet with these stakeholders early on and explain what you are trying to do.
4. People don’t get inspired by technology, but by a vision. For Walmart, it was
the story of mangoes: 7 days against 2.2 seconds with blockchain.
5. Participate in forums that allow you to speak to other companies who have
launched similar projects successfully.
6. Start small, with a POC.
Implementation Tips
Hyperledger Overview
78. ISEM4035 79© 2019 Daniel K.C. Chan. All rights reserved.
Application Development
Hyperledger Overview
79. ISEM4035 80© 2019 Daniel K.C. Chan. All rights reserved.
How to decide whether to use blockchain in an application?
Hyperledger Overview
80. ISEM4035 81© 2019 Daniel K.C. Chan. All rights reserved.
References
Hyperledger Overview
81. ISEM4035 82© 2019 Daniel K.C. Chan. All rights reserved.
▫ Glossaries
▫ https://hyperledger-fabric.readthedocs.io/en/release-1.4/glossary.html
▫ https://openblockchain.readthedocs.io/en/latest/glossary/
▫ https://fabrictestdocs.readthedocs.io/en/latest/glossary.html
▫ https://hyperledger.github.io/composer/v0.19/reference/glossary
▫ https://hackernoon.com/hyperledger-fabric-the-20-most-important-terms-made-simple-2753f925db4
▫ Demystifying Hyperledger Fabric (Part 1 of 3): Fabric Architecture
▫ https://www.serial-coder.com/post/demystifying-hyperledger-fabric-fabric-architecture/
▫ Demystifying Hyperledger Fabric (Part 2 of 3): Private Data Collection
▫ https://www.serial-coder.com/post/demystifying-hyperledger-fabric-private-data-collection/
▫ Demystifying Hyperledger Fabric (Part 3 of 3): Network Traffic Handling, Service Discovery, and Operations Service
▫ https://www.serial-coder.com/post/demystifying-hyperledger-fabric-network-traffic-handling-service-discovery-and-operations-service/
Additional References
Hyperledger Overview