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
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703

Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703

  • 1.
    Deploy a blockchainweb-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 showof 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 willlearn 1. Blockchain vocabulary 📖
  • 4.
    4 What you willlearn 1. Blockchain vocabulary 2. A use-case of blockchain 📖 ✅
  • 5.
    5 What you willlearn 1. Blockchain vocabulary 2. A use-case of blockchain 3. Architecture behind a Hyperledger Fabric solution 📖 ✅ 🚧
  • 6.
    6 What you willlearn 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 willlearn 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 willlearn 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 oftenconsists 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 oftenconsists 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) -Newblocks 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) -Newblocks 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 HyperledgerFabric • Platform for distributed ledger solutions 📒
  • 18.
    18 What is HyperledgerFabric • Platform for distributed ledger solutions • Open Source – Contributions by hundreds of engineers from tens of organizations 📒 👨🏼💻👩🏼💻
  • 19.
    19 What is HyperledgerFabric • 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 tologic 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.
  • 22.
    22 Ledger … The blockchain developer Blockchain Developer D f(abc); Smart Contract Blockchaindevelopers’ 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 ablockchain solution Ledger List of transactions maintained by peers…
  • 24.
    24 Components in ablockchain solution Smart Contract Ledger List of transactions maintained by peers f(abc); Software running on peer, updates the world state …
  • 25.
    25 Components in ablockchain 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 ablockchain 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 ablockchain 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 ablockchain 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 ablockchain 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 ablockchain 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 Contractscontain the business logic deployed to peers
  • 32.
    32 Smart Contracts Smart Contractscontain the business logic deployed to peers • Interact with the world state through the Fabric shim interface
  • 33.
    33 Smart Contracts Smart Contractscontain 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 Contractscontain 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 applicationsuse 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 applicationsuse 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.
  • 38.
  • 39.
    39 Components in ane-voting blockchain solution Ledger The ledger containing history of submitted votes…
  • 40.
    40 Components in ane-voting blockchain solution Smart Contract Ledger The ledger containing history of submitted votes f(abc); voterContract. Registers voters & submits votes …
  • 41.
    41 Components in ane-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 ane-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 ane-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 ane-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 ane-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 ane-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.
  • 48.
    Concepts and Components Considerationsfor the Developer, Operator and Architect
  • 49.
    49 Working with theledger 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 theledger 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 theledger 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 theledger 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 theledger 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.
  • 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 📖 ✅ 🚧 📒 🔓 🏼
  • 56.
  • 57.
    Rate today’s session Sessionpage on conference website O’Reilly Events App