O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Anatomy of a Hyperledger Application
Eric Cattoir
eric_cattoir@be.ibm.com
@CattoirEric
Dina Fatkulbayanova
dfatkulbayanova...
Agenda
•Hyperledger Architecture
•Application Components
•Smart Contracts
•Permissioned Ledger Access
•Summary
2
Agenda
•Hyperledger Architecture
•Application Components
•Smart Contracts
•Permissioned Ledger Access
•Summary
3
Hyperledger Architecture
4
Blockchain
User
Certificate
Authority
Blockchain
Developer
Blockchain
Network
Operator Traditional
Processing
Platforms
Tr...
Blockchain Participants
the business user, operating in a business network. This role interacts
with the Blockchain using ...
Blockchain Components
Membership
Smart Contract
Systems
Management
Events
Consensus
Network
Wallet
Ledger
contains the cur...
Agenda
•Hyperledger Architecture
•Application Components
•Smart Contracts
•Permissioned Ledger Access
•Summary
8
Typical Application
9
User Interface
API Layer NodeJS
Backend
Frontend
API
Golang
Chain code
World/Ledger
state
Blockchain
block
txn txn txn txn …
Blockchain
developer
Smart
Contract
invokesdevelops
develops
each ‘p...
Blockchain Applications
• Application
– Focuses on Blockchain user business needs and experience
– Calls smart contract fo...
Blockchain
Operator
configures,
operates
Smart
Contract
Application
deployed to and
executes on
peer nodes
invoke SC
peer
...
How a PBFT Network Works (1/4) – Submission
Non-validating peer
Validating peer
Validating Leader
456
Transaction
submitte...
How a PBFT Network Works (2/4) – Ordering
Non-validating peer
Validating peer
Validating Leader
456 123
789
…123 456 789
…...
How a PBFT Network Works (3/4) – Execution
Non-validating peer
Validating peer
Validating Leader
…123 456 789
…123 456 789...
How a PBFT Network Works (4/4) – Distribution
Non-validating peer
Validating peer
Validating Leader
…123 456 789
…123 456 ...
Blockchain Networks
• Blockchain Network
– Comprises a connected set of peer nodes, each owning a copy of the ledger
– Pee...
Agenda
•Hyperledger Architecture
•Application Components
•Smart Contracts
•Permissioned Ledger Access
•Summary
18
Implementing Chaincode
• Implement Chaincode Shim Interface
• Init()
• Invoked when you deploy the chain code
• Invoke()
•...
Blockchain
network
…
Integrating with Existing Systems
Transform Existing
systems
4. System
events
3. Blockchain
events
Sm...
Non-Deterministic Number Errors
21
…123 456 789
…123 456 789
…123 456 789
…123 456 789
External System
1005
– If each smar...
Agenda
•Hyperledger Architecture
•Application Components
•Smart Contracts
•Permissioned Ledger Access
•Summary
22
Requests
certificates
1xEcert, NxTcert
Consensus
Network
Blockchain
User A
usesEcert
Tcert invokes SC txn
(signed with Tke...
Transaction and Identity Privacy
• Transaction Certificates, Tcerts
– Disposable certificates, typically used once, reques...
Integrating with Existing systems
• Blockchain is network System of Record
• Smart contracts can call out to existing syst...
Agenda
•Hyperledger Architecture
•Application Components
•Smart Contracts
•Permissioned Ledger Access
•Summary
26
Summary and Next Steps
• Hyper ledger protocol Specification
• http://hyperledger-fabric.readthedocs.io/en/latest/
• Block...
Thank You!
28
Próximos SlideShares
Carregando em…5
×

Anatomy of a hyperledger application

Overview on how to build a Hyperledger application.

  • Entre para ver os comentários

Anatomy of a hyperledger application

  1. 1. Anatomy of a Hyperledger Application Eric Cattoir eric_cattoir@be.ibm.com @CattoirEric Dina Fatkulbayanova dfatkulbayanova93@gmail.com @dfatkulbayanov1
  2. 2. Agenda •Hyperledger Architecture •Application Components •Smart Contracts •Permissioned Ledger Access •Summary 2
  3. 3. Agenda •Hyperledger Architecture •Application Components •Smart Contracts •Permissioned Ledger Access •Summary 3
  4. 4. Hyperledger Architecture 4
  5. 5. Blockchain User Certificate Authority Blockchain Developer Blockchain Network Operator Traditional Processing Platforms Traditional Data Sources Blockchain B2B transactions access to logic access to data creates applications operates accesses security certificates Regulator performs oversight The Participants in a Blockchain Network R U D O  5
  6. 6. Blockchain Participants the business user, operating in a business network. This role interacts with the Blockchain using an application. They are not aware of the Blockchain. the overall authority in a business network. Specifically, regulators may require broad access to the ledger’s contents. the developer of applications and smart contracts that interact with the Blockchain and are used by Blockchain users. defines, creates, manages and monitors the Blockchain network. Each business in the network has a Blockchain Network operator. manages the different types of certificates required to run a permissioned Blockchain. an existing computer system which may be used by the Blockchain to augment processing. This system may also need to initiate requests into the Blockchain. an existing data system which may provide data to influence the behavior of smart contracts. Blockchain User Blockchain Developer Certificate Authority Blockchain Regulator Traditional Processing Platform Traditional Data Sources Blockchain Network Operator U R D O  6
  7. 7. Blockchain Components Membership Smart Contract Systems Management Events Consensus Network Wallet Ledger contains the current world state of the ledger and a Blockchain of transaction invocations f(abc); encapsulates business network transactions in code. transaction invocations result in gets and sets of ledger state … E T a collection of network data and processing peers forming a Blockchain network. Responsible for maintaining a consistently replicated ledger manages identity and transaction certificates, as well as other aspects of permissioned access creates notifications of significant operations on the Blockchain (e.g. a new block), as well as notifications related to smart contracts. Does not include event distribution. provides the ability to create, change and monitor Blockchain components securely manages a user’s security credentials i Blockchain Systems Integration responsible for integrating Blockchain bi-directionally with external systems. Not part of Blockchain, but used with it. 7
  8. 8. Agenda •Hyperledger Architecture •Application Components •Smart Contracts •Permissioned Ledger Access •Summary 8
  9. 9. Typical Application 9 User Interface API Layer NodeJS Backend Frontend API Golang Chain code
  10. 10. World/Ledger state Blockchain block txn txn txn txn … Blockchain developer Smart Contract invokesdevelops develops each ‘put’ or ’delete’ invoke recorded * Application Blockchain Applications and the Ledger Accesses (Rest API) event emits emits D 10 Ledger ‘get’ ‘put, ‘delete’
  11. 11. Blockchain Applications • Application – Focuses on Blockchain user business needs and experience – Calls smart contract for interactions with ledger state – Can access transaction ledger directly, if required – Can process events if required • Smart Contract – Chain code encapsulates business logic. Choice of implementation language – Contract developer defines relevant interfaces (e.g. queryOwner, updateOwner …) – Different interfaces access ledger state accordingly – consistent read and write provided – Each invocation of a smart contract is a “Blockchain transaction” • Ledger – World/Ledger state holds current value of smart contract data • e.g. vehicleOwner=Daisy – Blockchain holds historic sequence of all chain code transactions • e.g. updateOwner(from=John, to=Anthony); updateOwner (from=Anthony, to=Daisy);etc 11
  12. 12. Blockchain Operator configures, operates Smart Contract Application deployed to and executes on peer nodes invoke SC peer Exact network structure depends on consensus mechanism. e.g. PBFT has leader, validating and non-validating peers Consensus Network Consensus and the Blockchain Network O consensus msg consensus messages flow between appropriate peers to ensure the Blockchain SC transactions are kept in order; world state is kept consistent through local transaction replay … … scscsc … … scscsc … … … scscsc … scscsc 12
  13. 13. How a PBFT Network Works (1/4) – Submission Non-validating peer Validating peer Validating Leader 456 Transaction submitted to network 123 Transaction submitted to network 789 Transaction submitted to network …789 123 456 …456 789 123 …456 123 789 …123 456 789
  14. 14. How a PBFT Network Works (2/4) – Ordering Non-validating peer Validating peer Validating Leader 456 123 789 …123 456 789 …123 456 789 …123 456 789 …123 456 789 14 …123 456 789 Consensus network establishes order as
  15. 15. How a PBFT Network Works (3/4) – Execution Non-validating peer Validating peer Validating Leader …123 456 789 …123 456 789 …123 456 789 …123 456 789 15 …123 456 789 Consensus network establishes order as Δ Δ Δ Δ
  16. 16. How a PBFT Network Works (4/4) – Distribution Non-validating peer Validating peer Validating Leader …123 456 789 …123 456 789 …123 456 789 …123 456 789 16 …123 456 789 Consensus network establishes order as
  17. 17. Blockchain Networks • Blockchain Network – Comprises a connected set of peer nodes, each owning a copy of the ledger – Peers collaborate to maintain consistent replicated copies of the ledger • Different mechanisms for collaboration – so-called “consensus protocols” – Peers managed by key network participants • Consensus Protocol Options – PBFT excellent first choice. NOOPs (No Operation) available for starter networks – Other protocols can be added (non-trivial!) • PBFT Overview – Defines non-validating peers, validating peers, with 1-validating leader – Leader receives transactions from connected applications – Leader organizes and distributes transactions with validator network • Copes with erring and malicious validators at very low compute cost – Each v-peer executes transactions to bring local ledger copy up-to-date – Non-validating-peers’ ledgers maintained from connected validating-peer’s – Castro & Liskov's paper ‘Practical Byzantine Fault Tolerance and Proactive Recovery’ 17
  18. 18. Agenda •Hyperledger Architecture •Application Components •Smart Contracts •Permissioned Ledger Access •Summary 18
  19. 19. Implementing Chaincode • Implement Chaincode Shim Interface • Init() • Invoked when you deploy the chain code • Invoke() • Called when executing the contract • Takes function name as parameter • Query() • Implement Main() • Deploy through github 19
  20. 20. Blockchain network … Integrating with Existing Systems Transform Existing systems 4. System events 3. Blockchain events Smart contract 1. Call out to existing systems to enrich smart contract logic 20 2. Call into Blockchain network from existing systems
  21. 21. Non-Deterministic Number Errors 21 …123 456 789 …123 456 789 …123 456 789 …123 456 789 External System 1005 – If each smart contract calls out to external system to receive information or uses a non-deterministic variable, it will prevent consensus being achieved. – All external data sources should return the same result for the same calls and variables must be deterministic, any non-deterministic values must be defines as part of the transaction Requested current mileage of moving car 1006 1007 1008
  22. 22. Agenda •Hyperledger Architecture •Application Components •Smart Contracts •Permissioned Ledger Access •Summary 22
  23. 23. Requests certificates 1xEcert, NxTcert Consensus Network Blockchain User A usesEcert Tcert invokes SC txn (signed with TkeyA, encrypted with TkeyA, TkeyB…) TkeyA Smart contract deployed on every validating peer Enrollment certificates (Ecerts) and Transaction certificates (Tcerts) can only be linked by CA and user … (signed with Ekey of origin, encrypted with validators’ key) Blockchain User B TkeyB TkeyB shares Tcert public key Accesses ledger Permissioned Ledger Access U U Application Application uses TkeyB  sc Membership Certificate Authority (stored in wallet) 23
  24. 24. Transaction and Identity Privacy • Transaction Certificates, Tcerts – Disposable certificates, typically used once, requested from Transaction CA – Tcert derived from long term identity - Enrollment Certificate, Ecert – Only Transaction CA can link Ecert and Tcert • Permissioned Interactions – Consumer shares public Tcert to provider – Provider invokes chain code transaction as usual, but • Signs with provider’s private Tcert for authentication • Encrypts with provider and consumer Tcerts for subsequent access – Consumers can subsequently access ledger data using their private key • Secure chain code – CC can also be signed and encrypted, to keep verify and secure contract details – Signing is by contract owner/author – Encryption ensures only validators can see and execute transaction chain code 24
  25. 25. Integrating with Existing systems • Blockchain is network System of Record • Smart contracts can call out to existing systems – Query is most likely interaction for smart decisions • e.g. all payments made before asset transfer? – Transactions execute on every peer in the Blockchain network • Care over predictability… transaction must provide same outputs each time it executes • Two-way exchange – Events from Blockchain network create actions in existing systems – Cumulative actions in existing systems result in Blockchain interaction • Transformation between Blockchain and existing systems’ formats – GBO, ASBO is most likely approach – Standard approach will be for Gateway products to bridge these formats – Gateway connects to peer in Blockchain network and existing systems 25
  26. 26. Agenda •Hyperledger Architecture •Application Components •Smart Contracts •Permissioned Ledger Access •Summary 26
  27. 27. Summary and Next Steps • Hyper ledger protocol Specification • http://hyperledger-fabric.readthedocs.io/en/latest/ • Blockchain Courses IBM Developerworks • https://developer.ibm.com/courses/all-courses/blockchain-for-developers/ • Chaincode Developers Guide • http://hyperledger-fabric.readthedocs.io/en/latest/#chaincode-developer- guide • Bluemix Blockchain service • https://console.ng.bluemix.net/docs/services/blockchain/index.html 27
  28. 28. Thank You! 28

×