SlideShare une entreprise Scribd logo
1  sur  178
Télécharger pour lire hors ligne
@horeaporutiu IBM Developer
Horea Porutiu
Developer Advocate, IBM
January 2019
Using Blockchain to Increase
Supply Chain Transparency
Slides
IBM Developer@horeaporutiu
@pluralsight
• Available on Twitter after talk
• http://slideshare.net/HoreaPorutiu
Agenda
1. Hyperledger Fabric
2. Hyperledger vs. Ethereum
3. Actors in Fabric Network
4. Endorsement Policy
5. Demo
IBM Developer@horeaporutiu
@pluralsight
Hyperledger Fabric
IBM Developer@horeaporutiu https://www.pinterest.com/pin/215469163401716164/
What is Hyperledger Fabric
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Open source platform used for smart contract
development, aimed at the enterprise
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
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
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
Hyperledger vs. Ethereum Throughput
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Approximate throughput - Ethereum: 1,000 / minute
Hyperledger vs. Ethereum Throughput
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Approximate throughput - Ethereum: 1,000 / minute
• Approximate throughput - Hyperlegder: 500,000 /
minute
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
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
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
Concepts
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• NOT central database
Concepts
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• NOT central database
• Data is distributed
Concepts
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• NOT central database
• Data is distributed
• If you make a mistake, you need to have another
transaction to fix it.
Concepts
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• NOT central database
• Data is distributed
• If you make a mistake, you need to have another
transaction to fix it.
•No ‘delete’ operation in Hyperledger
Concepts
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• NOT central database
• Data is distributed
• If you make a mistake, you need to have another
transaction to fix it.
•No ‘delete’ operation in Hyperledger
• Cannot change ledger
Concepts Part 2
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• If you replay all events in the ledger, you get the
‘current state’
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
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
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
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)
Concepts Part 3
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Main use case - Party A doesn’t trust Party B
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
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
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
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
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
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
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
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)
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/
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
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.
Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
Endorsement Policy
@horeaporutiu IBM Developer
• This is consensus mechanism of Fabric
• Operation must be verified before we update the ledger
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
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
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
Approaches for development
@horeaporutiu IBM Developer
Cloud
• Run docker
containers (peer,
orderer, certificate
authority, couchDb)
Local
Approaches for development
@horeaporutiu IBM Developer
Cloud
• Run docker
containers (peer,
orderer, certificate
authority, couchDb)
Local
• Inviting other orgs,
viewing blocks is hard
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
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
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
Our approach
@horeaporutiu IBM Developer
Cloud - via the IBM
Blockchain Platform
@horeaporutiu IBM Developer
Blockchain use-cases
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
•Medicalchain
Blockchain use-cases
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
•Digital Identity
Blockchain use-cases
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric
• Concert Tickets -
True Tickets
Demo
IBM Developer@horeaporutiu
Hyperledger Fabric v. Composer
• Original project
@horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/composerhttps://www.hyperledger.org/projects/fabric
• 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
• 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
• 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
• 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
• 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
• 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
• 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
• 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
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
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
Contact
• Questions: horea.porutiu@ibm.com
• Social: Tweets @horeaporutiu
• Site: https://horeaporutiu.github.io/
• Medium: https://medium.com/@horeaporutiu
@horeaporutiu IBM Developer
Hopefully you will feel like this after
IBM Developer@horeaporutiu https://www.pinterest.com/pin/427630927097492361
@horeaporutiu IBM Developer
Questions?
http://www.freeiconspng.com/img/5437
@horeaporutiu IBM Developer
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
Hyperledger Fabric SDK Overview
IBM Developer@horeaporutiu
Blockchain
network - 1 org
Certificate Authority
Orderer
Peer
(Local)
Node.js app +
Fabric SDK
Node.js app +
Fabric SDK
IBM Developer@horeaporutiu
Blockchain
network - 1 org
Certificate Authority
Orderer
Peer
(Local)
1. Enrollment - Register
admin with Certificate Auth
Hyperledger Fabric SDK Overview
Chaincode
Database
Blockchain
network - 1 org
Certificate AuthorityCertificate Authority
Orderer
Peer
Chaincode
Database
1.
Enrollment
IBM Developer@horeaporutiu
• Enrollment - process of generating keys and
certificates from the Certificate Authority
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
Hyperledger Fabric SDK - Enrollment
Node.js app +
Fabric SDK
IBM Developer@horeaporutiu
Blockchain
network - 1 org
Certificate Authority
(Local)
1.
1. Enrollment - Register
admin with Certificate Auth
Certificate Authority
Orderer
Peer
Chaincode
Database
Node.js app +
Fabric SDK
IBM Developer@horeaporutiu
Blockchain
network - 1 org
Certificate Authority
Orderer
(Local)
1. Enrollment - Register
admin with Certificate Auth
2. Register users
🔑
Hyperledger Fabric SDK - Enrollment
Peer
Chaincode
Database
Blockchain
network - 1 org
Certificate Authority
Orderer
Peer
Chaincode
Database
Blockchain
network - 1 org
Certificate AuthorityCertificate Authority
Orderer
Peer
Chaincode
Database
2.
1.
Hyperledger Fabric SDK - Transaction
Node.js app +
Fabric SDK
IBM Developer@horeaporutiu
Blockchain
network - 1 org
Certificate Authority
Orderer
(Local)
1. Enrollment - Register
admin with Certificate Auth
2. Register users
3. Send transaction to peer
🔑
Peer
Chaincode
Database
Blockchain
network - 1 org
Certificate Authority
Orderer
Peer
Chaincode
Database
Blockchain
network - 1 org
Certificate AuthorityCertificate Authority
Orderer
Peer
Chaincode
Database
3.
2.
1.
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.
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);
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
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
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
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.
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’;
}
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
🔑
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
🔑
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
🔑
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
🔑
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.
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.
🔑
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
🔑
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
🔑
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
Problem
IBM Developer@horeaporutiu
1 in 10 people fall ill
every year from eating
contaminated food -
World Health
Organization
Use Case - IBM Food Trust
IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
IBM Developer@horeaporutiu
• One of the first solutions in-production using blockchain
• Smarter, safer, more sustainable food supply chain
Use Case - IBM Food Trust
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
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
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
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
@horeaporutiu IBM Developer
@horeaporutiu IBM Developer
What if we find out
that all products
from Grandma’s
Farm are
contaminated?
Food Contamination - Grandma’s Farm
IBM Developer@horeaporutiu https://tenor.com/view/michael-scott-no-nogod-please-gif-5739001
@horeaporutiu IBM Developer
@horeaporutiu IBM Developer
@horeaporutiu IBM Developer
• Every operation inside Hyperledger must be
cryptographically signed with certificate
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
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
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
Actors - Certificate Authority
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
Actors - Certificate Authority Part 2
@horeaporutiu IBM Developer
• CA (Certificate Authority) follows best crypto standards
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
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
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
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
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
Actors - Certificate Authority Part 3
@horeaporutiu IBM Developer
• Fabric CA can be chained
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
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
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
Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
Actors - Peer
@horeaporutiu IBM Developer
• Main working horse
• Where ledger / blockchain is stored
• Need more than 1 peer
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
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)
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
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
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
Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
Actors - Ordering Service
@horeaporutiu IBM Developer
• Heart of consensus algorithm
• Provide order of operation
• Before being committed to ledger, must pass thru
ordering service
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
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
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
Actors - Ordering Service Part 2
@horeaporutiu IBM Developer
• Only 1 instance? Solo orderer - use only in test /
development
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
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
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
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
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
Channels
@horeaporutiu IBM Developer
• Main way of data isolation
Channels
@horeaporutiu IBM Developer
• Main way of data isolation
• Separate instance of Hyperledger Fabric
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
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
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
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
Channels Part 2
@horeaporutiu IBM Developer
• Before you join channel, you must create channel
Channels Part 2
@horeaporutiu IBM Developer
• Before you join channel, you must create channel
• Genesis block, says which parties are allowed to join
channel
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
Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
• How you read and update ledger
Chaincode
@horeaporutiu IBM Developer
• Chaincode = smart contract
• How you read and update ledger
• SDK makes transactions and executes chaincode
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
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
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
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
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
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
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
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
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
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
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?
@horeaporutiu IBM Developer
@horeaporutiu IBM Developer
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
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.
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
Recap
@horeaporutiu IBM Developer
• Inside 1 channel, can have as many chain codes as you want
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:
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
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
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
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
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
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
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
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
@horeaporutiu IBM Developer
@horeaporutiu IBM Developer
IBM Blockchain Platform UI
IBM Developer@horeaporutiu

