The World has been following blockchain technology last year with the raise of the public blockchains, the Bitcoin value overpassing Gold and now private blockchains for Business.
Why so many interest on permissioned blockchain ? Which industries are impacted ? What is new for 2017 ? You will have a short presentation on blockchain and a demo on the latest Hyperledger Fabric V1 around an original use case for airline industry
3. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Agenda
What is Blockchain
Hyperledger Fabric
Demo : implementing a smart contract
Need help ?
5. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Introduction
Definition : a distributed system, introduced on
Bitcoin white paper in 2008, that maintains a
continuously-growing list of data records
hardened against tampering and revision
Maintain global state on distributed systems comes
from Byzantine Generals’ Problem described by Leslie
Lamport (1982)
Usage:
• Shared ledgers : digital currencies, etc …
• Distributed applications : smart contract, chaincode
Mesopotamian
ledger
Byzantine Generals’
Problem
6. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
The blockchain network
Page
Peer 1
chain
state
Distributed, almost real-time synchronized, no single point of failure, unstoppable
Peer 3
chain
state
Peer 2
chain
state
7. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
The chain inside a peer
… Block
n-1
Block
n
Genesis
Block 0
HASH
Previous
HASH
Payload
HASH
Previous
HASH
Payload
HASH
Previous
HASH
Payload
HASH
Each block contains the hash of the previous block
A hash is a compressed data of the payload. If the content changes, the hash changes too. We can verify
easily this
Each peer of the network contains the same blockchain locally, a consensus is needed to accept new blocks
and dispatch it all over the network
9. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes9
• An unregulated shadow-currency
• The first blockchain application
• Resource intensive (Proof Of Work Consensus)
Created in 2008 by Satoshi Nakamoto (a pseudonym) after Worldwide
financial crisis to propose a decentralized cash exchange system.
The aim is to allow people to transfer digital currency without intermediary,
no censorship and keeping (pseudo-)anonymity
10. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes10
It is an open source, public, blockchain-based distributed computing platform
featuring smart contract (scripting) functionality. It provides a
decentralized Turing-complete virtual machine, the Ethereum Virtual Machine
(EVM), which can execute scripts using an international network of public
nodes.
Ethereum also provides a value token called "ether", which can be
transferred between participants and is used to compensate participant nodes
for computations performed
The system comes from a Bitcoin fork and went live on 30 July 2015.
11. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Hyperledger
Hyperledger is a blockchain-based open
standard for distributed ledgers under the Linux
Foundation (>100 members)
The project aims to create an open, public,
decentralized ledger based on blockchain
technology
Answer to: business needs in terms of cost,
speed, compliance and traceability
Fabric
Burrow Indy
12. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Hyperledger Fabric
Key Features
• No Tokens ! Based on pluggable consensus (*BFT, Kafka)
• Channels for sharing confidential information
• Endorsement policies for transactions (rules based on “who can endorse”)
• Key/Value and JSON-stored world state support
• Bring-your-own Membership Service Provider (MSP)
• Developed in Go and uses .proto file (it means any language is supported)
• Easy deployment based on Docker images
• Smart contracts in Go and Java
14. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Actors
A common user interacting with the Blockchain using an application.
They could not be aware of the Blockchain.
The overall authority in a business network. Specifically, regulators
may require broad access to the ledger’s contents.
Manages the different types of certificates required to run a
permissioned Blockchain.
Any external systems which may be used by the Blockchain to
process transactions (APIs, proxy, etc …)
Existing data systems which may provide data to influence the
behavior of smart contracts.
Blockchain
User
Certificate
Authority
Blockchain
Regulator
Traditional
Processing
Platform &
Data
sources
U
R
ü
The developer of client applications and smart contracts which
interact with the network
Blockchain
Developer D
15. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Components
Membership
Smart
Contract
Systems
Management
Events
Consensus
Wallet
Ledger Contains the current World State of the ledger and a transaction
invocations chain of blocks
f(abc); The logic code running on each invocation call. Transaction
invocations result in updating or querying ledger State
…
E T
Chorum responsible for maintaining a consistently replicated ledger and
for agreeing on new blockchain block
Manages identity and transaction certificates
Creates notifications after smart contracts execution
Provides the ability to create, change and monitor Blockchain
components
Securely keeps user’s security credentials
i
Responsible for integrating Blockchain bi-directionally with
external systems. Not part of Blockchain, but used with it.
Systems
Integration
16. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Interactions
Communication channels:
• SDK : use gRPC to communicate with a blockchain peer or Certificate
Authority. Maintain the user’s key wallet and embed part of protocol
logic
Functional interaction methods:
• INSTALL* : copy a chaincode on a peer
• INSTANTIATE* : run the chaincode on some specific channels &
policies
• QUERY : to read data from World State
• INVOKE* : to call a chaincode method creating a new transaction
changing in a way the World State
• UPGRADE* : to deploy a new chaincode version
membership
keys
Ledger
Events
Chaincode
state
peer
SDK
ECA, TCA, TLS-CA
Blockchain
network
(* Creates a block on the chain)
17. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Architecture
1.Blockchain developer codes
Application and Smart Contract
2.He deploys the app on a server and
smart contract on a peer using
INSTALL/INSTANTIATE
3.A registered user interacts with the
app sending order (INVOKE) or
retrieving information (QUERY)
through the smart contract
4.Smart contract can emit an event
which can be susbcribed by the app
World State
Chain of blocks
Genesis
Block
…
Blockchain
developer
Smart
Contract
Invokes
Queries
Develops
ApplicationD
SDK
txn txn
Block n
PEER
develops, then deploys emits
PutState GetState
U
Blockchain
user
Interacts
18. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Think distributed and deterministic !!!
Get resources from external systems
peer
Blockchain
network
peer
peer
External System
Put resources to external systems
peer
Blockchain
network
peer
peer
t1 t3
t2
1 call
1 call
1 call
External System
19. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Hyperledger Fabric - Key features
• Endorsement/consensus model
• Plugging external identity server
• Plugging external State DB
• Historical queries
• HTTP API deprecated, use SDK
• Chaincode upgrades
20. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Fabric V1.0 - Endorsement/Consensus model
Peer role has been split :
• Committer peer : commits
transactions, maintains ledger and state
• Endorsing peer: receives a transaction
proposal for endorsement, responds
granting or denying endorsement
• Ordering peer: approves the inclusion
of transaction blocks into the ledger and
communicates with peer and endorsing
peer nodes
Also a peer can now communicate via
private channels inside the network to
strenghten privacy
– SOLO (Single node
for development)
– Kafka / Zookeeper
– SBFT (future)
Ordering-Service
OO
O O
E
C
Peer types
or
Consensus modes
21. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Fabric V1.0 - HTTP deprecated, use SDK
Do not use HTTP API anymore
Use SDK over gRPC :
• Java
• NodeJs
• Python
22. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Fabric V1.0 - Certificate Authority /
Membership Service Provider (MSP)
Make as pluggable as possible
Make it decentralized
Default implementation :
CloudFlare's PKI/TLS toolkit
Developed in GO
CLI commands for server and client
23. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Fabric V1.0 - new World State DB
Key/value database (LevelDB)
Document JSON database (CouchDB)
SQL data stores (future?)
• requires schema definition
• difficult to change schema
CouchDB
Chaincode
APIs
LevelDB
Worldstate
24. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Fabric V1.0 - Chaincode upgrades
New command UPGRADE to
use instead of redeploying
another chaincode
Chaincode will contain version
number
…
Smart
Contract
txn txn txn txn
Smart
Contract
Application
SDK
UPGRADE
Version N+1Version N
World/Ledger
State
25. @voxxed_thess #Blockchain #Hyperledger @reactivme @benji_fuentes
Fabric V1.0 - Historical queries
Simple use case :
• Show history of values for an asset X
Rich queries :
• Show value of an asset at a certain point
in time
• Show all assets having same field value
through history (example : owned by a
specific owner)
tt-1t-2