SlideShare una empresa de Scribd logo
1 de 58
Deploy a blockchain web-app
with Hyperledger Fabric
Horea Porutiu
Advisory Software Engineer, IBM
July 2019
Blockchain Architected
Blockchain Explored
Blockchain Solutions
Blockchain Composed
Next Steps
Blockchain Explained
IBM Blockchain Platform
2
By a show of hands…
1. Understands how blockchains work?
2. Know what Hyperledger Fabric is?
3. Developed a smart contract?
4. Developed a dapp?
5. Deployed a network to production?
✋🏼
⛓
3
What you will learn
1. Blockchain vocabulary 📖
4
What you will learn
1. Blockchain vocabulary
2. A use-case of blockchain
📖
✅
5
What you will learn
1. Blockchain vocabulary
2. A use-case of blockchain
3. Architecture behind a Hyperledger Fabric solution
📖
✅
🚧
6
What you will learn
1. Blockchain vocabulary
2. A use-case of blockchain
3. Architecture behind a Hyperledger Fabric solution
4. Difference between the world state and the ledger
📖
✅
🚧
📒
7
What you will learn
1. Blockchain vocabulary
2. A use-case of blockchain
3. Architecture behind a Hyperledger Fabric solution
4. Difference between the world state and the ledger
5. Difference between public and private blockchains
📖
✅
🚧
📒
🔓
8
What you will learn
1. Blockchain vocabulary
2. A use-case of blockchain
3. Architecture behind a Hyperledger Fabric solution
4. Difference between the world state and the ledger
5. Difference between public and private blockchains
6. How a client application invokes a smart contract
📖
✅
🚧
📒
🔓
🏼
9
Security: Public vs. private blockchains
•Bitcoin
•Users treated equally
•Identity is anonymous
Public blockchains
10
Security: Public vs. private blockchains
•Bitcoin
•Users treated equally
•Identity is anonymous
Public blockchains Private blockchains
•Hyperledger Fabric,
Quorum
•Network members
known, transactions can
be secret
11
Security: Public vs. private blockchains
• Identity management (anonymous vs. known)
•Bitcoin
•Users treated equally
•Identity is anonymous
Public blockchains Private blockchains
•Hyperledger Fabric,
Quorum
•Network members
known, transactions can
be secret
12
Security: Public vs. private blockchains
• Identity management (anonymous vs. known)
• Most business use-cases require private, permissioned blockchains
– Network members know who they’re dealing with (KYC)
– Membership is controlled
•Bitcoin
•Users treated equally
•Identity is anonymous
Public blockchains Private blockchains
•Hyperledger Fabric,
Quorum
•Network members
known, transactions can
be secret
13
A ledger often consists of two data structures
• Blockchain
o A linked list of blocks
o Each block describes a set of transactions
(e.g. the inputs to a smart contract invocation)
o Immutable – blocks cannot be tampered
block
txn txn txn
Blockchain
14
A ledger often consists of two data structures
• Blockchain
o A linked list of blocks
o Each block describes a set of transactions
(e.g. the inputs to a smart contract invocation)
o Immutable – blocks cannot be tampered
• World State
o An ordinary database (e.g. key/value store)
o Stores the combined outputs of all transactions
o CAN deleteWorld state
block
txn txn txn
Blockchain
15
Block detail (simplified)
-New blocks always added to the end
Block 16
Prev Block Hash:
57ec2fda71
Block Hash:
87ea2ffe94
Block Hash:
57ec2fda71
Block 15
Prev Block Hash:
d68b2f0a3b
Block 17
Prev Block Hash:
87ea2ffe94
Block Hash:
44bf2efe32
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
…
…
16
Block detail (simplified)
-New blocks always added to the end
-Each block header includes a hash of the current block transactions
and the previous block’s transactions
Block 16
Prev Block Hash:
57ec2fda71
Block Hash:
87ea2ffe94
Block Hash:
57ec2fda71
Block 15
Prev Block Hash:
d68b2f0a3b
Block 17
Prev Block Hash:
87ea2ffe94
Block Hash:
44bf2efe32
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
…
…
17
What is Hyperledger Fabric
• Platform for distributed ledger solutions
📒
18
What is Hyperledger Fabric
• Platform for distributed ledger solutions
• Open Source
– Contributions by hundreds of engineers from tens of
organizations
📒
👨🏼💻👩🏼💻
19
What is Hyperledger Fabric
• Platform for distributed ledger solutions
• Open Source
– Contributions by hundreds of engineers from tens of
organizations
• Features
– Smart Contracts (updates the ledger)
– Consensus (synch ledger across network)
– Privacy (channels)
🔒
📒
👨🏼💻👩🏼💻
20
Blockchain
User
Membership
Services
Blockchain
Developer
Blockchain
Network
Operator
Blockchain
B2B transactions
access to logic
access to data
creates
applications
operates
accesses
security
certificates
Regulator
performs
oversight
Traditional
Data
Sources
Traditional
Processing
Platforms
R
U
D
O

