Slides used for a live webinar: Efficiency and transparency in a coffee bean supply chain. Showing how Hyperledger is different than other blockchain platforms, and what makes it a great product for the enterprise.
5. What is Hyperledger Fabric
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Open source platform used for smart contract
development, aimed at the enterprise
6. What is Hyperledger Fabric
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Open source platform used for smart contract
development, aimed at the enterprise
•Hosted by the Linux Foundation
7. What is Hyperledger Fabric
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Open source platform used for smart contract
development, aimed at the enterprise
•Hosted by the Linux Foundation
• Major differences to modern cryptocurrency - there is
no concept of ‘mining’ blocks
8. What is Hyperledger Fabric
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Open source platform used for smart contract
development, aimed at the enterprise
•Hosted by the Linux Foundation
• Major differences to modern cryptocurrency - there is
no concept of ‘mining’ blocks
•Permissioned blockchain, you need to be invited to join
the network
9. Hyperledger vs. Ethereum Throughput
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Approximate throughput - Ethereum: 1,000 / minute
11. Hyperledger vs. Ethereum Throughput
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Approximate throughput - Ethereum: 1,000 / minute
• No concept of cryptocurrency in Hyperledger
• Approximate throughput - Hyperlegder: 500,000 /
minute
12. Hyperledger vs. Ethereum Throughput
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Approximate throughput - Ethereum: 1,000 / minute
• No concept of cryptocurrency in Hyperledger
• Approximate throughput - Hyperlegder: 500,000 /
minute
• No cryptocurrency = no mining = more efficient in terms of
electricity
13. Hyperledger vs. Ethereum Throughput
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Approximate throughput - Ethereum: 1,000 / minute
• No concept of cryptocurrency in Hyperledger
• Enterprise needs high throughput = Hyperledger is made for
enterprise
• Approximate throughput - Hyperlegder: 500,000 /
minute
• No cryptocurrency = no mining = more efficient in terms of
electricity
19. Concepts Part 2
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• If you replay all events in the ledger, you get the
‘current state’
20. Concepts Part 2
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• If you replay all events in the ledger, you get the
‘current state’
• All data is cryptographically signed
21. Concepts Part 2
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• If you replay all events in the ledger, you get the
‘current state’
• All data is cryptographically signed
• No requirements on hardware, network
infrastructure, software, security
22. Concepts Part 2
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• If you replay all events in the ledger, you get the
‘current state’
• All data is cryptographically signed
• No requirements on hardware, network
infrastructure, software, security
• Can be adjusted for any use case
23. Concepts Part 2
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• If you replay all events in the ledger, you get the
‘current state’
• All data is cryptographically signed
• Flexible requirements on hardware, network
infrastructure, software, security
• Can be adjusted for any use case
• Not vulnerable to 51% attack (unlike Bitcoin)
24. Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
25. Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
• Party A records don’t match Party B
26. Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
• Party A records don’t match Party B
• How to resolve? Settlement process (lawyers,
audits) - expensive, time-intensive
27. Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
• Party A records don’t match Party B
• How to resolve? Settlement process (lawyers,
audits) - expensive, time-intensive
• Instead, you can use 3rd party (verification
authority), and send all data to them. Very expensive
28. Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
• Party A records don’t match Party B
• How to resolve? Settlement process (lawyers,
audits) - expensive, time-intensive
• Instead, you can use 3rd party (verification
authority), and send all data to them. Very expensive
• Need to all trust verification authority
29. Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
• Party A records don’t match Party B
• How to resolve? Settlement process (lawyers,
audits) - expensive, time-intensive
• Instead, you can use 3rd party (verification
authority), and send all data to them. Very expensive
• Need to all trust verification authority
• Verification authority run by humans = prone to mistakes
30. Concepts Part 4
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• No bulletproof way to work with two parties that don’t
trust each other
31. Concepts Part 4
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• No bulletproof way to work with two parties that don’t
trust each other
• All info is enforced by Hyperledger - all participants see this
32. Concepts Part 4
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• No bulletproof way to work with two parties that don’t
trust each other
• All info is enforced by Hyperledger - all participants see this
• Not possible for any party to alter data - must pass
through smart contract (chain code)
33. Actors in Hyperledger
@horeaporutiu IBM Developer
•Michael Scott,
a.k.a. the peer
node. The peer,
(M. Scott) runs
the show
(chaincode). The
manager of The
Office.
http://mtncatholic.com/2016/10/06/no-joke-dante-puts-michael-scott-hell/
34. Actors in Hyperledger
@horeaporutiu IBM Developer
•Michael Scott,
a.k.a. the peer
node. The peer,
(M. Scott) runs
the show
(chaincode). The
manager of The
Office.
http://mtncatholic.com/2016/10/06/no-joke-dante-puts-michael-scott-hell/
• Toby, a.k.a the
CA(Certificate
Authority). The
CA hands out
certificates to
members of the
network. The
H.R. of The
Office - hands
out offer letters.
http://theoffice.wikia.com/wiki/Toby_Flenderson
35. Actors in Hyperledger
@horeaporutiu IBM Developer
•Michael Scott,
a.k.a. the peer
node. The peer,
(M. Scott) runs
the show
(chaincode). The
manager of The
Office.
http://mtncatholic.com/2016/10/06/no-joke-dante-puts-michael-scott-hell/
• Toby, a.k.a the
CA(Certificate
Authority). The
CA hands out
certificates to
members of the
network. The
H.R. of The
Office - hands
out offer letters.
http://theoffice.wikia.com/wiki/Toby_Flenderson https://www.dailybreak.com/break/chilis-lifts-ban-on-pam-beesly
• Pam, a.k.a. the
orderer
broadcasts
messages to
peers. As the
receptionist in the
office, she relays
messages to other
employees.
38. Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
• Endorsement policy specifies who must validate
39. Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
• Example: All peers, majority of peers, ONLY 1 peer (this
is dangerous)
• Endorsement policy specifies who must validate
40. Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
• If you have a channel with 10 CC, then every single
chaincode can have a different policy 🙀🙀🙀🙀🙀🙀
• Example: All peers, majority of peers, ONLY 1 peer (this
is dangerous)
• Endorsement policy specifies who must validate
42. Approaches for development
@horeaporutiu IBM Developer
Cloud
• Run docker
containers (peer,
orderer, certificate
authority, couchDb)
Local
• Inviting other orgs,
viewing blocks is hard
43. Approaches for development
@horeaporutiu IBM Developer
Cloud
• Run docker
containers (peer,
orderer, certificate
authority, couchDb)
• Network setup is
done for you
Local
• Inviting other orgs,
viewing blocks is hard
44. Approaches for development
@horeaporutiu IBM Developer
Cloud
• Run docker
containers (peer,
orderer, certificate
authority, couchDb)
• Network setup is
done for you
Local
• Nice interface to view
all blocks
• Inviting other orgs,
viewing blocks is hard
45. Approaches for development
@horeaporutiu IBM Developer
Cloud
• Run docker
containers (peer,
orderer, certificate
authority, couchDb)
• Network setup is
done for you
Local
• Nice interface to view
all blocks
• Easy to invite other
organizations to the
network
• Inviting other orgs,
viewing blocks is hard
52. Hyperledger Fabric v. Composer
• Original project
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
53. • Learn Fabric SDK -
Node.js, Java
• Original project
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
Hyperledger Fabric v. Composer
54. • Learn Fabric SDK -
Node.js, Java
• Original project
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
Hyperledger Fabric v. Composer
55. • Learn Fabric SDK -
Node.js, Java
• Original project
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
•Status: active
Hyperledger Fabric v. Composer
56. • Learn Fabric SDK -
Node.js, Java
• Original project • Tool for using Fabric
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
•Status: active
Hyperledger Fabric v. Composer
57. • Learn Fabric SDK -
Node.js, Java
• Original project
• Easy to generate
REST API
• Tool for using Fabric
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
•Status: active
Hyperledger Fabric v. Composer
58. • Learn Fabric SDK -
Node.js, Java
• Original project
• Easy to generate
REST API
• Tool for using Fabric
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
•Status: active
• Learn Composer
modeling language
Hyperledger Fabric v. Composer
59. • Learn Fabric SDK -
Node.js, Java
• Original project
• Easy to generate
REST API
• Tool for using Fabric
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
•Status: active
• Learn Composer
modeling language
• Test your contracts in
a sandbox, online
Hyperledger Fabric v. Composer
60. • Learn Fabric SDK -
Node.js, Java
• Original project
• Easy to generate
REST API
• Tool for using Fabric
@horeaporutiu IBM Developer
• Uses channels to
divide communication
between participants
https://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
•Status: active
• Learn Composer
modeling language
• Test your contracts in
a sandbox, online
•Status: incubation
Hyperledger Fabric v. Composer
61. IBM Blockchain Starter Plan
IBM Developer@horeaporutiu
•http://goo.gl/i9WZcH
• Need either business or student
email address, gmail wont work
• Takes a few business days to
process, please be patient
62. Code Patterns
• Hello world Hyperledger Fabric Car Auction -
https://github.com/IBM/car-auction-network-
fabric-node-sdk
@horeaporutiu IBM Code
• Blockchain Bean UI - https://www.ibm.com/
thought-leadership/blockchainbean/index.html
• Blockchain Bean Code -https://github.com/IBM/
blockchainbean
67. How do you get started?
@horeaporutiu IBM Developer
• Intro to Hyperledger Node SDK code pattern -
https://github.com/IBM/car-auction-network-
fabric-node-sdk
• Step by step guide on how to connect local
Node.js app to IBM Blockchain Platform
71. Enrollment
IBM Developer@horeaporutiu
• First generate certificate for our admin identity
and use those to register a new client identity
• Enrollment - process of generating keys and
certificates from the Certificate Authority
75. Using Fabric SDK - Invoking Chaincode 1/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
(Local)
3. Send transaction
proposal to peer
var request = {
chaincodeId: ‘carauction’, //name of chaincode to execute
fcn: ‘initLedger’, // which chaincode function to execute
args: [‘’], //array of args for chaincode function
txId: fabric_client.newTransactionID(); //assign new txn id
}
🔑
Peer
Chaincode
Database
3.
76. Using Fabric SDK - Invoking Chaincode 1/2
IBM Developer@horeaporutiu
var request = {
chaincodeId: ‘carauction’, //name of chaincode to execute
fcn: ‘initLedger’, // which chaincode function to execute
args: [‘’], //array of args for chaincode function
txId: fabric_client.newTransactionID(); //assign new txn id
}
var channel = fabric_client.newChannel(‘defaultchannel’);
return channel.sentTransactionProposal(request);
var fabric_client = require(‘fabric-client);
77. Using Fabric SDK - Invoking Chaincode 1/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
(Local)
3. Send transaction
proposal to peer🔑
Peer
Chaincode
Database
3.
• Check endorsement policy - which peers need to
endorse transaction
78. Using Fabric SDK - Invoking Chaincode 1/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
(Local)
3. Send transaction
proposal to peer🔑
Peer
Chaincode
Database
3.
• Check endorsement policy - which peers need to
endorse transaction
• The transaction proposal will go to the peers in the
endorsement policy
79. Using Fabric SDK - Writing to the ledger
IBM Developer@horeaporutiu
let member = {
member.balance = 5000; //set balance of member’s account
member.firstName = ‘Amy’; //set first name of member
member.lastName = ‘Williams’; //set last name of member
member.email = ‘amyWilliams@email.com’; //set email
}
await stub.putState(‘amyWilliams@email.com’,
Buffer.from(JSON.stringify(member)));
• putState takes a key value pair, and writes to the ledger
81. Using Fabric SDK - Reading from the ledger
IBM Developer@horeaporutiu
await stub.getState(‘amyWilliams@email.com’);
• getState reads the member object from the ledger.
Note, this does not create a block on the network.
• This will return:
{
balance: ‘5000’;
firstName: ’Amy’;
lastName: ‘Williams’;
email: ‘amyWilliams@email.com’;
}
82. Using Fabric SDK - Invoking Chaincode 2/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Peer
(Local)
4. Peers return endorsed
transaction
4.
• Check transaction proposal has not been submitted in
the past and is well formed
🔑
83. Using Fabric SDK - Invoking Chaincode 2/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Peer
(Local)
4. Peers return endorsed
transaction
4.
• Check transaction proposal has not been submitted in
the past and is well formed
• Check that signature is valid
🔑
84. Using Fabric SDK - Invoking Chaincode 2/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Peer
(Local)
4. Peers return endorsed
transaction
4.
• Check transaction proposal has not been submitted in
the past and is well formed
• Check that signature is valid
• Take args from chaincode function, and execute function
🔑
85. Using Fabric SDK - Invoking Chaincode 2/2
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Peer
(Local)
4. Peers return endorsed
transaction
4.
• Check transaction proposal has not been submitted in
the past and is well formed
• Check that signature is valid
• Take args from chaincode function, and execute function
• Transaction results + enduring peer signature is sent
back to SDK
🔑
86. Node.js app +
Fabric SDK
IBM Developer@horeaporutiu
Blockchain
network - 1 org
Certificate Authority
Orderer
Peer
(Local)
1.
1. Enrollment - Register
admin with Certificate Auth
2. Register application
2.
3. Send (txn)transaction to peer
4. Peers return endorsed txn
Using Fabric SDK - Invoking Chaincode
🔑
Peer
Chaincode
Database
4.
3.
5. App sends endorsed txn to ordering service to add to ledger
5.
87. Using Fabric SDK - Ordering Service
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Orderer
(Local)
5. App sends endorsed txn to
ordering service to add to ledger
• App ‘broadcasts’ transaction proposal and response to
the ordering service
5.
🔑
88. Using Fabric SDK - Ordering Service
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Orderer
(Local)
5. App sends endorsed txn to
ordering service to add to ledger
• App ‘broadcasts’ transaction proposal and response to
the ordering service
5.
• Order chronologically and create blocks
🔑
89. Using Fabric SDK - Ordering Service
IBM Developer@horeaporutiu
Node.js app +
Fabric SDK
Orderer
(Local)
5. App sends endorsed txn to
ordering service to add to ledger
• App ‘broadcasts’ transaction proposal and response to
the ordering service
5.
• Order chronologically and create blocks
• Order transactions from all channels - order
chronologically by channel and create blocks
🔑
90. Ledger Updated
IBM Developer@horeaporutiu
• Each peer appends block to the channel’s chain,
•For each valid transaction the write sets are committed to
current state database
• Client is notified that transaction has been immutably
appended to the chain
92. Use Case - IBM Food Trust
IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
93. IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
• Smarter, safer, more sustainable food supply chain
Use Case - IBM Food Trust
94. IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
• Smarter, safer, more sustainable food supply chain
• Built on open-source framework - Hyperledger Fabric
Use Case - IBM Food Trust
95. IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
• Smarter, safer, more sustainable food supply chain
• Built on open-source framework - Hyperledger Fabric
• How to join: register your organization with the network
Use Case - IBM Food Trust
96. IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
• Smarter, safer, more sustainable food supply chain
• Built on open-source framework - Hyperledger Fabric
• How to join: register your organization with the network
• Solution: Trace - allows user to search the origin of a
product by product name, Purchase Order or GTIN
(Global Trade Item Number)
Use Case - IBM Food Trust
97. IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
• Smarter, safer, more sustainable food supply chain
• Built on open-source framework - Hyperledger Fabric
• How to join: register your organization with the network
• Solution: Trace - allows user to search the origin of a
product by product name, Purchase Order or GTIN
(Global Trade Item Number)
• Solution: Certificate Manager - upload regulation and
inspection documents (fair-trade, organic, etc.)
Use Case - IBM Food Trust
103. @horeaporutiu IBM Developer
• Every operation inside Hyperledger must be
cryptographically signed with certificate
Actors - Certificate Authority
104. @horeaporutiu IBM Developer
• Every operation inside Hyperledger must be
cryptographically signed with certificate
• Doesn’t matter if you just read data, or if you update,
still need to sign with certificate
Actors - Certificate Authority
105. @horeaporutiu IBM Developer
• Every operation inside Hyperledger must be
cryptographically signed with certificate
• Doesn’t matter if you just read data, or if you update,
still need to sign with certificate
• Can generate your own certificates
Actors - Certificate Authority
106. @horeaporutiu IBM Developer
• Every operation inside Hyperledger must be
cryptographically signed with certificate
• Doesn’t matter if you just read data, or if you update,
still need to sign with certificate
• Can generate your own certificates
• CA (if you use out of box) provides X.509 certificates -
same certificate you use to make your website work on
HTTPS
Actors - Certificate Authority
107. Actors - Certificate Authority
@horeaporutiu IBM Developer
• Every operation inside Hyperledger must be
cryptographically signed with certificate
• Doesn’t matter if you just read data, or if you update,
still need to sign with certificate
• Can generate your own certificates
• CA (if you use out of box) provides X.509 certificates -
same certificate you use to make your website work on
HTTPS
• Inside certificate, you can add info to the system -
smart contract can read this, make decision based on
certificate
108. Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
109. Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
• Don’t have to use X.509 or Public Key Infrastructure,
but that’s a very advanced topic
110. Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
• Don’t have to use X.509 or Public Key Infrastructure,
but that’s a very advanced topic
• Enrollment - create accounts, register users, create
attributes
111. Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
• Don’t have to use X.509 or Public Key Infrastructure,
but that’s a very advanced topic
• Enrollment - create accounts, register users, create
attributes
• Provide user / pass to CA and it gives you certificate ->
can enforce expiration date
112. Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
• Don’t have to use X.509 or Public Key Infrastructure,
but that’s a very advanced topic
• Enrollment - create accounts, register users, create
attributes
• Provide user / pass to CA and it gives you certificate ->
can enforce expiration date
• Can use OpenSSL
113. Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
• Don’t have to use X.509 or Public Key Infrastructure,
but that’s a very advanced topic
• Enrollment - create accounts, register users, create
attributes
• Provide user / pass to CA and it gives you certificate ->
can enforce expiration date
• Can use OpenSSL
• CA can be attached to active directory, all users can be
taken from active directory
114. Actors - Certificate Authority Part 3
@horeaporutiu IBM Developer
• Fabric CA can be chained
115. Actors - Certificate Authority Part 3
@horeaporutiu IBM Developer
• Fabric CA can be chained
• For example - you have 1 root CA and more
intermediate CA that trust the root CA
116. Actors - Certificate Authority Part 3
@horeaporutiu IBM Developer
• Fabric CA can be chained
• For example - you have 1 root CA and more
intermediate CA that trust the root CA
• When you use SDK, you sign all requests with certificate
117. Actors - Certificate Authority Part 3
@horeaporutiu IBM Developer
• Fabric CA can be chained
• For example - you have 1 root CA and more
intermediate CA that trust the root CA
• Can track certificate (identity) on the network - see
who invoked transactions
• When you use SDK, you sign all requests with certificate
120. Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Need more than 1 peer
121. Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Request from SDK is sent to peer
• Need more than 1 peer
122. Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Request from SDK is sent to peer
• Need more than 1 peer
• 1 peer can be part of many channels (cover this later)
123. Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Request from SDK is sent to peer
• Need more than 1 peer
• 1 peer can be part of many channels (cover this later)
• Endorse then update ledger. Endorsement is heart of system
124. Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Request from SDK is sent to peer
• Need more than 1 peer
• 1 peer can be part of many channels (cover this later)
• Endorse then update ledger. Endorsement is heart of system
• Back up of system? Peers find each other and sync
125. Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Request from SDK is sent to peer
• Need more than 1 peer
• 1 peer can be part of many channels (cover this later)
• Endorse then update ledger. Endorsement is heart of system
• Back up of system? Peers find each other and sync
• Need to increase throughput? Simple - add more peers
126. Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
127. Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
128. Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
• Before being committed to ledger, must pass thru
ordering service
129. Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
• Creates blocks
• Before being committed to ledger, must pass thru
ordering service
130. Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
• Creates blocks
• Before being committed to ledger, must pass thru
ordering service
• Sends blocks to peers, peers add block to ledger
131. Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
• Creates blocks
• Before being committed to ledger, must pass thru
ordering service
• Sends blocks to peers, peers add block to ledger
• Decides which operation comes before or after another
operation
132. Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
133. Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
• Production? Use multiple instances, use Kafka orderer
134. Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
• Production? Use multiple instances, use Kafka orderer
• Kafka orderer is distributed, can put these in different
data centers in different continents - if one fails, your
network is still running
135. Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
• Production? Use multiple instances, use Kafka orderer
• Must use Kafka for maximum throughput
• Kafka orderer is distributed, can put these in different
data centers in different continents - if one fails, your
network is still running
136. Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
• Production? Use multiple instances, use Kafka orderer
• Throughput also dependent on hardware - can’t use old
laptop for thousands of transactions per second
• Must use Kafka for maximum throughput
• Kafka orderer is distributed, can put these in different
data centers in different continents - if one fails, your
network is still running
137. Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
• Production? Use multiple instances, use Kafka orderer
• Throughput also dependent on hardware - can’t use old
laptop for thousands of transactions per second
• Must use Kafka for maximum throughput
• Must use server for higher throughput
• Kafka orderer is distributed, can put these in different
data centers in different continents - if one fails, your
network is still running
140. Channels
@horeaporutiu IBM Developer
• Main way of data isolation
• Separate instance of Hyperledger Fabric
• One channel doesn’t depend on another channel - they
never exchange data
141. Channels
@horeaporutiu IBM Developer
• Main way of data isolation
• Separate instance of Hyperledger Fabric
• Each channel has different chaincode that is
independent
• One channel doesn’t depend on another channel - they
never exchange data
142. Channels
@horeaporutiu IBM Developer
• Main way of data isolation
• Separate instance of Hyperledger Fabric
• If party A and party B want to communicate in private,
they create their own channel. No way for Party C to
even see that this channel exists
• Each channel has different chaincode that is
independent
• One channel doesn’t depend on another channel - they
never exchange data
143. Channels
@horeaporutiu IBM Developer
• Main way of data isolation
• Separate instance of Hyperledger Fabric
• If party A and party B want to communicate in private,
they create their own channel. No way for Party C to
even see that this channel exists
• Each channel has different chaincode that is
independent
• Peer must be part of channel to do anything - must join
peer to channel
• One channel doesn’t depend on another channel - they
never exchange data
145. Channels Part 2
@horeaporutiu IBM Developer
• Before you join channel, you must create channel
• Genesis block, says which parties are allowed to join
channel
146. Channels Part 2
@horeaporutiu IBM Developer
• Before you join channel, you must create channel
• Genesis block, says which parties are allowed to join
channel
• If you later want to add another party that is not
specified if genesis block, must alter channel
configuration
150. Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
• How you read and update ledger
• Only way to read/update ledger is through chaincode
• SDK makes transactions and executes chaincode
151. Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
• How you read and update ledger
• You use Node.js? Can use any external libraries from
NPM you want in your chaincode
• Only way to read/update ledger is through chaincode
• SDK makes transactions and executes chaincode
152. Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
• How you read and update ledger
• You use Node.js? Can use any external libraries from
NPM you want in your chaincode
• Only way to read/update ledger is through chaincode
• Chaincode must be part of channel
• SDK makes transactions and executes chaincode
153. Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
• How you read and update ledger
• You use Node.js? Can use any external libraries from
NPM you want in your chaincode
• Only way to read/update ledger is through chaincode
• Chaincode must be part of channel
• SDK makes transactions and executes chaincode
• Why? Bc chaincode is responsible with working with
ledger, but ledger is inside a specific channel
154. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
155. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
• Must be installed and instantiated
156. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
• Must be installed and instantiated
• Must install on every peer that is inside of that channel
157. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
• Must be installed and instantiated
• CC (chaincode) must be part of peer
• Must install on every peer that is inside of that channel
158. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
• Must be installed and instantiated
• Instantiation starts container of the CC make all
connections and make it ready for use
• CC (chaincode) must be part of peer
• Must install on every peer that is inside of that channel
159. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
• Must be installed and instantiated
• Instantiation starts container of the CC make all
connections and make it ready for use
• CC (chaincode) must be part of peer
• When you instantiate, you must provide a policy
• Must install on every peer that is inside of that channel
160. Chaincode Part 2
@horeaporutiu IBM Developer
• You may have one chaincode that handles everything
(this is what I will demo later) or 5,10,12 separate ones
• Must be installed and instantiated
• Instantiation starts container of the CC make all
connections and make it ready for use
• CC (chaincode) must be part of peer
• When you instantiate, you must provide a policy
• Must install on every peer that is inside of that channel
• What is policy?
163. Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
• If you have a channel with 10 CC, then every single
chaincode can have a different policy 🙀🙀🙀🙀🙀🙀
• Example: All peers, majority of peers, ONLY 1 peer (this
is dangerous)
• When you instantiate, you must provide a policy
• Endorsement policy specifies who must validate
164. Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
• If you have a channel with 10 CC, then every single
chaincode can have a different policy 🙀🙀🙀🙀🙀🙀
• Example: All peers, majority of peers, ONLY 1 peer (this
is dangerous)
• When you instantiate, you must provide a policy
• Endorsement policy specifies who must validate
• Example: for business process that is not important -
endorsement policy says only 1 peer must validate.
165. Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
• If you have a channel with 10 CC, then every single
chaincode can have a different policy 🙀🙀🙀🙀🙀🙀
• Example: All peers, majority of peers, ONLY 1 peer (this
is dangerous)
• When you instantiate, you must provide a policy
• Endorsement policy specifies who must validate
• Example: for business process that is not important -
endorsement policy says only 1 peer must validate.
• For vital operations (transfer money) ALL peers validate
167. Recap
@horeaporutiu IBM Developer
• Inside 1 channel, can have as many chain codes as you want
• When you make a request you say I want to execute
operation on:
168. Recap
@horeaporutiu IBM Developer
• Inside 1 channel, can have as many chain codes as you want
• When you make a request you say I want to execute
operation on:
1. Channel X
169. Recap
@horeaporutiu IBM Developer
• Inside 1 channel, can have as many chain codes as you want
• When you make a request you say I want to execute
operation on:
1. Channel X
2. Chaincode X
170. Recap
@horeaporutiu IBM Developer
• Inside 1 channel, can have as many chain codes as you want
• When you make a request you say I want to execute
operation on:
1. Channel X
2. Chaincode X
3. With these arguments
171. Recap
@horeaporutiu IBM Developer
• Inside 1 channel, can have as many chain codes as you want
• When you make a request you say I want to execute
operation on:
1. Channel X
2. Chaincode X
3. With these arguments
4. With this certificate
172. Recap in code
@horeaporutiu IBM Developer
var request = {
chaincodeId: ‘carauction’, //name of chaincode to execute
fcn: ‘initLedger’, // which chaincode function to execute
args: [‘’], //array of args for chaincode function
txId: fabric_client.newTransactionID(); //assign new txn id
}
var channel = fabric_client.newChannel(‘defaultchannel’);
return channel.sentTransactionProposal(request);
var fabric_client = require(‘fabric-client);
1
173. Recap in code
@horeaporutiu IBM Developer
var request = {
chaincodeId: ‘carauction’, //name of chaincode to execute
fcn: ‘initLedger’, // which chaincode function to execute
args: [‘’], //array of args for chaincode function
txId: fabric_client.newTransactionID(); //assign new txn id
}
var channel = fabric_client.newChannel(‘defaultchannel’);
return channel.sentTransactionProposal(request);
var fabric_client = require(‘fabric-client);
1
2
174. Recap in code
@horeaporutiu IBM Developer
var request = {
chaincodeId: ‘carauction’, //name of chaincode to execute
fcn: ‘initLedger’, // which chaincode function to execute
args: [‘’], //array of args for chaincode function
txId: fabric_client.newTransactionID(); //assign new txn id
}
var channel = fabric_client.newChannel(‘defaultchannel’);
return channel.sentTransactionProposal(request);
var fabric_client = require(‘fabric-client);
1
2
3
175. Recap in code
@horeaporutiu IBM Developer
var request = {
chaincodeId: ‘carauction’, //name of chaincode to execute
fcn: ‘initLedger’, // which chaincode function to execute
args: [‘’], //array of args for chaincode function
txId: fabric_client.newTransactionID(); //assign new txn id
}
var channel = fabric_client.newChannel(‘defaultchannel’);
return channel.sentTransactionProposal(request);
var fabric_client = require(‘fabric-client);
1
2
3
4