Contenu connexe

Tendances

Tendances (20)

Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & CodeDeploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
 
Developing applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDKDeveloping applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDK
 
Hyperledger fabric 20180528
Hyperledger fabric 20180528Hyperledger fabric 20180528
Hyperledger fabric 20180528
 
Hyperledger Fabric Application Development 20190618
Hyperledger Fabric Application Development 20190618Hyperledger Fabric Application Development 20190618
Hyperledger Fabric Application Development 20190618
 
Dejan Podgorsek - Is Hyperledger Fabric secure enough for your Business?
Dejan Podgorsek - Is Hyperledger Fabric secure enough for your Business?Dejan Podgorsek - Is Hyperledger Fabric secure enough for your Business?
Dejan Podgorsek - Is Hyperledger Fabric secure enough for your Business?
 
Bitmark and Hyperledger Workshop: the Digital Assets and Property
Bitmark and Hyperledger Workshop: the Digital Assets and PropertyBitmark and Hyperledger Workshop: the Digital Assets and Property
Bitmark and Hyperledger Workshop: the Digital Assets and Property
 
Hyperledger Fabric & Composer
Hyperledger Fabric & Composer Hyperledger Fabric & Composer
Hyperledger Fabric & Composer
 
Trading Derivatives on Hyperledger
Trading Derivatives on HyperledgerTrading Derivatives on Hyperledger
Trading Derivatives on Hyperledger
 