Blockchain
Architect
A
designs
Actors in a blockchain solution
21
The blockchain developer
Blockchain
Developer
D
f(abc);
Smart
Contract
Blockchain developers’ primary interests are…
Application
22
Ledger
…
The blockchain developer
Blockchain
Developer
D
f(abc);
Smart
Contract
Blockchain developers’ primary interests are…
…and how they interact with the ledger and other systems of record:
Systems
IntegrationEvents
!
Traditional
Data
Sources
Traditional
Processing
Platforms
Application
23
Components in a blockchain solution
Ledger List of transactions maintained by peers…
24
Components in a blockchain solution
Smart
Contract
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
25
Components in a blockchain solution
Smart
Contract
Peer
Network
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
Network which reaches consensus to add blocks
26
Components in a blockchain solution
Membership
Smart
Contract
Peer
Network
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
E T
Network which reaches consensus to add blocks
Authenticates and manages identities on network
27
Components in a blockchain solution
Membership
Smart
Contract
Events
Peer
Network
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
E T
Network which reaches consensus to add blocks
Authenticates and manages identities on network
Emits notifications of operations on network!
28
Components in a blockchain solution
Membership
Smart
Contract
Systems
Management
Events
Peer
Network
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
E T
Network which reaches consensus to add blocks
Authenticates and manages identities on network
Emits notifications of operations on network
Enables us to create/monitor blockchain componentsi
!
29
Components in a blockchain solution
Membership
Smart
Contract
Systems
Management
Events
Peer
Network
Wallet
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
E T
Network which reaches consensus to add blocks
Authenticates and manages identities on network
Emits notifications of operations on network
Enables us to create/monitor blockchain components
Securely manages a user’s credentials
i
!
30
Components in a blockchain solution
Membership
Smart
Contract
Systems
Management
Events
Peer
Network
Wallet
Ledger List of transactions maintained by peers
f(abc); Software running on peer, updates the world state
…
E T
Network which reaches consensus to add blocks
Authenticates and manages identities on network
Emits notifications of operations on network
Enables us to create/monitor blockchain components
Securely manages a user’s credentials
i
Systems
Integration Integrate blockchain with eternal systems
!
31
Smart Contracts
Smart Contracts contain the business logic deployed to peers
32
Smart Contracts
Smart Contracts contain the business logic deployed to peers
• Interact with the world state through the Fabric shim interface
33
Smart Contracts
Smart Contracts contain the business logic deployed to peers
• Interact with the world state through the Fabric shim interface
• Language support for:
– Golang
– Node.js
– Java
34
Smart Contracts
Smart Contracts contain the business logic deployed to peers
• Interact with the world state through the Fabric shim interface
• Language support for:
– Golang
– Node.js
– Java
Smart
ContractPeer
Client
Application
SDK
Invoke()
Admin
Install
Instantiate
Init()
35
Client Application
Client applications use Fabric SDK to:
• Connects over channels to peer and
orderer nodes
• Provide public / private keys ! Events
Channels
Client
Application SDK
🔑
36
Client Application
Client applications use Fabric SDK to:
• Connects over channels to peer and
orderer nodes
• Provide public / private keys
Connection Profile
• Network end-points and connection
parameters
• The gateway to submit transactions to
a Hyperledger Fabric network
! Events
Channels
Client
Application SDK
Local MSP
• Connection Parms
• Credential Store
• Channels
• Organisations
• Orderers
• Peers
• CAs
Connection Profile
🔑
37
Blockchain
developer
Smart
Contract
submitsdevelops
develops
recorded
accesses
event
emits
emits
D
Ledger
‘get’, ‘put’,
‘delete’
Client
Application
SDK
!
!
World state
block
txn txn txn
Blockchain
Peer
event
How applications interact with the ledger
38
Sample blockchain use-case: e-voting
39
Components in an e-voting blockchain solution
Ledger The ledger containing history of submitted votes…
40
Components in an e-voting blockchain solution
Smart
Contract
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
41
Components in an e-voting blockchain solution
Smart
Contract
Peer
Network
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
The peers which run the voterContract
42
Components in an e-voting blockchain solution
Membership
Smart
Contract
Peer
Network
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
E T
The peers which run the voterContract
Public and private key for each registered voter
43
Components in an e-voting blockchain solution
Membership
Smart
Contract
Events
Peer
Network
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
E T
The peers which run the voterContract
Public and private key for each registered voter
Emit events to when a transaction is complete!
44
Components in an e-voting blockchain solution
Membership
Smart
Contract
Systems
Management
Events
Peer
Network
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
E T
The peers which run the voterContract
Public and private key for each registered voter
Emit events to when a transaction is complete
VSCode extension to manage nodes & networki
!
45
Components in an e-voting blockchain solution
Membership
Smart
Contract
Systems
Management
Events
Peer
Network
Wallet
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
E T
The peers which run the voterContract
Public and private key for each registered voter
Emit events to when a transaction is complete
VSCode extension to manage nodes & network
Stores our voter’s public/private keys and certs
i
!
46
Components in an e-voting blockchain solution
Membership
Smart
Contract
Systems
Management
Events
Peer
Network
Wallet
Ledger The ledger containing history of submitted votes
f(abc);
voterContract. Registers voters & submits votes
…
E T
The peers which run the voterContract
Public and private key for each registered voter
Emit events to when a transaction is complete
VSCode extension to manage nodes & network
Stores our voter’s public/private keys and certs
i
Systems
Integration An API to validate voter registration (DMV API)
!
47
App Architecture
Concepts and Components
Considerations for the Developer,
Operator and Architect
49
Working with the ledger example: a change of
ownership transaction
World state
Transaction input - sent from application
invoke(voterContract, castVote,
2020election, 123123123, democrat)
txn txn txn
Application
f(abc);
Smart
Contract
50
Working with the ledger example: a change of
ownership transaction
World state
Transaction input - sent from application
invoke(voterContract, castVote,
2020election, 123123123, democrat)
Smart contract implementation
castVote(ctx, args) {
args.democrat.count++
}
txn txn txn
Application
f(abc);
Smart
Contract
51
Working with the ledger example: a change of
ownership transaction
World state
Transaction input - sent from application
invoke(voterContract, castVote,
2020election, 123123123, democrat)
democrat.count = 1
voterId.castBallot = true
World state: new contents
Smart contract implementation
castVote(ctx, args) {
args.democrat.count++
}
txn txn txn
Application
f(abc);
Smart
Contract
52
Working with the ledger example: a change of
ownership transaction
World state
Transaction input - sent from application
invoke(voterContract, castVote,
2020election, 123123123, democrat)
democrat.count = 1
voterId.castBallot = true
World state: new contents
Smart contract implementation
castVote(ctx, args) {
args.democrat.count++
}
txn txn txnDemocrat.co
unt = 1
Application
f(abc);
Smart
Contract
53
Working with the ledger example: a change of
ownership transaction
World state
Transaction input - sent from application
invoke(voterContract, castVote,
2020election, 123123123, democrat)
democrat.count = 1
voterId.castBallot = true
World state: new contents
Smart contract implementation
castVote(ctx, args) {
args.democrat.count++
}
txn txn txnDemocrat.co
unt = 1
“Invoke, voterContract,
castVote, 2020election,
123123123, democrat”
Application
f(abc);
Smart
Contract
54
E-voting Demo
55
What we learned
1. Blockchain vocabulary
2. A use-case of blockchain
3. Architecture behind a Hyperledger Fabric solution
4. Difference between the world state and the ledger
5. Difference between public and private blockchains
6. How a client application invokes a smart contract
📖
✅
🚧
📒
🔓
🏼
56
Contact
Questions⁉️: horea.porutiu@ibm.com
Twitter: @horeaporutiu
YouTube🎥: horeaporutiu
Rate today’s session
Session page on conference website O’Reilly Events App
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code

