SlideShare a Scribd company logo
@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

More Related Content

PDF
First Steps with Blockchain
PDF
Hyperleger Fabric Workshop - Denver Blockchain Week
PDF
First Steps with Blockchains
PPTX
Blockchain workshop IBM CODE Day - Montevideo
PPTX
First steps with Bitcoin
PDF
Ethereum Smart Contracts on Hyperledger Fabric
PPTX
Hyperledger Fabric - Blockchain, sushi and supply chain
PDF
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
First Steps with Blockchain
Hyperleger Fabric Workshop - Denver Blockchain Week
First Steps with Blockchains
Blockchain workshop IBM CODE Day - Montevideo
First steps with Bitcoin
Ethereum Smart Contracts on Hyperledger Fabric
Hyperledger Fabric - Blockchain, sushi and supply chain
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop

What's hot (20)

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

Similar to Using Blockchain to Increase Supply Chain Transparency (20)

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

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
history of c programming in notes for students .pptx
PDF
Understanding Forklifts - TECH EHS Solution
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
AI in Product Development-omnex systems
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Transform Your Business with a Software ERP System
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
VVF-Customer-Presentation2025-Ver1.9.pptx
history of c programming in notes for students .pptx
Understanding Forklifts - TECH EHS Solution
2025 Textile ERP Trends: SAP, Odoo & Oracle
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
AI in Product Development-omnex systems
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Upgrade and Innovation Strategies for SAP ERP Customers
wealthsignaloriginal-com-DS-text-... (1).pdf
Digital Strategies for Manufacturing Companies
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Operating system designcfffgfgggggggvggggggggg
Odoo POS Development Services by CandidRoot Solutions
Design an Analysis of Algorithms I-SECS-1021-03
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Essential Infomation Tech presentation.pptx
Transform Your Business with a Software ERP System
How to Migrate SBCGlobal Email to Yahoo Easily

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