Technical Introduction to IBM's Open Blockchain (OBC)
Technical Introduction to IBM's Open Blockchain (OBC)Technical Introduction to IBM's Open Blockchain (OBC)
Technical Introduction to IBM's Open Blockchain (OBC)
 
Icsa2018 blockchain tutorial
Icsa2018 blockchain tutorialIcsa2018 blockchain tutorial
Icsa2018 blockchain tutorial
 
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front DoorTravelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
 
Defrag X Keynote: Deploying and managing Global Blockchain Network
Defrag X Keynote: Deploying and managing Global Blockchain NetworkDefrag X Keynote: Deploying and managing Global Blockchain Network
Defrag X Keynote: Deploying and managing Global Blockchain Network
 
Hyperledger community update Feb 20, 2018
Hyperledger community update Feb 20, 2018Hyperledger community update Feb 20, 2018
Hyperledger community update Feb 20, 2018
 
An introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruAn introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ru
 
Hyperledger Composer
Hyperledger ComposerHyperledger Composer
Hyperledger Composer
 
Hyperledger Composer Update 2017-04-05
Hyperledger Composer Update 2017-04-05Hyperledger Composer Update 2017-04-05
Hyperledger Composer Update 2017-04-05
 
Anatomy of a hyperledger application
Anatomy of a hyperledger applicationAnatomy of a hyperledger application
Anatomy of a hyperledger application
 