Más contenido relacionado

La actualidad más candente

Introduction of Lianjia China
Introduction of Lianjia ChinaIntroduction of Lianjia China
Introduction of Lianjia China
Gabriel Shen
 

La actualidad más candente (20)

IBM Blockchain 101
IBM Blockchain 101IBM Blockchain 101
IBM Blockchain 101
 
Blockchain: The New Technology of Trust
Blockchain: The New Technology of TrustBlockchain: The New Technology of Trust
Blockchain: The New Technology of Trust
 
Hyperledger
HyperledgerHyperledger
Hyperledger
 
Developing applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDKDeveloping applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDK
 
Introduction of Lianjia China
Introduction of Lianjia ChinaIntroduction of Lianjia China
Introduction of Lianjia China
 
How does blockchain work
How does blockchain workHow does blockchain work
How does blockchain work
 
Hyperledger Fabric Technical Deep Dive 20190618
Hyperledger Fabric Technical Deep Dive 20190618Hyperledger Fabric Technical Deep Dive 20190618
Hyperledger Fabric Technical Deep Dive 20190618
 
Blockchain
BlockchainBlockchain
Blockchain
 
IBM TradeLens.pptx
IBM TradeLens.pptxIBM TradeLens.pptx
IBM TradeLens.pptx
 
Hyperledger fabric 20180528
Hyperledger fabric 20180528Hyperledger fabric 20180528
Hyperledger fabric 20180528
 
Blockchain Essentials and Blockchain on Azure
Blockchain Essentials and Blockchain on AzureBlockchain Essentials and Blockchain on Azure
Blockchain Essentials and Blockchain on Azure
 
Blockchain: Real World Use Cases
Blockchain: Real World Use CasesBlockchain: Real World Use Cases
Blockchain: Real World Use Cases
 
0. dao as a token economy
0. dao as a token economy0. dao as a token economy
0. dao as a token economy
 
Blockchain and Smart Contracts (Series: Blockchain Basics)
Blockchain and Smart Contracts (Series: Blockchain Basics)Blockchain and Smart Contracts (Series: Blockchain Basics)
Blockchain and Smart Contracts (Series: Blockchain Basics)
 
Blockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for LibrariesBlockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for Libraries
 
An Introduction to Blockchain Technology
An Introduction to Blockchain Technology An Introduction to Blockchain Technology
An Introduction to Blockchain Technology
 
Blockchain, Predictive Analytics and Healthcare
Blockchain, Predictive Analytics and HealthcareBlockchain, Predictive Analytics and Healthcare
Blockchain, Predictive Analytics and Healthcare
 
MobiliteaTime #7 : Blockchain
MobiliteaTime #7 : BlockchainMobiliteaTime #7 : Blockchain
MobiliteaTime #7 : Blockchain
 
