An Introduction to Blockchain and
Hyperledger
Lennart Frantzell
IBM Developer Advocate
San Francisco
alf@us.ibm.com
V1.2 February 1 2019
Blockchain Explored Series
IBM Blockchain Platform Explored
Fabric Explored
Composer Explored
What’s New
Architectures Explored
Global Financial Crisis 2008
2
3
4
The Blockchain Story
• Hyperl
edger
5
The Ledger problem
inefficient, expensive, vulnerable
Participant A’s records Participant B’s records Bank records
Insurer records Regulator records Auditor records
6
Blockchain
Participant A’s records Participant B’s records Bank records
Insurer records Regulator records Auditor records
The Ledger Solution
A shared, replicated, permissioned ledger…
…with consensus, provenance, immutability and finality
7
Hyperledger
8
Linux Foundation Open Source Hyperledger
•
App Layer: Hyperledger Sawtooth
Supply Chain
Cargill
https://sawtooth.hyperledger.org/examples/seafood.html
In December 2015, the Linux Foundation announced the creation of the Hyperledger Project.
Visual Studio Code
Roadmap
• Channels
• Selective endorsement
• SOLO/Kafka orderers
• LevelDB or CouchDB
• Javascript chaincode
• Connection profile
• Encryption library
• Attribute access control
• CouchDB indexes
• Channel based events
• ACLs
• Service discovery
• Pluggable endorsement and validation
• Private Data Collections
• State based endorsement
• Java chaincode
• CouchDB pagination
• Identity Mixer
• Local collections
• SDK improvements
• Lifecycle changes
• Revocation for Idemixer
• Tokenisation
• RAFT
• Operational metrics and logging
• SDK and SHIM improvements
• Burrow EVM
• Long Term Service (LTS) support
07/17 03/18 06/18 10/18 4Q/18
*
1Q/19
*
Based on https://wiki.hyperledger.org/projects/fabric/roadmap - Dates determined by the Hyperledger community - (*) Subject to change
v1
v1.1
v1.2
v1.3
v1.4
v2.0
10
Hyperledger functionality
https://cachin.com/cc/talks/20170106-blockchain-rwc.pdf
11
Pluggable Consensus
• https://www.slideshare.net/MattLucas3/blockchain-whats-new-in-hyperledger-fabric-oct-2018
• This modular architecture allows the platform to rely on well-established toolkits for
CFT (crash fault-tolerant) or BFT (byzantine fault-tolerant) ordering.
• In the currently available releases, Fabric offers a CFT ordering service implemented
with Kafka and Zookeeper. Kafka is fault tolerant, but not Byzantine fault tolerant
• In subsequent releases, Fabric will deliver a Raft consensus ordering service
implemented with etcd/Raft and a fully decentralized BFT ordering service.
12
Hyperledger Fabric components
• Hyperledger has three components:
– membership services – which manages digital certificates and access,
– ordering service – which keeps the peers in alignment,
– and peers – which hold the ledger.
• A peer is also where chaincode, also known as smart contracts, are executed.
• Membership and ordering services align well to being centralized.
– Peers, on the other hand, can be distributed and placed anywhere you desire in the
world.
– Each member of the Hyperledger network should have their own peer.
– The channels (databases) that a peer subscribes to, and transacts against, determines
the member’s role and capabilities in the blockchain network.
https://www.ibm.com/blogs/systems/blockchain-how-should-you-organize-your-peers/
13
The Blockchain
•
https://hyperledger-fabric.readthedocs.io/en/release-1.4/ledger/ledger.html?highlight=blockchain#a-
blockchain-ledger
Each block contains a cryptographic hash of the previous block,[and
transaction data (generally represented as a merkle tree root hash).
14
IBM Blockchain Platform
Platform Architecture Overview
Application SDK
Membership
Services
Peer
Endorser
Ledger
Committer
A
Chaincode B
!Events
Ordering-Service
O
O
O
Fabric-CAExternal-CA
optionaloptional Admin
Users
CACA
Hardware
Security
Module(*)
IBP UI
(*) Enterprise Plan
Certificate
Authority
IBM Blockchain
Platform
15
The Ledger, Blockchain and World State Database
https://hyperledger-fabric.readthedocs.io/en/release-1.4/ledger/ledger.html#example-ledger-fabcar
world state – a database that holds a cache of
the current values of a set of ledger states.
The world state makes it easy for a program
to directly access the current value of a state
rather than having to calculate it by traversing
the entire transaction log (= Blockchain).
16IBM Blockchain Platform
How applications interact with the IBM Blockchain
Platform
Blockchain
Developer
Develops
Chaincode
Submits
0 1 2 3
Ledger
Blockchain WorldState
Get, Put, Delete
Record
SDK
Application
!
Emits
Emits
!
Peer
Accesses
17
Developing Hyperledger
Apps, following the
process
18
What makes a good Blockchain Use Case?
•
• A Business problem that cannot easily be solved
with existing techniques
• An identifiable business network
• With a shared ledger
• With Participants, Assets and Transactions
• A need for embedded trust but no Trusted Third
Party
19
Blockchain Garage
https://www.ibm.com/blockchain/services
20
Step 1) Re-use existing Blockchain Use Cases
•
https://www.ibm.com/blockchain/use-cases/
21
Step 2) Leverage existing frameworks and libraries
22
3) Re-use IBM Code Patterns for Blockchain
• IBM Code Patterns for Blockchain: https://developer.ibm.com/patterns/category/blockchain/
• 10 Lessons: Design Thinking for Blockchain
https://www.ibm.com/blogs/insights-on-business/government/10-lessons-design-thinking-blockchain/
4) Use Visual Studio Code
23
IBM Blockchain Platform for Visual Studio Code
24
https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm
-blockchain-platform
IBM Blockchain Plugin to VSCode
25
1. Create smart contract Project
2. Edit / write smart contract files
3. Package a smart contract project
4. Export a smart contract package
5. Connect to local_fabric runtime
6. Teardown the local_fabric runtime
26
Example: The Blockchain Bean in the Supply Chain
Space
https://www.ibm.com/thought-leadership/blockchainbean/
YourCup NJB123
27
28
29
Coffee exported original document
30
31
32
IBM Cloud and
Hyperledger SaaS
33
IBM Cloud Catalog
34
35
36
How do we host our Blockchain application?
37
IBM Enterprise Blockchain Platform
38
Where do we go from here?
LinkedIn: lennartfrantzell
IBM Blockchain: https://www.ibm.com/blockchain
Build for free on IBM Cloud: https://ibm.biz/Bd2L5W
https://developer.ibm.com/startups/
Startup with IBM. Build. Scale. Win.
With $120,000 in free IBM Cloud credits, Startup with IBM can
put your business on the path to transformative growth. Disrupt
your industry with IBM.
Wwc  developing hyperledger applications v2