IBM presents: Hyperledger Fabric Hands On Workshop - part 1
IBM presents: Hyperledger Fabric Hands On Workshop - part 1IBM presents: Hyperledger Fabric Hands On Workshop - part 1
IBM presents: Hyperledger Fabric Hands On Workshop - part 1
 
Introduction of Hyperledger Fabric & Composer
Introduction of Hyperledger Fabric & Composer Introduction of Hyperledger Fabric & Composer
Introduction of Hyperledger Fabric & Composer
 
Wwc developing hyperledger applications v4
Wwc  developing hyperledger applications v4Wwc  developing hyperledger applications v4
Wwc developing hyperledger applications v4
 

Similaire à Using Blockchain to Increase Supply Chain Transparency

MNSEC 2018 - Observations from the APNIC Community Honeynet Project
MNSEC 2018 -  Observations from the APNIC Community Honeynet Project MNSEC 2018 -  Observations from the APNIC Community Honeynet Project
MNSEC 2018 - Observations from the APNIC Community Honeynet Project
MNCERT
 
The Unicorn Project and The Five Ideals (Updated Dec 2019)
The Unicorn Project and The Five Ideals (Updated Dec 2019)The Unicorn Project and The Five Ideals (Updated Dec 2019)
The Unicorn Project and The Five Ideals (Updated Dec 2019)
Gene Kim
 
IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014
IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014
IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014
Brian Knopf
 
Honeypots for Active Defense
Honeypots for Active DefenseHoneypots for Active Defense
Honeypots for Active Defense
Greg Foss
 

Similaire à Using Blockchain to Increase Supply Chain Transparency (20)

PyConWeb - 2019 Auditing websites & apps for privacy leaks.
PyConWeb - 2019 Auditing websites & apps for privacy leaks.PyConWeb - 2019 Auditing websites & apps for privacy leaks.
PyConWeb - 2019 Auditing websites & apps for privacy leaks.
 
HyperLedger LightningTalk BjoernSimon
HyperLedger LightningTalk BjoernSimonHyperLedger LightningTalk BjoernSimon
HyperLedger LightningTalk BjoernSimon
 
HyperLedger Lightning-Talk BjoernSimon
HyperLedger Lightning-Talk BjoernSimonHyperLedger Lightning-Talk BjoernSimon
HyperLedger Lightning-Talk BjoernSimon
 
MNSEC 2018 - Observations from the APNIC Community Honeynet Project
MNSEC 2018 -  Observations from the APNIC Community Honeynet Project MNSEC 2018 -  Observations from the APNIC Community Honeynet Project
MNSEC 2018 - Observations from the APNIC Community Honeynet Project
 
Tools, Tips and Techniques for Developing Real-time Apps. Phil Leggetter
Tools, Tips and Techniques for Developing Real-time Apps. Phil LeggetterTools, Tips and Techniques for Developing Real-time Apps. Phil Leggetter
Tools, Tips and Techniques for Developing Real-time Apps. Phil Leggetter
 
What is being exposed from IoT Devices
What is being exposed from IoT DevicesWhat is being exposed from IoT Devices
What is being exposed from IoT Devices
 
Heartbleed Bug Vulnerability: Discovery, Impact and Solution
Heartbleed Bug Vulnerability: Discovery, Impact and SolutionHeartbleed Bug Vulnerability: Discovery, Impact and Solution
Heartbleed Bug Vulnerability: Discovery, Impact and Solution
 
Continuum Analytics and Python
Continuum Analytics and PythonContinuum Analytics and Python
Continuum Analytics and Python
 
Security/Auditing in Puppet
Security/Auditing in PuppetSecurity/Auditing in Puppet
Security/Auditing in Puppet
 
Auditing/Security with Puppet - PuppetConf 2014
Auditing/Security with Puppet - PuppetConf 2014Auditing/Security with Puppet - PuppetConf 2014
Auditing/Security with Puppet - PuppetConf 2014
 