IBM Blockchain Overview
IBM Blockchain OverviewIBM Blockchain Overview
IBM Blockchain Overview
 
Blockchain in FinTech
Blockchain in FinTechBlockchain in FinTech
Blockchain in FinTech
 

Similar a Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code

Similar a Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code (20)

Blockchain architected
Blockchain architectedBlockchain architected
Blockchain architected
 
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger WorkshopIBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
 
Blockchain on Azure
Blockchain on AzureBlockchain on Azure
Blockchain on Azure
 
Real experience of blockchain in DataTrading
Real experience of blockchain in DataTradingReal experience of blockchain in DataTrading
Real experience of blockchain in DataTrading
 
Hyperledger Fabric and Tools
Hyperledger Fabric and ToolsHyperledger Fabric and Tools
Hyperledger Fabric and Tools
 
Blockchain in the Heart of Digital Transformation
Blockchain in the Heart of Digital TransformationBlockchain in the Heart of Digital Transformation
Blockchain in the Heart of Digital Transformation
 
Defrag X Keynote: Deploying and managing Global Blockchain Network
Defrag X Keynote: Deploying and managing Global Blockchain NetworkDefrag X Keynote: Deploying and managing Global Blockchain Network
Defrag X Keynote: Deploying and managing Global Blockchain Network
 
Defrag x blockchain keynote
Defrag x blockchain keynoteDefrag x blockchain keynote
Defrag x blockchain keynote
 
Anatomy of a hyperledger application
Anatomy of a hyperledger applicationAnatomy of a hyperledger application
Anatomy of a hyperledger application
 
IBM Blockchain Platform - Architectural Good Practices v1.0
IBM Blockchain Platform - Architectural Good Practices v1.0IBM Blockchain Platform - Architectural Good Practices v1.0
IBM Blockchain Platform - Architectural Good Practices v1.0
 
Gluecon 2016 Keynote: Deploying and Managing Blockchain Applications
Gluecon 2016 Keynote: Deploying and Managing Blockchain ApplicationsGluecon 2016 Keynote: Deploying and Managing Blockchain Applications
Gluecon 2016 Keynote: Deploying and Managing Blockchain Applications
 
Wwc developing hyperledger applications v4
Wwc  developing hyperledger applications v4Wwc  developing hyperledger applications v4
Wwc developing hyperledger applications v4
 
An introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruAn introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ru
 
Doag 2018 eine_reise_durch_die_blockchain_applikationsentwicklung_final
Doag 2018 eine_reise_durch_die_blockchain_applikationsentwicklung_finalDoag 2018 eine_reise_durch_die_blockchain_applikationsentwicklung_final
Doag 2018 eine_reise_durch_die_blockchain_applikationsentwicklung_final
 
Wwc developing hyperledger applications v2
Wwc  developing hyperledger applications v2Wwc  developing hyperledger applications v2
Wwc developing hyperledger applications v2
 
Blockchain on the oracle cloud, the next big thing
Blockchain on the oracle cloud, the next big thingBlockchain on the oracle cloud, the next big thing
Blockchain on the oracle cloud, the next big thing
 
All about blockchain
All about blockchainAll about blockchain
All about blockchain
 
New Business Models enabled by Blockchain
New Business Models enabled by BlockchainNew Business Models enabled by Blockchain
New Business Models enabled by Blockchain
 
Hyperledger Fabric & Composer
Hyperledger Fabric & Composer Hyperledger Fabric & Composer
Hyperledger Fabric & Composer
 
Hong Kong Hyperledger Meetup January 2018
Hong Kong Hyperledger Meetup January 2018Hong Kong Hyperledger Meetup January 2018
Hong Kong Hyperledger Meetup January 2018
 

Más de Horea Porutiu

Más de Horea Porutiu (8)

Ethereum Smart Contracts on Hyperledger Fabric
Ethereum Smart Contracts on Hyperledger Fabric Ethereum Smart Contracts on Hyperledger Fabric
Ethereum Smart Contracts on Hyperledger Fabric
 
Using Blockchain to Increase Supply Chain Transparency
Using Blockchain to Increase Supply Chain TransparencyUsing Blockchain to Increase Supply Chain Transparency
Using Blockchain to Increase Supply Chain Transparency
 
Hyperleger Fabric Workshop - Denver Blockchain Week
Hyperleger Fabric Workshop - Denver Blockchain WeekHyperleger Fabric Workshop - Denver Blockchain Week
Hyperleger Fabric Workshop - Denver Blockchain Week
 
Getting up and running with Hyperledger Fabric & Composer (Full Stack)
Getting up and running with Hyperledger Fabric & Composer (Full Stack)Getting up and running with Hyperledger Fabric & Composer (Full Stack)
Getting up and running with Hyperledger Fabric & Composer (Full Stack)
 
First steps with Bitcoin
First steps with BitcoinFirst steps with Bitcoin
First steps with Bitcoin
 
Blockchain workshop IBM CODE Day - Montevideo
Blockchain workshop IBM CODE Day - MontevideoBlockchain workshop IBM CODE Day - Montevideo
Blockchain workshop IBM CODE Day - Montevideo
 
First Steps with Blockchains
First Steps with BlockchainsFirst Steps with Blockchains
First Steps with Blockchains
 