Wwc developing hyperledger applications v2

  • 1.
    An Introduction toBlockchain and Hyperledger Lennart Frantzell IBM Developer Advocate San Francisco alf@us.ibm.com V1.2 February 1 2019 Blockchain Explored Series IBM Blockchain Platform Explored Fabric Explored Composer Explored What’s New Architectures Explored
  • 2.
  • 3.
  • 4.
  • 5.
    5 The Ledger problem inefficient,expensive, vulnerable Participant A’s records Participant B’s records Bank records Insurer records Regulator records Auditor records
  • 6.
    6 Blockchain Participant A’s recordsParticipant B’s records Bank records Insurer records Regulator records Auditor records The Ledger Solution A shared, replicated, permissioned ledger… …with consensus, provenance, immutability and finality
  • 7.
  • 8.
    8 Linux Foundation OpenSource Hyperledger • App Layer: Hyperledger Sawtooth Supply Chain Cargill https://sawtooth.hyperledger.org/examples/seafood.html In December 2015, the Linux Foundation announced the creation of the Hyperledger Project. Visual Studio Code
  • 9.
    Roadmap • Channels • Selectiveendorsement • SOLO/Kafka orderers • LevelDB or CouchDB • Javascript chaincode • Connection profile • Encryption library • Attribute access control • CouchDB indexes • Channel based events • ACLs • Service discovery • Pluggable endorsement and validation • Private Data Collections • State based endorsement • Java chaincode • CouchDB pagination • Identity Mixer • Local collections • SDK improvements • Lifecycle changes • Revocation for Idemixer • Tokenisation • RAFT • Operational metrics and logging • SDK and SHIM improvements • Burrow EVM • Long Term Service (LTS) support 07/17 03/18 06/18 10/18 4Q/18 * 1Q/19 * Based on https://wiki.hyperledger.org/projects/fabric/roadmap - Dates determined by the Hyperledger community - (*) Subject to change v1 v1.1 v1.2 v1.3 v1.4 v2.0
  • 10.
  • 11.
    11 Pluggable Consensus • https://www.slideshare.net/MattLucas3/blockchain-whats-new-in-hyperledger-fabric-oct-2018 •This modular architecture allows the platform to rely on well-established toolkits for CFT (crash fault-tolerant) or BFT (byzantine fault-tolerant) ordering. • In the currently available releases, Fabric offers a CFT ordering service implemented with Kafka and Zookeeper. Kafka is fault tolerant, but not Byzantine fault tolerant • In subsequent releases, Fabric will deliver a Raft consensus ordering service implemented with etcd/Raft and a fully decentralized BFT ordering service.
  • 12.
    12 Hyperledger Fabric components •Hyperledger has three components: – membership services – which manages digital certificates and access, – ordering service – which keeps the peers in alignment, – and peers – which hold the ledger. • A peer is also where chaincode, also known as smart contracts, are executed. • Membership and ordering services align well to being centralized. – Peers, on the other hand, can be distributed and placed anywhere you desire in the world. – Each member of the Hyperledger network should have their own peer. – The channels (databases) that a peer subscribes to, and transacts against, determines the member’s role and capabilities in the blockchain network. https://www.ibm.com/blogs/systems/blockchain-how-should-you-organize-your-peers/
  • 13.
    13 The Blockchain • https://hyperledger-fabric.readthedocs.io/en/release-1.4/ledger/ledger.html?highlight=blockchain#a- blockchain-ledger Each blockcontains a cryptographic hash of the previous block,[and transaction data (generally represented as a merkle tree root hash).
  • 14.
    14 IBM Blockchain Platform PlatformArchitecture Overview Application SDK Membership Services Peer Endorser Ledger Committer A Chaincode B !Events Ordering-Service O O O Fabric-CAExternal-CA optionaloptional Admin Users CACA Hardware Security Module(*) IBP UI (*) Enterprise Plan Certificate Authority IBM Blockchain Platform
  • 15.
    15 The Ledger, Blockchainand World State Database https://hyperledger-fabric.readthedocs.io/en/release-1.4/ledger/ledger.html#example-ledger-fabcar world state – a database that holds a cache of the current values of a set of ledger states. The world state makes it easy for a program to directly access the current value of a state rather than having to calculate it by traversing the entire transaction log (= Blockchain).
  • 16.
    16IBM Blockchain Platform Howapplications interact with the IBM Blockchain Platform Blockchain Developer Develops Chaincode Submits 0 1 2 3 Ledger Blockchain WorldState Get, Put, Delete Record SDK Application ! Emits Emits ! Peer Accesses
  • 17.
  • 18.
    18 What makes agood Blockchain Use Case? • • A Business problem that cannot easily be solved with existing techniques • An identifiable business network • With a shared ledger • With Participants, Assets and Transactions • A need for embedded trust but no Trusted Third Party
  • 19.
  • 20.
    20 Step 1) Re-useexisting Blockchain Use Cases • https://www.ibm.com/blockchain/use-cases/
  • 21.
    21 Step 2) Leverageexisting frameworks and libraries
  • 22.
    22 3) Re-use IBMCode Patterns for Blockchain • IBM Code Patterns for Blockchain: https://developer.ibm.com/patterns/category/blockchain/ • 10 Lessons: Design Thinking for Blockchain https://www.ibm.com/blogs/insights-on-business/government/10-lessons-design-thinking-blockchain/
  • 23.
    4) Use VisualStudio Code 23
  • 24.
    IBM Blockchain Platformfor Visual Studio Code 24 https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm -blockchain-platform
  • 25.
    IBM Blockchain Pluginto VSCode 25 1. Create smart contract Project 2. Edit / write smart contract files 3. Package a smart contract project 4. Export a smart contract package 5. Connect to local_fabric runtime 6. Teardown the local_fabric runtime
  • 26.
    26 Example: The BlockchainBean in the Supply Chain Space https://www.ibm.com/thought-leadership/blockchainbean/ YourCup NJB123
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
    36 How do wehost our Blockchain application?
  • 37.
  • 38.
    38 Where do wego from here? LinkedIn: lennartfrantzell IBM Blockchain: https://www.ibm.com/blockchain Build for free on IBM Cloud: https://ibm.biz/Bd2L5W https://developer.ibm.com/startups/ Startup with IBM. Build. Scale. Win. With $120,000 in free IBM Cloud credits, Startup with IBM can put your business on the path to transformative growth. Disrupt your industry with IBM.