Wi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksWi-Fi Hotspot Attacks
Wi-Fi Hotspot Attacks
 
The Unicorn Project and The Five Ideals (Updated Dec 2019)
The Unicorn Project and The Five Ideals (Updated Dec 2019)The Unicorn Project and The Five Ideals (Updated Dec 2019)
The Unicorn Project and The Five Ideals (Updated Dec 2019)
 
Python-Assisted Red-Teaming Operation
Python-Assisted Red-Teaming OperationPython-Assisted Red-Teaming Operation
Python-Assisted Red-Teaming Operation
 
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
 
IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014
IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014
IoT_and_the_Impact_on_Security_Brian_Knopf_ISSA-OC_July-2014
 
Honeypots for Active Defense
Honeypots for Active DefenseHoneypots for Active Defense
Honeypots for Active Defense
 
Four years of breaking HTTPS with BGP hijacking
Four years of breaking HTTPS with BGP hijackingFour years of breaking HTTPS with BGP hijacking
Four years of breaking HTTPS with BGP hijacking
 
How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...
 
20130226 How Personal Is Your Cloud?
20130226 How Personal Is Your Cloud?20130226 How Personal Is Your Cloud?
20130226 How Personal Is Your Cloud?
 
8base Hyperledger Miami Meetup Presentation
8base Hyperledger Miami Meetup Presentation8base Hyperledger Miami Meetup Presentation
8base Hyperledger Miami Meetup Presentation
 

Dernier

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Dernier (20)

WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