First Steps with Blockchain
First Steps with BlockchainFirst Steps with Blockchain
First Steps with Blockchain
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code

  • 1. Deploy a blockchain web-app with Hyperledger Fabric Horea Porutiu Advisory Software Engineer, IBM July 2019 Blockchain Architected Blockchain Explored Blockchain Solutions Blockchain Composed Next Steps Blockchain Explained IBM Blockchain Platform
  • 2. 2 By a show of hands… 1. Understands how blockchains work? 2. Know what Hyperledger Fabric is? 3. Developed a smart contract? 4. Developed a dapp? 5. Deployed a network to production? ✋🏼 ⛓
  • 3. 3 What you will learn 1. Blockchain vocabulary 📖
  • 4. 4 What you will learn 1. Blockchain vocabulary 2. A use-case of blockchain 📖 ✅
  • 5. 5 What you will learn 1. Blockchain vocabulary 2. A use-case of blockchain 3. Architecture behind a Hyperledger Fabric solution 📖 ✅ 🚧
  • 6. 6 What you will learn 1. Blockchain vocabulary 2. A use-case of blockchain 3. Architecture behind a Hyperledger Fabric solution 4. Difference between the world state and the ledger 📖 ✅ 🚧 📒
  • 7. 7 What you will learn 1. Blockchain vocabulary 2. A use-case of blockchain 3. Architecture behind a Hyperledger Fabric solution 4. Difference between the world state and the ledger 5. Difference between public and private blockchains 📖 ✅ 🚧 📒 🔓
  • 8. 8 What you will learn 1. Blockchain vocabulary 2. A use-case of blockchain 3. Architecture behind a Hyperledger Fabric solution 4. Difference between the world state and the ledger 5. Difference between public and private blockchains 6. How a client application invokes a smart contract 📖 ✅ 🚧 📒 🔓 🏼
  • 9. 9 Security: Public vs. private blockchains •Bitcoin •Users treated equally •Identity is anonymous Public blockchains
  • 10. 10 Security: Public vs. private blockchains •Bitcoin •Users treated equally •Identity is anonymous Public blockchains Private blockchains •Hyperledger Fabric, Quorum •Network members known, transactions can be secret
  • 11. 11 Security: Public vs. private blockchains • Identity management (anonymous vs. known) •Bitcoin •Users treated equally •Identity is anonymous Public blockchains Private blockchains •Hyperledger Fabric, Quorum •Network members known, transactions can be secret
  • 12. 12 Security: Public vs. private blockchains • Identity management (anonymous vs. known) • Most business use-cases require private, permissioned blockchains – Network members know who they’re dealing with (KYC) – Membership is controlled •Bitcoin •Users treated equally •Identity is anonymous Public blockchains Private blockchains •Hyperledger Fabric, Quorum •Network members known, transactions can be secret
  • 13. 13 A ledger often consists of two data structures • Blockchain o A linked list of blocks o Each block describes a set of transactions (e.g. the inputs to a smart contract invocation) o Immutable – blocks cannot be tampered block txn txn txn Blockchain
  • 14. 14 A ledger often consists of two data structures • Blockchain o A linked list of blocks o Each block describes a set of transactions (e.g. the inputs to a smart contract invocation) o Immutable – blocks cannot be tampered • World State o An ordinary database (e.g. key/value store) o Stores the combined outputs of all transactions o CAN deleteWorld state block txn txn txn Blockchain
  • 15. 15 Block detail (simplified) -New blocks always added to the end Block 16 Prev Block Hash: 57ec2fda71 Block Hash: 87ea2ffe94 Block Hash: 57ec2fda71 Block 15 Prev Block Hash: d68b2f0a3b Block 17 Prev Block Hash: 87ea2ffe94 Block Hash: 44bf2efe32 Transaction Transaction Transaction Transaction Transaction Transaction … …
  • 16. 16 Block detail (simplified) -New blocks always added to the end -Each block header includes a hash of the current block transactions and the previous block’s transactions Block 16 Prev Block Hash: 57ec2fda71 Block Hash: 87ea2ffe94 Block Hash: 57ec2fda71 Block 15 Prev Block Hash: d68b2f0a3b Block 17 Prev Block Hash: 87ea2ffe94 Block Hash: 44bf2efe32 Transaction Transaction Transaction Transaction Transaction Transaction … …
  • 17. 17 What is Hyperledger Fabric • Platform for distributed ledger solutions 📒
  • 18. 18 What is Hyperledger Fabric • Platform for distributed ledger solutions • Open Source – Contributions by hundreds of engineers from tens of organizations 📒 👨🏼💻👩🏼💻
  • 19. 19 What is Hyperledger Fabric • Platform for distributed ledger solutions • Open Source – Contributions by hundreds of engineers from tens of organizations • Features – Smart Contracts (updates the ledger) – Consensus (synch ledger across network) – Privacy (channels) 🔒 📒 👨🏼💻👩🏼💻
  • 20. 20 Blockchain User Membership Services Blockchain Developer Blockchain Network Operator Blockchain B2B transactions access to logic access to data creates applications operates accesses security certificates Regulator performs oversight Traditional Data Sources Traditional Processing Platforms R U D O  Blockchain Architect A designs Actors in a blockchain solution
  • 22. 22 Ledger … The blockchain developer Blockchain Developer D f(abc); Smart Contract Blockchain developers’ primary interests are… …and how they interact with the ledger and other systems of record: Systems IntegrationEvents ! Traditional Data Sources Traditional Processing Platforms Application
  • 23. 23 Components in a blockchain solution Ledger List of transactions maintained by peers…
  • 24. 24 Components in a blockchain solution Smart Contract Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state …
  • 25. 25 Components in a blockchain solution Smart Contract Peer Network Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state … Network which reaches consensus to add blocks
  • 26. 26 Components in a blockchain solution Membership Smart Contract Peer Network Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state … E T Network which reaches consensus to add blocks Authenticates and manages identities on network
  • 27. 27 Components in a blockchain solution Membership Smart Contract Events Peer Network Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state … E T Network which reaches consensus to add blocks Authenticates and manages identities on network Emits notifications of operations on network!
  • 28. 28 Components in a blockchain solution Membership Smart Contract Systems Management Events Peer Network Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state … E T Network which reaches consensus to add blocks Authenticates and manages identities on network Emits notifications of operations on network Enables us to create/monitor blockchain componentsi !
  • 29. 29 Components in a blockchain solution Membership Smart Contract Systems Management Events Peer Network Wallet Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state … E T Network which reaches consensus to add blocks Authenticates and manages identities on network Emits notifications of operations on network Enables us to create/monitor blockchain components Securely manages a user’s credentials i !
  • 30. 30 Components in a blockchain solution Membership Smart Contract Systems Management Events Peer Network Wallet Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state … E T Network which reaches consensus to add blocks Authenticates and manages identities on network Emits notifications of operations on network Enables us to create/monitor blockchain components Securely manages a user’s credentials i Systems Integration Integrate blockchain with eternal systems !
  • 31. 31 Smart Contracts Smart Contracts contain the business logic deployed to peers
  • 32. 32 Smart Contracts Smart Contracts contain the business logic deployed to peers • Interact with the world state through the Fabric shim interface
  • 33. 33 Smart Contracts Smart Contracts contain the business logic deployed to peers • Interact with the world state through the Fabric shim interface • Language support for: – Golang – Node.js – Java
  • 34. 34 Smart Contracts Smart Contracts contain the business logic deployed to peers • Interact with the world state through the Fabric shim interface • Language support for: – Golang – Node.js – Java Smart ContractPeer Client Application SDK Invoke() Admin Install Instantiate Init()
  • 35. 35 Client Application Client applications use Fabric SDK to: • Connects over channels to peer and orderer nodes • Provide public / private keys ! Events Channels Client Application SDK 🔑
  • 36. 36 Client Application Client applications use Fabric SDK to: • Connects over channels to peer and orderer nodes • Provide public / private keys Connection Profile • Network end-points and connection parameters • The gateway to submit transactions to a Hyperledger Fabric network ! Events Channels Client Application SDK Local MSP • Connection Parms • Credential Store • Channels • Organisations • Orderers • Peers • CAs Connection Profile 🔑
  • 39. 39 Components in an e-voting blockchain solution Ledger The ledger containing history of submitted votes…
  • 40. 40 Components in an e-voting blockchain solution Smart Contract Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes …
  • 41. 41 Components in an e-voting blockchain solution Smart Contract Peer Network Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes … The peers which run the voterContract
  • 42. 42 Components in an e-voting blockchain solution Membership Smart Contract Peer Network Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes … E T The peers which run the voterContract Public and private key for each registered voter
  • 43. 43 Components in an e-voting blockchain solution Membership Smart Contract Events Peer Network Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes … E T The peers which run the voterContract Public and private key for each registered voter Emit events to when a transaction is complete!
  • 44. 44 Components in an e-voting blockchain solution Membership Smart Contract Systems Management Events Peer Network Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes … E T The peers which run the voterContract Public and private key for each registered voter Emit events to when a transaction is complete VSCode extension to manage nodes & networki !
  • 45. 45 Components in an e-voting blockchain solution Membership Smart Contract Systems Management Events Peer Network Wallet Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes … E T The peers which run the voterContract Public and private key for each registered voter Emit events to when a transaction is complete VSCode extension to manage nodes & network Stores our voter’s public/private keys and certs i !
  • 46. 46 Components in an e-voting blockchain solution Membership Smart Contract Systems Management Events Peer Network Wallet Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes … E T The peers which run the voterContract Public and private key for each registered voter Emit events to when a transaction is complete VSCode extension to manage nodes & network Stores our voter’s public/private keys and certs i Systems Integration An API to validate voter registration (DMV API) !
  • 48. Concepts and Components Considerations for the Developer, Operator and Architect
  • 49. 49 Working with the ledger example: a change of ownership transaction World state Transaction input - sent from application invoke(voterContract, castVote, 2020election, 123123123, democrat) txn txn txn Application f(abc); Smart Contract
  • 50. 50 Working with the ledger example: a change of ownership transaction World state Transaction input - sent from application invoke(voterContract, castVote, 2020election, 123123123, democrat) Smart contract implementation castVote(ctx, args) { args.democrat.count++ } txn txn txn Application f(abc); Smart Contract
  • 51. 51 Working with the ledger example: a change of ownership transaction World state Transaction input - sent from application invoke(voterContract, castVote, 2020election, 123123123, democrat) democrat.count = 1 voterId.castBallot = true World state: new contents Smart contract implementation castVote(ctx, args) { args.democrat.count++ } txn txn txn Application f(abc); Smart Contract
  • 52. 52 Working with the ledger example: a change of ownership transaction World state Transaction input - sent from application invoke(voterContract, castVote, 2020election, 123123123, democrat) democrat.count = 1 voterId.castBallot = true World state: new contents Smart contract implementation castVote(ctx, args) { args.democrat.count++ } txn txn txnDemocrat.co unt = 1 Application f(abc); Smart Contract
  • 53. 53 Working with the ledger example: a change of ownership transaction World state Transaction input - sent from application invoke(voterContract, castVote, 2020election, 123123123, democrat) democrat.count = 1 voterId.castBallot = true World state: new contents Smart contract implementation castVote(ctx, args) { args.democrat.count++ } txn txn txnDemocrat.co unt = 1 “Invoke, voterContract, castVote, 2020election, 123123123, democrat” Application f(abc); Smart Contract
  • 55. 55 What we learned 1. Blockchain vocabulary 2. A use-case of blockchain 3. Architecture behind a Hyperledger Fabric solution 4. Difference between the world state and the ledger 5. Difference between public and private blockchains 6. How a client application invokes a smart contract 📖 ✅ 🚧 📒 🔓 🏼
  • 57. Rate today’s session Session page on conference website O’Reilly Events App

Notas del editor

  1. Moving onto the topic of security. Making the assumption that public blockchains are anonymous (or at least pseudononymous). This may not always be the case but is a reasonable assumption for now. Think of privacy as being the polar opposite of anonymity: Anonymity = you know something happened but not who did it; Privacy = you know who did something but not what they did. Most businesses have KYC requirements, which necessitates privacy rather than anonymity.
  2. Moving onto the topic of security. Making the assumption that public blockchains are anonymous (or at least pseudononymous). This may not always be the case but is a reasonable assumption for now. Think of privacy as being the polar opposite of anonymity: Anonymity = you know something happened but not who did it; Privacy = you know who did something but not what they did. Most businesses have KYC requirements, which necessitates privacy rather than anonymity.
  3. Moving onto the topic of security. Making the assumption that public blockchains are anonymous (or at least pseudononymous). This may not always be the case but is a reasonable assumption for now. Think of privacy as being the polar opposite of anonymity: Anonymity = you know something happened but not who did it; Privacy = you know who did something but not what they did. Most businesses have KYC requirements, which necessitates privacy rather than anonymity.
  4. Moving onto the topic of security. Making the assumption that public blockchains are anonymous (or at least pseudononymous). This may not always be the case but is a reasonable assumption for now. Think of privacy as being the polar opposite of anonymity: Anonymity = you know something happened but not who did it; Privacy = you know who did something but not what they did. Most businesses have KYC requirements, which necessitates privacy rather than anonymity.
  5. In order to understand how the developer interacts with the ledger, it’s important to note that there are two data structures that are needed in order for the system to work. This is somewhat dependent on the blockchain implementation, but most work in a similar way. The blockchain itself – a chain of blocks – are used to hold transaction data. As we will see on the next chart, this is immutable meaning that data on this structure cannot be tampered with. There is also a data store needed to hold any variables that is manipulated as part of a transaction. Think about the blockchain as storing the input parameters to a transaction (e.g. transfer MyCar from Matt to Dave), and the world state as storing the output (e.g. MyCar is currently owned by Dave). Why do you need both? Think of a transaction to transfer currency from one party to another – how do you know how much balance the sending party has in order to see if the transaction can be completed? If you only had the blockchain linked list you would need to traverse the entire chain every time you wanted to check the balance, which is time consuming (and increasingly so as the chain grows). By storing current balances in a data store you can look this information up more quickly. Different blockchain implement this in different ways (e.g. UTXO - unspent transaction output which is used in Bitcoin).
  6. In order to understand how the developer interacts with the ledger, it’s important to note that there are two data structures that are needed in order for the system to work. This is somewhat dependent on the blockchain implementation, but most work in a similar way. The blockchain itself – a chain of blocks – are used to hold transaction data. As we will see on the next chart, this is immutable meaning that data on this structure cannot be tampered with. There is also a data store needed to hold any variables that is manipulated as part of a transaction. Think about the blockchain as storing the input parameters to a transaction (e.g. transfer MyCar from Matt to Dave), and the world state as storing the output (e.g. MyCar is currently owned by Dave). Why do you need both? Think of a transaction to transfer currency from one party to another – how do you know how much balance the sending party has in order to see if the transaction can be completed? If you only had the blockchain linked list you would need to traverse the entire chain every time you wanted to check the balance, which is time consuming (and increasingly so as the chain grows). By storing current balances in a data store you can look this information up more quickly. Different blockchain implement this in different ways (e.g. UTXO - unspent transaction output which is used in Bitcoin).
  7. This slide looks at the block in more detail and how it achieves immutability. The crucial aspect is the hash function. Each block contains a hash of the previous block, which itself is used to calculate the next block’s hash. This means that if any block were to be tampered with (e.g. a transaction added, deleted or modified) then the hash values would change and the blockchain would no longer be integral. The genesis block usually contains an arbitrary key value that is used to initialise the hash function. This is a simplification of the block detail. Generally, each block contains a Merkel root that links off to a tree of transactions. There is also other metadata, depending on the blockchain implementation (e.g. nonces and timestamps).
  8. This slide looks at the block in more detail and how it achieves immutability. The crucial aspect is the hash function. Each block contains a hash of the previous block, which itself is used to calculate the next block’s hash. This means that if any block were to be tampered with (e.g. a transaction added, deleted or modified) then the hash values would change and the blockchain would no longer be integral. The genesis block usually contains an arbitrary key value that is used to initialise the hash function. This is a simplification of the block detail. Generally, each block contains a Merkel root that links off to a tree of transactions. There is also other metadata, depending on the blockchain implementation (e.g. nonces and timestamps).
  9. The modular architecture, allows innovation and flexibility allowing components, such as consensus and membership services, to be plug-and-play.
  10. The modular architecture, allows innovation and flexibility allowing components, such as consensus and membership services, to be plug-and-play.
  11. The modular architecture, allows innovation and flexibility allowing components, such as consensus and membership services, to be plug-and-play.
  12. This shows the major actors within a blockchain network and what they are doing within the blockchain. The details are on the next slide. Presenters might like to hide either this slide or the following one, depending on personal preference.
  13. We’re simplifying things slightly – but making an assumption that the blockchain developer is responsible for the development of the end-user application and the smart contracts that are deployed to the blockchain. No application operates in isolation, so they’ll need to integrate it with existing processing platforms and data sources, as well as figure out what they want to use the ledger for. We’re assuming the developer is interested in the data formats and wire protocols that will allow them to integrate with these systems of record and the ledger, but will have no access to the production systems that carry live data.
  14. We’re simplifying things slightly – but making an assumption that the blockchain developer is responsible for the development of the end-user application and the smart contracts that are deployed to the blockchain. No application operates in isolation, so they’ll need to integrate it with existing processing platforms and data sources, as well as figure out what they want to use the ledger for. We’re assuming the developer is interested in the data formats and wire protocols that will allow them to integrate with these systems of record and the ledger, but will have no access to the production systems that carry live data.
  15. A developer will create an application and smart contract (could be different developers) The application will invoke calls within the smart contract via an SDK Those calls are processed by the business logic within the smart contract - a ‘put’ or ‘delete’ command will go through consensus protocol selected and added to the blockchain - a ’get’ command can only read from the world state but is not recorded on the blockchain An application can access Block information via rest APIs such as get block height Note the use of ‘Delete’ here – delete can delete keys from the world state database, but not transactions from the blockchain, which we’ve established is immutable.
  16. This presentation is in three sections: What is Blockchain: Covers the essentials of blockchain for business Why is it relevant: Key use-cases How can IBM help: IBM’s value proposition and the state of the technology
  17. This is an example of the transaction and how it might be stored on the blockchain. Again, blockchain implementations will do this in different ways and we’re talking about generalised smart contract processing blockchains here – but the pseudocode should give you an idea of how this can happen. Note that the transaction on the blockchain contains the payload of the transaction inputs (including the smart contract class and method name and the input parameters to it), and the world state is the result of having run the transaction.
  18. This is an example of the transaction and how it might be stored on the blockchain. Again, blockchain implementations will do this in different ways and we’re talking about generalised smart contract processing blockchains here – but the pseudocode should give you an idea of how this can happen. Note that the transaction on the blockchain contains the payload of the transaction inputs (including the smart contract class and method name and the input parameters to it), and the world state is the result of having run the transaction.
  19. This is an example of the transaction and how it might be stored on the blockchain. Again, blockchain implementations will do this in different ways and we’re talking about generalised smart contract processing blockchains here – but the pseudocode should give you an idea of how this can happen. Note that the transaction on the blockchain contains the payload of the transaction inputs (including the smart contract class and method name and the input parameters to it), and the world state is the result of having run the transaction.
  20. This is an example of the transaction and how it might be stored on the blockchain. Again, blockchain implementations will do this in different ways and we’re talking about generalised smart contract processing blockchains here – but the pseudocode should give you an idea of how this can happen. Note that the transaction on the blockchain contains the payload of the transaction inputs (including the smart contract class and method name and the input parameters to it), and the world state is the result of having run the transaction.
  21. This is an example of the transaction and how it might be stored on the blockchain. Again, blockchain implementations will do this in different ways and we’re talking about generalised smart contract processing blockchains here – but the pseudocode should give you an idea of how this can happen. Note that the transaction on the blockchain contains the payload of the transaction inputs (including the smart contract class and method name and the input parameters to it), and the world state is the result of having run the transaction.
  22. The photo is taken from Think 2019, where Marley Gray (head of blockchain for Microsoft) and Gari Singh (IBM CTO for blockchain) connected a Hyperledger Fabric network running on Azure to IBM Blockchain Platform
  23. The photo is taken from Think 2019, where Marley Gray (head of blockchain for Microsoft) and Gari Singh (IBM CTO for blockchain) connected a Hyperledger Fabric network running on Azure to IBM Blockchain Platform