Using Blockchain to Increase Supply Chain Transparency

  • 1. @horeaporutiu IBM Developer Horea Porutiu Developer Advocate, IBM January 2019 Using Blockchain to Increase Supply Chain Transparency
  • 2. Slides IBM Developer@horeaporutiu @pluralsight • Available on Twitter after talk • http://slideshare.net/HoreaPorutiu
  • 3. Agenda 1. Hyperledger Fabric 2. Hyperledger vs. Ethereum 3. Actors in Fabric Network 4. Endorsement Policy 5. Demo IBM Developer@horeaporutiu @pluralsight
  • 4. Hyperledger Fabric IBM Developer@horeaporutiu https://www.pinterest.com/pin/215469163401716164/
  • 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
  • 10. Hyperledger vs. Ethereum Throughput @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric • Approximate throughput - Ethereum: 1,000 / minute • Approximate throughput - Hyperlegder: 500,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
  • 16. Concepts @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric • NOT central database • Data is distributed • If you make a mistake, you need to have another transaction to fix it.
  • 17. Concepts @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric • NOT central database • Data is distributed • If you make a mistake, you need to have another transaction to fix it. •No ‘delete’ operation in Hyperledger
  • 18. Concepts @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric • NOT central database • Data is distributed • If you make a mistake, you need to have another transaction to fix it. •No ‘delete’ operation in Hyperledger • Cannot change ledger
  • 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.
  • 36. Endorsement Policy @horeaporutiu IBM Developer • This is consensus mechanism of Fabric
  • 37. Endorsement Policy @horeaporutiu IBM Developer • This is consensus mechanism of Fabric • Operation must be verified before we update the ledger
  • 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
  • 41. Approaches for development @horeaporutiu IBM Developer Cloud • Run docker containers (peer, orderer, certificate authority, couchDb) Local
  • 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
  • 46. Our approach @horeaporutiu IBM Developer Cloud - via the IBM Blockchain Platform
  • 48. Blockchain use-cases @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric •Medicalchain
  • 49. Blockchain use-cases @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric •Digital Identity
  • 50. Blockchain use-cases @horeaporutiu IBM Developerhttps://www.hyperledger.org/projects/fabric • Concert Tickets - True Tickets
  • 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
  • 63. Contact • Questions: horea.porutiu@ibm.com • Social: Tweets @horeaporutiu • Site: https://horeaporutiu.github.io/ • Medium: https://medium.com/@horeaporutiu @horeaporutiu IBM Developer
  • 64. Hopefully you will feel like this after IBM Developer@horeaporutiu https://www.pinterest.com/pin/427630927097492361
  • 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
  • 68. Hyperledger Fabric SDK Overview IBM Developer@horeaporutiu Blockchain network - 1 org Certificate Authority Orderer Peer (Local) Node.js app + Fabric SDK
  • 69. Node.js app + Fabric SDK IBM Developer@horeaporutiu Blockchain network - 1 org Certificate Authority Orderer Peer (Local) 1. Enrollment - Register admin with Certificate Auth Hyperledger Fabric SDK Overview Chaincode Database Blockchain network - 1 org Certificate AuthorityCertificate Authority Orderer Peer Chaincode Database 1.
  • 70. Enrollment IBM Developer@horeaporutiu • Enrollment - process of generating keys and certificates from the Certificate Authority
  • 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
  • 72. Hyperledger Fabric SDK - Enrollment Node.js app + Fabric SDK IBM Developer@horeaporutiu Blockchain network - 1 org Certificate Authority (Local) 1. 1. Enrollment - Register admin with Certificate Auth Certificate Authority Orderer Peer Chaincode Database
  • 73. Node.js app + Fabric SDK IBM Developer@horeaporutiu Blockchain network - 1 org Certificate Authority Orderer (Local) 1. Enrollment - Register admin with Certificate Auth 2. Register users 🔑 Hyperledger Fabric SDK - Enrollment Peer Chaincode Database Blockchain network - 1 org Certificate Authority Orderer Peer Chaincode Database Blockchain network - 1 org Certificate AuthorityCertificate Authority Orderer Peer Chaincode Database 2. 1.
  • 74. Hyperledger Fabric SDK - Transaction Node.js app + Fabric SDK IBM Developer@horeaporutiu Blockchain network - 1 org Certificate Authority Orderer (Local) 1. Enrollment - Register admin with Certificate Auth 2. Register users 3. Send transaction to peer 🔑 Peer Chaincode Database Blockchain network - 1 org Certificate Authority Orderer Peer Chaincode Database Blockchain network - 1 org Certificate AuthorityCertificate Authority Orderer Peer Chaincode Database 3. 2. 1.
  • 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
  • 80. 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.
  • 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
  • 91. Problem IBM Developer@horeaporutiu 1 in 10 people fall ill every year from eating contaminated food - World Health Organization
  • 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
  • 99. @horeaporutiu IBM Developer What if we find out that all products from Grandma’s Farm are contaminated?
  • 100. Food Contamination - Grandma’s Farm IBM Developer@horeaporutiu https://tenor.com/view/michael-scott-no-nogod-please-gif-5739001
  • 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
  • 118. Actors - Peer @horeaporutiu IBM Developer • Main working horse
  • 119. Actors - Peer @horeaporutiu IBM Developer • Main working horse • Where ledger / blockchain is stored
  • 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
  • 138. Channels @horeaporutiu IBM Developer • Main way of data isolation
  • 139. Channels @horeaporutiu IBM Developer • Main way of data isolation • Separate instance of Hyperledger Fabric
  • 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
  • 144. Channels Part 2 @horeaporutiu IBM Developer • Before you join channel, you must create channel
  • 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
  • 147. Chaincode @horeaporutiu IBM Developer • Chaincode = smart contract
  • 148. Chaincode @horeaporutiu IBM Developer • Chaincode = smart contract • How you read and update ledger
  • 149. Chaincode @horeaporutiu IBM Developer • Chaincode = smart contract • How you read and update ledger • SDK makes transactions and executes chaincode
  • 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
  • 166. Recap @horeaporutiu IBM Developer • Inside 1 channel, can have as many chain codes as you want
  • 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
  • 178. IBM Blockchain Platform UI IBM Developer@horeaporutiu