SlideShare una empresa de Scribd logo
1 de 61
Descargar para leer sin conexión
Hyperledger Fabric
Architecture
Mar. 2018
Sangmoon Oh (halfface@chollian.net)
2
ToC
I. Background of Enterprise Blockchain
II. Basic Architecture of Hyperledger Fabric
III. Fabric Network Provisioning
IV. Architectural Issues of Hyperledger Fabric
I. Background of Enterprise Blockchain
4
Information Security
I. Background of
Enterprise Blockchain
Confidentiality
Integrity Availability
Disclosed to unauthorized
Authentication, Encryption
Available when needed
Clustering, Fail-over
Prevent unauthorized
Modification
Authorization
5
Public Blockchain / Chain of Block
Genesis Block Block
  
Header
DataHashPrevHash
Data
Tx Data Tx Data
Tx Data Tx Data
 
Header
DataHashPrevHash
Data
Tx Data Tx Data
Tx Data Tx Data
 
blockn.prevHash = hash(blockn-1.header)
blockn.dataHash = hash(blockn.data)
 Provable Integrity
 Resistant to Modification
I. Background of
Enterprise Blockchain
6
Public Blockchain / Distributed Ledger
Peer
Peer
Peer
Peer
Peer
Peer
PeerPeer
 Replicated
 Synchronized
 Decentralized
 Open
 Extreme Availability
 Poor Confidentiality
I. Background of
Enterprise Blockchain
7
Public Blockchain / Decentralized Consensus
 Decentralized
Consensus
 PoW, PoS, DPoS, ...
 Serialized Change
 Extreme Integrity
 Terrible Performance
https://learn.onemonth.com/proof-of-work-vs-proof-of-stake/
https://depositphotos.com/search/bitcoin-mining.html?qview=34106323
I. Background of
Enterprise Blockchain
8
Public Blockchain / Fork
Peer
Peer Peer
Peer
Peer
Peer
Peer
Peer
Peer
Proof-of-Work  Mining : Can Make Conflict and Need Merge
I. Background of
Enterprise Blockchain
9
Public Blockchain / Summary
 Extreme Integrity
 Extreme Availability
 Poor Confidentiality
 Terrible Performance
 Chain of Block
 Distributed Ledger
 Decentralized
Consensus
I. Background of
Enterprise Blockchain
10
Enterprise Blockchain / Requirements
 Extreme
Integrity
 Extreme
Availability
 Poor
Confidentiality
 Terrible
Performance
 High Integrity
 High Availability
 High Confidentiality
 Good Performance
Public Blockchain Enterprise Blockchain
Chain of Block
Distributed
Ledger
Decentralized
Consensus
How ?
I. Background of
Enterprise Blockchain
11
Enterprise Blockchain / Core Strategy
 High Integrity
 High Availability
 High Confidentiality
 Good Performance
 Limited Peers
 Access Control
 Distributed Ledger
 Chain of Block
 PoX Alternative
I. Background of
Enterprise Blockchain
II. Basic Architecture of Hyperledger Fabric
13
Hyperledger Fabric / Intro
II. Basic Architecture of
Hyperledger Fabric
 Permissioned Blockchain
 Open-source (Apache-2.0)
 led by IBM and Linux Foundation
 1.1.0 : Mar 2018
1.0.0 : Jul 2017
1.0.0-alpha : Mar 2017
0.6.0-preview : Sep 2016
 implemented in Go
 Identity management
 Membership service
 Privacy and confidentiality
 Chaincode as smart contract
 Endorsement policy
 CouchDB as state database
14
Fabric / Full Stack
Fabric
Network
<<smart contract>>
Chaincode
Fabric Client SDK
(Decentralized)
Application
DBMS
Cluster
SQL, PL/SQL
JDBC,ODBC,OCI
Application
 Visualize data
 Calculate and analyze data
 Generate data
 General library and connector
 Low-level API
 Define data structure
 Manipulate data (CRUD)
 Persist data
 Share data
 Basic I/O
Hyperledger Fabric Traditional Appl.
II. Basic Architecture of
Hyperledger Fabric
15
Fabric / Projects
Project Description Commits Releases
fabric
Platform, Network,
Runtime
5,843 18
fabric-samples Sample codes
fabric-sdk-node Client SDK in Node.js 758 14
fabric-sdk-java Client SDK in Java 295 6
fabric-sdk-go Client SDK in Go 779 3
fabric-sdk-py Client SDK in Python 221 1
fabric-sdk-rest Client SDK in REST 110 0
fabric-chaincode-node Chaincode in Node.js 60 3
fabric-chaincode-java Chaincode in Java 24 0
composer
Application development
framework
4,749 75
Fabric
Network
<<smart contract>>
Chaincode
Fabric
Client SDK
(Decentralized)
Application
II. Basic Architecture of
Hyperledger Fabric
16
Fabric Network / Software Architecture
Peer Organization
Peer Organization
Orderer
Orderer
Kafka Kafka
Kafka Kafka
Orderer
CA
Server
Anchor
Peer
Ledger
Ledger Peer
Leader
Peer
Ledger
Ledger PeerCA
Server
Anchor
Peer
Ledger
Leader
Peer
Ledger
Ledger Peer
CA
Server
Anchor
Peer
Ledger
LedgerPeer
Leader
Peer Ledger
LedgerPeer
CA
Server
Client
Client
Client
Peer Organization
Orderer Organization
Peer
Ledger
Client
Orderer
Kafka
CA Server
II. Basic Architecture of
Hyperledger Fabric
17
Fabric Network / Key Concepts
 Peer and Leger
 Orderer Cluster
 Consensus
 Membership Service
 Channel
II. Basic Architecture of
Hyperledger Fabric
18
Fabric Network / Peer
State DB
Chain Data
Data
Files
Index
Files
State DB
Peer Node
State DB
Chain Data
Data
Files
Index
Files
gRPC/TLS
Chaincode
Peer Peer
Chaincode
Chain Data
Data
Files
Index
Files
Peer
Chaincode
II. Basic Architecture of
Hyperledger Fabric
19
Fabric Network / Ledger
State DBPeer
Chain Data
Data
Files
Index
Files
current/latest state data
(k, vn)
(k', v'm)
(k", v"s)
all data
(k, v1), (k, v2), (k, v3), .... (k, vn)
(k', v'1), (k', v'2), (k', v'3), .... (k', v'm)
(k", v"1), (k", v"2), (k", v"3), .... (k", v"s)
("BTC", {price: 10,000,000, at: 3/27})
("ETH", {price: 800,000, at: 3/27})
("BTC", {price: 10,000,000, at: 3/27})
("BTC", {price: 9,500,000, at: 3/26})
("BTC", {price: 9,000,000, at: 3/25})
("BTC", {price: 8,000,000, at: 3/24})
...
Chaincode
II. Basic Architecture of
Hyperledger Fabric
20
Fabric Network / Data Access
 Put(k,vn)
State DB
Chain Data
Data
Files
Index
Files
 (k,vn-1)  (k,vn)
 Contains (k,v1) ... (k,vn-1)
 Get(k)
State DBPeer
Chain Data
Data
Files
Index
Files
 Select(k): vn
Write Transaction Read Transaction
II. Basic Architecture of
Hyperledger Fabric
Peer
Chaincode
 Add(k,vn)
Chaincode
 Contains (k,v1) ... (k,vn)
21
Fabric Network / Orderer Cluster
Kafka Kafka
Kafka Kafka
ZooKeeper ZooKeeper ZooKeeper
ZooKeeper Ensemble
Orderer
Orderer
Orderer
Orderer
Kafka Cluster
Produce Msg
Produce Msg
Produce Msg
Produce Msg
Consume Msg
Distributed messaging queue
Queuing transactions
 Distributed Cluster Coordinator
 Manage configs and states
of Kafka brokers
Build Block
II. Basic Architecture of
Hyperledger Fabric
22
Fabric Network / Membership Service
Peer
ca-cert tls-ca-cert
key
cert
tls-key
tls-cert
Client
ca-cert tls-ca-cert
key
cert
tls-key
tls-cert
Orderer
ca-cert tls-ca-cert
key
cert
tls-key
tls-cert
Signed Data/gRPC/TLS
 Hyperledger Fabric V1.0: Block Structure
II. Basic Architecture of
Hyperledger Fabric
23
Fabric Network / Membership Service
Peer1-1
ca1-cert
key1-1
cert1-1
ca0-cert
ca2-cert
CA1
Server
Peer1-2
ca1-cert
key1-2
cert1-2
ca0-cert
ca2-cert
Orderer0-1
ca0-cert
key0-1
cert0-1
ca1-cert
ca2-cert
CA0
Server
Orderer0-2
Orderer0-3
Peer2-1
ca2-cert
key2-1
cert2-1
ca0-cert
ca1-cert
CA2
Server
Peer2-2
Peer2-3
Clienta
ca1-cert
keya certa
org1 org0
org2
II. Basic Architecture of
Hyperledger Fabric
24
org3
org0
Fabric Network / Channel
org2
org1
Orderer Orderer
Orderer
Kafka
Cluster
Peerledger1
ledger1
Leader
Peer
ledger1
ledger1
Peer
ledger1
Leader
Peer
ledger1
ledger1
Peer ledger2
ledger2ledger2
ledger
Leader
Peer
ledger2
ledger2
ledger2
Peer
Peer
Peer
Peer
Peer
Project Orderers Peers Ledger
channel1 org0 org1, org2 ledger1
channel1 org0 org2, org3 ledger2
channel1
channel2
II. Basic Architecture of
Hyperledger Fabric
25
Fabric Network / Channel (2)
Fabric
Network
Chaincode
Hyperledger Fabric
Channel
n
1
n
1
DBMS
Table
Schema
n
1
n
1
RDBMS
Channel Chaincode
Supply
Management
 Part
 Supplier
 Warehouse
 Procurement
Order
Management
 Customer
 Product
 Order
 Delivery
II. Basic Architecture of
Hyperledger Fabric
26

Orderer
Cluster
 Pull Block
Fabric / Consensus / Interaction
Peer
PeerClient
Peer
Peer
Peer
Leader
Peer
 Propose Tx
 Propose Tx
 Simulate Tx Inspect Proposal Resp.
 Submit Tx
 Build Block
Block = L(Tx1…Txn)
Leader
Peer

 Simulate Tx
 Deliver Block




 Validate Txs
Update Ledger




 Emit Event
II. Basic Architecture of
Hyperledger Fabric
27
Fabric / Consensus / Sequence
Client
Endorsing
Peer
Endorsing
Peer
Propose
Transaction Simulate
Transaction
Propose
Transaction Simulate
Transaction
Orderer
Submit Transaction
Kafka
Produce
Message
Orderer
Consume
Messages
Build
Block
Leader
Peer
Pull Block
Validate
Transactions
Update
Ledger
(Commit)
Peer
Deliver
Block
Leader
Peer
Deliver
Block
Wait Event
Emit Event
Peer
Pull Block
1) Propose Tx
2) Verify Tx
3) Simulate Tx
4) Submit Tx
5) Enqueue Tx
6) Dequeue Tx
7) Build Block
8) Deliver Block
9) Validate Tx
10) Commit Tx
11) Emit Ev
II. Basic Architecture of
Hyperledger Fabric
28
Fabric Network / Software Architecture / Revisited
 Network = Channel1...n
 Channel = Peer Org.1...n + Orderer Cluster + Ledger + Chaincode1...m
 Peer Org. = Leader Peer + Anchor Peer + Peer0...n + CA Server
II. Basic Architecture of
Hyperledger Fabric
29
Fabric / Features Revisited
 PKI based
Membership
Service
 Ordering
Service
 Forkless
 Limited Peers
 Access Control
 Proof-of-Work
Alternative
 High
Confidentiality
 Good
Performance
II. Basic Architecture of
Hyperledger Fabric
III. Fabric Network Provisioning
31
Fabric Network / Production Example
III. Fabric Network
Provisioning
ZooKeeper
Kafka
Orderer
ZooKeeper
Kafka
Orderer
ZooKeeper
Orderer
Kafka
CA Server
Kafka
[anchor]
Peer
CouchDB
[leader]
Peer
CouchDB
Peer
CouchDB
Peer
CouchDB
CA Server
org1
[anchor]
Peer
CouchDB
[leader]
Peer
CouchDB
Peer
CouchDB
Peer
CouchDB
CA Server
org2
[anchor]
Peer
CouchDB
[leader]
Peer
CouchDB
Peer
CouchDB
Peer
CouchDB
CA Server
org3
Peer
CouchDB
[leader]
Peer
CouchDB
Peer
CouchDB
[anchor]
Peer
CouchDB
CA Server
org4
[leader]
Peer
CouchDB
[anchor]
Peer
CouchDB
Peer
CouchDB
Peer
CouchDB
CA Server
org5
org0
Grafana
Prometheus
Monitoring System Client
Client
Category
#of
Instance
Host 25
ZooKeeper 3
Kafka 4
Orderer 3
Peer 20
CouchDB 20
CA Server 6
Prometheus 1
Grafana 1
 25 Machines
 58 Services of 8 Types
32
Fabric Network / PoC Example
III. Fabric Network
Provisioning
machine3
[leader]
Peer
CouchDB
machine1
Orderer
ZooKeeper
Kafka
machine2
Orderer
ZooKeeper
Kafka
Peer
CouchDB
CA Server
Client
Category
#of
Instance
Host 4
ZooKeeper 2
Kafka 2
Orderer 2
Peer 4
CouchDB 4
CA Server 2
 4 Machines
 16 Services of 6 Types
machine4
[leader]
Peer
CouchDB
Peer
CouchDB
CA Server
33
12) Install CA server,
Peer, CouchDB images
13) Run CA server containers
14) Run CouchDB containers
15) Run Peer containers
Fabric Network / Provisioning Environment
III. Fabric Network
Provisioning
Control
Machine
Orderer
Machine
Client
Machine
Peer
Machine
1) Install Fabric/Fabric CA tools
2) Generate crypto artifacts(keys, certs)
3) Generate genesis block
4) Generate config transactions
• Building Your First Network
• hyperledger/fabric-samples/first-network/
• hyperledger/fabric/examples/e2e_cli/
Monitoring
Server
5) Deploy crypto artifacts
6) Deploy crypto artifacts
7) Deploy genesis block
8) Install ZooKeeper, Kafka, Orderer images
9) Run ZooKeeper containers
10) Run Kafka containers
11) Run Orderer containers
16) Create channels
17) Make Peers join channels
18) Register and enroll user accounts
22) Deploy chaincodes
23) Deploy client appls.
24) Run client appls.
19) Install Prometheus,
Grafana images
20) Run Prometheus
21) Run Grafana
34
Fabric Network / Provisioning Process
III. Fabric Network
Provisioning
1. Install Docker, Node.js and so on.
2. Install Fabric and Fabric CA tools.
3. Write down cryptogen input file.
4. Generate crypto artifacts using
cryptogen tool.
5. Write down configtxgen input file.
6. Generate genesis block.
7. Generate channel config transactions.
8. Generate anchor update transactions.
9. Deploy crypto artifacts and genesis block.
1. Install Docker images (Fabric CA server,
ZooKeeper, Kafka, Orderer, CouchDB, Peer, ...)
2. Run Fabric CA server containers
3. Run ZooKeeper containers
4. Run Kafka containers
5. Run Fabric Orderer containers
6. Run CouchDB containers
7. Run Fabric Peer containers
8. Create Fabric channels
9. Make Fabric Peers join the channels
10.Register and enroll user accounts
11.Deploy test chaincode and client appls.
12.Run test client appls.
35
Fabric Network / Provisioning / Prerequisites
III. Fabric Network
Provisioning
Software Version Remarks
Ubuntu 16.04 • For all machines
Docker 17.06.2-ce
• For all Peer and Orderer machines
• Get Docker CE for Ubuntu
Docker
Composer
1.14.0
• For all Peer and Orderer machines
• docker/compose/1.14.0
Node.js 8.10.0
• For all client application machine
• Installing Node.js 8.10 on Debian and Ubuntu based
Linux distributions
npm 5.6.0 • For all client application machine
Python 2.7 • For all client application machine
Go 1.9.4
• For all Peers
• Fabric 1.1 : compiled with Go 1.9.2
• Installing Golang on Ubuntu
Recommended Runtime Environment for Fabric 1.1
36
Fabric Network / Provisioning / FabricFabric CA Tools
III. Fabric Network
Provisioning
Tool Description
cryptogen • Generate keys and certificates for Fabric network.
configtxgen
• Create and inspect configuration related artifacts. - genesis block,
channel creation tx, ...
peer
• Operate a channel
(peer channel create|fetch|join|list|update|signconfigtx|getinfo)
• Operate a chaincode
(peer chaincode install|instantiate|invoke|...|upgrade|list)
• Log levels (peer logging getlevel|setlevel|revertlevels)
• Operate a peer node (peer node start|status)
fabric-ca-client • Register, enroll, reenroll or revoke Fabric CA identities
 Fabric/Fabric CA command-line tools for provisioning Fabric network
 Download Platform-specific Binaries
 curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0
 https://goo.gl/6wtTN5
37
Fabric Network / Provisioning / Docker Containers
III. Fabric Network
Provisioning
 Hyperledger Docker Repository
- https://hub.docker.com/u/hyperledger/
 Hyperledger Fabric 1.1 Dockerfile
- https://github.com/hyperledger/fabric/tree/release-1.1/images
fabric-baseos
fabric-peer
fabric-orderer fabric-ccenv
fabric-ca
fabric-baseimage
fabric-kafka
fabric-zookeeper
fabric-couchdb
38
Fabric Network / Provisioning / Prepare Artifacts
III. Fabric Network
Provisioning
Usage Generate keys and certificates(crypto artifacts) for Fabric network.
Input crypto-config.yaml
Input Samples
 hyperledger/fabric-samples/first-network/crypto-config.yaml
 hyperledger/fabric/examples/e2e_cli/crypto-config.yaml
Output
 keys and certificates for Fabric CA server
 signing keys and certificates, TLS keys and certificates for Orderers and Peers
 signing key and certificate, TLS key and certificate of admin for each Org.
Output Samples  hyperledger/fabric/sampleconfig/msp/
 cryptogen
 configtxgen
Usage Create and inspect configuration related artifacts
Input configtx.yaml
Input Samples
 hyperledger/fabric/sampleconfig/configtx.yaml
 hyperledger/fabric-samples/first-network/configtx.yaml
 hyperledger/fabric/e2e_cli/configtx.yaml
Output
 genesis block
 channel creation transaction for each channel
 anchor peer update transactions for each channel
Output Samples  hyperledger/fabric-samples/basic-network/config/
39
Fabric Network / Provisioning / Crypto Artifacts
III. Fabric Network
Provisioning
OrdererOrgs:
- Name: org0
Domain: org0
CA:
HostName : ca0
CommonName: ca0
Specs:
- Hostname: orderer1
CommonName: orderer1
- Hostname: orderer2
CommonName: orderer2
PeerOrgs:
- Name: org1
Domain: org1
CA:
HostName : ca1
CommonName: ca1
Specs:
- Hostname: peer1
CommonName: peer1
- Hostname: peer2
CommonName: peer2
- Hostname: peer3
CommonName: peer3
- Hostname: peer4
CommonName: peer4
Users:
Count: 1
- Name: org2
Domain: org2
CA:
HostName : ca2
CommonName: ca2
Specs:
- Hostname: peer5
CommonName: peer5
- Hostname: peer6
CommonName: peer6
- Hostname: peer7
CommonName: peer7
- Hostname: peer8
CommonName: peer8
Users:
Count: 1
- Name: org3
Domain: org3
CA:
HostName : ca3
CommonName: ca3
Specs:
- Hostname: peer9
CommonName: peer9
- Hostname: peer10
CommonName: peer10
- Hostname: peer11
CommonName: peer11
- Hostname: peer12
CommonName: peer12
Users:
Count: 1
cryptogen
40
Fabric Network / Provisioning / Config Transactions
III. Fabric Network
Provisioning
Profiles:
GenesisProfile:
Orderer:
<<: *ordererDefaults
Organizations:
- *org0
Consortiums:
Channel1Consortium:
Organizations:
- *org1
- *org2
- *org3
Channel2Consortium:
Organizations:
- *org1
- *org2
- *org3
Channel1Profile:
Consortium: Channel1Consortium
Application:
<<: *applicationDefaults
Organizations:
- *org1
- *org2
- *org3
Channel2Profile:
Consortium: Channel2Consortium
Application:
<<: *applicationDefaults
Organizations:
- *org1
- *org2
- *org3
Organizations:
- &org0
Name: org0
ID: org0
MSPDir: crypto/ordererOrganizations/org0/msp
AdminPrincipal: Role.ADMIN
- &org1
Name: org1
ID: org1
MSPDir: crypto/peerOrganizations/org1/msp
AdminPrincipal: Role.ADMIN
AnchorPeers:
- Host: *.*.*.173
Port: 7051
...
Orderer: &ordererDefaults
OrdererType: kafka
Addresses:
- *.*.*.188:7050
- *.*.*.166:7050
BatchTimeout: 4s
BatchSize:
MaxMessageCount: 400
AbsoluteMaxBytes: 5 MB
PreferredMaxBytes: 1024 KB
Kafka:
Brokers:
- *.*.*.*:9092
- *.*.*.*:9092
...
configtxgen
41
Fabric Network / Provisioning / Run ZooKeeper
III. Fabric Network
Provisioning
#! /bin/bash
docker run -d 
--name ${zk_name} 
--network host 
-e ZOO_MY_ID=${zk_id} 
-e ZOO_PORT=${zk_port} 
-e ZOO_SERVERS=${zk_servers} 
-e ZOO_TICK_TIME ${zk_tick_time} 
-e ZOO_INIT_LIMIT ${zk_init_limit} 
-e ZOO_SYNC_LIMIT ${zk_sync_limit} 
hyperledger/fabric-zookeeper:${host_arch}-${fabric_ver}
42
Fabric Network / Provisioning / Run Kafka
III. Fabric Network
Provisioning
#! /bin/bash
docker run -d 
--name ${name} 
--network host 
-e KAFKA_ZOOKEEPER_CONNECT=${zk_connect_str} 
-e KAFKA_ADVERTISED_HOST_NAME=${name} 
-e KAFKA_BROKER_ID=${broker_id} 
-e KAFKA_LISTENERS=PLAINTEXT://${listener_addr}:${listener_port} 
-e KAFKA_MESSAGE_MAX_BYTES=${message_max_bytes} 
-e KAFKA_MIN_INSYNC_REPLICAS=${min_insync_replicas} 
-e KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false
-e KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT.MS=${zk_conn_timeout_ms} 
-e KAFKA_DEFAULT_REPLICATION_FACTOR=${default_replication_factor} 
-e KAFKA_REPLICA_FETCH_MAX_BYTES=${message_max_bytes} 
-e KAFKA_METRICS_RECORDING_LEVEL=${metrics_recording_level} 
-e KAFKA_HEAP_OPTS=${jvm_heap_opts} 
-e KAFKA_JVM_PERFORMANCE_OPTS=${jvm_perf_opts} 
-e KAFKA_GC_LOG_OPTS=${jvm_gc_log_opts} 
-e KAFKA_JMX_OPTS=${jvm_jmx_opts} 
hyperledger/fabric-kafka:${host_arch}-${fabric_ver}
43
- name: Run Fabric Orderer containers
docker_container:
image: "{{ docker.images.orderer.repository }}:{{ docker.images.orderer.tag }}"
name: "{{ item.name }}"
network_mode: host
env:
ORDERER_GENERAL_LISTENADDRESS: "{{ hostvars[item.host].ansible_host }}"
ORDERER_GENERAL_LISTENPORT: "{{ item.port }}"
ORDERER_GENERAL_TLS_PRIVATEKEY: /var/hyperledger/orderer/tls/server.key
ORDERER_GENERAL_TLS_CERTIFICATE: /var/hyperledger/orderer/tls/server.crt
ORDERER_GENERAL_TLS_ROOTCAS: [/var/hyperledger/orderer/tls/ca.crt]
ORDERER_GENERAL_LOGLEVEL: "{{ item.config.General.LogLevel }}"
ORDERER_GENERAL_GENESISMETHOD: file # provisional | file
ORDERER_GENERAL_GENESISFILE: /var/hyperledger/orderer/orderer.genesis.block
ORDERER_GENERAL_LOCALMSPDIR: /var/hyperledger/orderer/msp
...
volumes:
- "~/fabric/configtx/genesis.block:/var/hyperledger/orderer/orderer.genesis.block"
- "~/fabric/crypto/ordererOrganizations/{{ item.org }}/orderers/{{ item.name }}/msp
:/var/hyperledger/orderer/msp"
- "~/fabric/crypto/ordererOrganizations/{{ item.org }}/orderers/{{ item.name }}/tls/
:/var/hyperledger/orderer/tls"
- "~/fabric/volumes/{{ item.name }}/var/hyperledger/production/orderer
:/var/hyperledger/production/orderer"
Fabric Network / Provisioning / Run Orderers
III. Fabric Network
Provisioning
 hyperledger/fabric/fabric/sampleconfig/orderer.yaml
44
- name: Run Fabric Peer Containers
docker_container:
image: "{{ docker.images.peer.repository }}:{{ docker.images.peer.tag }}"
name: "{{ item.name }}"
network_mode: host
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
env:
CORE_LOGGING_LEVEL: "{{ item.config.logging.level }}"
CORE_PEER_ID: "{{ item.name }}"
CORE_PEER_LISTENADDRESS: "{{ address }}:{{ item.config.peer.listenPort }}"
CORE_PEER_CHAINCODELISTENADDRESS: "{{ address }}:{{ item.config.peer.chaincodeListenPort }}"
CORE_PEER_ADDRESS: "{{ address }}:{{ item.config.peer.listenPort }}"
CORE_PEER_GOSSIP_USELEADERELECTION: false
CORE_PEER_GOSSIP_ORGLEADER: "{{ item.config.peer.gossip.orgLeader }}"
CORE_PEER_GOSSIP_ENDPOINT: "{{ address }}:{{ item.config.peer.listenPort }}"
CORE_PEER_TLS_CERT_FILE: /etc/hyperledger/fabric/tls/server.crt
CORE_PEER_TLS_KEY_FILE: /etc/hyperledger/fabric/tls/server.key
CORE_PEER_TLS_ROOTCERT_FILE: /etc/hyperledger/fabric/tls/ca.crt
CORE_PEER_FILESYSTEMPATH: /var/hyperledger/production
CORE_PEER_MSPCONFIGPATH: msp
volumes:
- /var/run/:/host/var/run/
- "~/fabric/volumes/{{ item.name }}/var/hyperledger/production:/var/hyperledger/production"
- "~/fabric/crypto/peerOrganizations/{{ item.org }}/peers/{{ item.name }}/msp
:/etc/hyperledger/fabric/msp"
Fabric Network / Provisioning / Run Peers
III. Fabric Network
Provisioning
 hyperledger/fabric/fabric/sampleconfig/core.yaml
45
Fabric Network / Power Tools
III. Fabric Network
Provisioning
Tool Software Remarks
Software Provisioning
Automation Ansible
• Using SSH connection: No agent
• Systematic but flexible inventory management
• Provides YAML based DSL
• Provides templating
• Parallel task processing
System Monitoring
Software Prometheus
• Time-series database
• Able to define complex (multi-dimensional) data
• Provides query language
Dashboard Software Grafana
• Built-in supports various data source - Graphite, Prometheus,
Elasticsearch, InfluxDB, MySQL, PostgreSQL
• Provides highly customizable graph, chart, and dashboard
• Provides alerting
Log Integration ELK Stack
46
Fabric Network / System Monitoring
III. Fabric Network
Provisioning
IV. Architectural Issues of
Hyperledger Fabric
48
Fabric / Performance
IV. Architectural Issues of
Hyperledger Fabric
 Optimize Disk and Network
over CPU and Memory
 Fabric Network Scale : # of Peers
 Minimize Virtualization
 Bare-metal based Cloud
over Virtual Machine based
Cloud
 Docker free
49
Fabric / Performance
host1
container1
eth0
172.17.0.19
veth6df8377
eth0
192.168.75.12
container2
eth0
127.17.0.20
veth7b0e4c6
iptable/NAT
docker0
172.17.0.1
host2
container3
eth0
172.17.0.19
veth002aa7a
eth0
192.168.75.14
iptable/NAT
docker0
172.17.0.1
MySQL WordPress Redmine
 https://docs.docker.com/engine/tutorials/networkingcontainers/
https://developer.ibm.com/recipes/tutorials/networking-your-docker-containers-using-docker0-bridge/
How to use "loopback interface" with Docker containers in a same host ?
IV. Architectural Issues of
Hyperledger Fabric
50
Fabric / Transaction Concurrency /Simulation and Validation
Endorsing
Peer
Ledger
Propose tx
Client
[(p1,u1),...,(pn,un)]
[(q1,v1),...,(qn,vn)]
tx.simulate()
Peer Ledger
Validate tx
Check read-set for p1...pn
[(p1,u1),...,(pn,un)]
tx.validate()
Prepare read-set for p1...pn
Prepare write-set for q1...qn
If ui = ui for all, tx is Valid
Else tx is Invalid
IV. Architectural Issues of
Hyperledger Fabric
51
Fabric / Transaction Concurrency / Case 1
Endorsing
Peer
Ledger
Propose tx1:f(k1,a) ver(k1)
val(k1)
c1:Client
u1,v1
[[(k1,u1)],[(k1,v1+a)]]
c2:Client
Endorsing
Peer
Ledger
ver(k1)
val(k1)
u1,v1
Propose tx2:f(k1,b)
[[(k1,u1)],[(k1,v1+b)]]
Peer Ledger
ver(k1)
(k1,u1)
Submit tx1
Validate tx1
(k1,v1+a)Commit tx1
ver(k1)
(k1,u1)
Abandon tx2
f(k,x): val(k)  val(k) + x
Validate tx2
Submit tx2
① tx1.simulate()
② tx2.simulate()
③ tx1.validate()
④ tx1.commit()
⑤ tx2.validate()
⑥ tx2.failed()
IV. Architectural Issues of
Hyperledger Fabric
52
Fabric / Transaction Concurrency / Case 2
Endorsing
Peer
Ledger
Propose tx1:f(k1,a) ver(k1)
val(k1)
c1:Client
u1,v1
[[(k1,u1)],[(k1,v1+a)]]
c2:Client
Endorsing
Peer
Ledger
ver(k1)
val(k1)
u1,v1
Propose tx2:f(k1,b)
[[(k1,u1)],[(k1,v1+b)]]
Peer Ledger
ver(k1)
(k1,u1)
Submit tx2
Validate tx2
(k1,v1+b)Commit tx2
ver(k1)
(k1,u1)
Abandon tx1
f(k,x): val(k)  val(k) + x
Validate tx1
Submit tx1
① tx1.simulate()
② tx2.simulate()
③ tx2.validate()
④ tx2.commit()
⑤ tx1.validate()
⑥ tx1.failed()
IV. Architectural Issues of
Hyperledger Fabric
53
Fabric / Transaction Concurrency / Review 1
tx1.simulate()
tx2.simulate()
tx1.validate()
tx1.commit()
tx2.validate()
tx2.failed()
Case 1
tx1.simulate()
tx2.simulate()
tx2.validate()
tx2.commit()
tx1.validate()
tx1.failed()
Case 2
tx1.simulate()
tx2.simulate()
tx1.validate()
tx2.validate()
tx1.commit()
tx2.commit()
Case 3
 Case 1 for All Peers or Case 2 for All Peers
 Never Case 1 for Some and Case 2 for the Others
 Never Case 3
 Only 1 transaction among concurrent can succeed.
(with some conditions)
 tx.validate() and tx.commit() are atomic.
Why ?
IV. Architectural Issues of
Hyperledger Fabric
54
Fabric / Transaction Concurrency / Summary
 No Dirty Read
No Non-repeatable Read
 Multi-version Concurrency Control
Optimistic Locking
 Transaction Isolation Level : ?
set(k1,v2)
get(k1): v1
get(k1): v2
Read Uncommitted
tx1.begin()
tx2.begin()
tx2.comiit()
tx1.commit()
get(k1): v1
get(k1): v1
set(k1,v2)
get(k1): v2
Read Committed
get(k1): v1
tx1.begin()
tx1.commit()
tx2.begin()
tx2.comiit()
IV. Architectural Issues of
Hyperledger Fabric
55
Fabric / Transaction Concurrency / Write-set only case
Peer
Endorsing
Peer
Ledger
Propose tx1:g(k1,a) val(k1)
c1:Client
v1
[[],[(k1, a)]]
c2:Client
Endorsing
Peer
Ledger
val(k1)
v1
Propose tx2:g(k1,b)
[[],[(k1, b)]]
Ledger
Submit tx1
Validate tx1
(k1,a)
Commit tx1
Commit tx2
g(k,x): val(k)  x
Validate tx2
Submit tx2
(k1,b)
IV. Architectural Issues of
Hyperledger Fabric
56
FAQ : How many peer organizations?
Distributed Ledger :
replicated, shared,
and synchronized digital data
geographically spread across multiple sites ...
What is node ?
Peer
Peer ?
Peer Organization ?
Public blockchain
Private blockchain
Independent Location/Access Control/Ownership
from Wikipedia
IV. Architectural Issues of
Hyperledger Fabric
57
FAQ : How many peer organizations?
Order Org
Peer Org
(Broken)
Peer Org
(Secure)
IV. Architectural Issues of
Hyperledger Fabric
58
FAQ : How many peers?
Distributes Requests
Splits Huge Data
 Application Server
Clustering
 Hadoop
 No SQL Sharding
Availability 
Performance 
Scale Out
Replicated and
Synchronized Data
 Private Blockchain
Availability 
Performance 
Scale Out
Scale Out
Scale Up
For Availability
For Performance
IV. Architectural Issues of
Hyperledger Fabric
59
FAQ : Where is SPoF (Single Point Of Failure)?
 Peer
- multiple cluster
- multiple organization
 Orderer
- single cluster
- single organization
 Peer
- Disaster recoverable by nature
 Orderer Cluster
- Single Point of Failure
- More robust access control and
security
- Standby cluster
Standby
IV. Architectural Issues of
Hyperledger Fabric
60
A. Fabric Block Structure Appendix
https://blockchain-fabric.blogspot.kr/2017/04/hyperledger-fabric-v10-block-structure.html
61
B. Resources Appendix
Title URL Remarks
Hyperledger Homepage https://www.hyperledger.org/
Fabric Sources https://github.com/hyperledger/fabric
Fabric Documentation http://hyperledger-fabric.readthedocs.io/
• Getting started
• Tutorials
• References
Fabric CA Documentation http://hyperledger-fabric-ca.readthedocs.io/
Fabric Wiki https://wiki.hyperledger.org/projects/fabric
Fabric JIRA https://jira.hyperledger.org/projects/FAB/ • Issue management
Hyperledger Docker Repository https://hub.docker.com/u/hyperledger/
Fabric 1.1 Commands
Reference
http://hyperledger-fabric.readthedocs.io/en/release-
1.1/command_ref.html
Fabric Chaincode API (Go)
https://godoc.org/github.com/hyperledger/fabric/core/
chaincode/shim
Fabric SDK for Node.js
Documentation
https://fabric-sdk-node.github.io/
• API documentation
• Tutorials

Más contenido relacionado

La actualidad más candente

Smart contractjp smartcontract_about
Smart contractjp smartcontract_aboutSmart contractjp smartcontract_about
Smart contractjp smartcontract_aboutTomoaki Sato
 
Hyperledger fabric architecture
Hyperledger fabric architectureHyperledger fabric architecture
Hyperledger fabric architectureCeline George
 
What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...
What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...
What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...Simplilearn
 
Blockchain Presentation
Blockchain PresentationBlockchain Presentation
Blockchain PresentationZied GUESMI
 
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...Edureka!
 
Blockchain
BlockchainBlockchain
BlockchainSai Nath
 
Introduction to Blockchain
Introduction to BlockchainIntroduction to Blockchain
Introduction to BlockchainMalak Abu Hammad
 
Introduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsIntroduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsTechracers
 
An Introduction to Blockchain Technology
An Introduction to Blockchain Technology An Introduction to Blockchain Technology
An Introduction to Blockchain Technology Niuversity
 
Introduction to Corda Blockchain for Developers
Introduction to Corda Blockchain for DevelopersIntroduction to Corda Blockchain for Developers
Introduction to Corda Blockchain for DevelopersR3
 
Hyperledger Fabric and Tools
Hyperledger Fabric and ToolsHyperledger Fabric and Tools
Hyperledger Fabric and ToolsRihusoft
 
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...Edureka!
 
Blockchain Fundamentals - Top Rated for Beginners
Blockchain Fundamentals - Top Rated for Beginners Blockchain Fundamentals - Top Rated for Beginners
Blockchain Fundamentals - Top Rated for Beginners 101 Blockchains
 
Write smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumWrite smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumMurughan Palaniachari
 
Hyperledger fabric 20180528
Hyperledger fabric 20180528Hyperledger fabric 20180528
Hyperledger fabric 20180528Arnaud Le Hors
 
Blockchain Consensus Protocols
Blockchain Consensus ProtocolsBlockchain Consensus Protocols
Blockchain Consensus ProtocolsMelanie Swan
 

La actualidad más candente (20)

Smart contractjp smartcontract_about
Smart contractjp smartcontract_aboutSmart contractjp smartcontract_about
Smart contractjp smartcontract_about
 
Hyperledger fabric architecture
Hyperledger fabric architectureHyperledger fabric architecture
Hyperledger fabric architecture
 
What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...
What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...
What is A Smart Contract? | Smart Contracts Tutorial | Smart Contracts in Blo...
 
Blockchain concepts
Blockchain conceptsBlockchain concepts
Blockchain concepts
 
Blockchain Presentation
Blockchain PresentationBlockchain Presentation
Blockchain Presentation
 
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
Smart Contracts Programming Tutorial | Solidity Programming Language | Solidi...
 
Blockchain
BlockchainBlockchain
Blockchain
 
Introduction to Blockchain
Introduction to BlockchainIntroduction to Blockchain
Introduction to Blockchain
 
Introduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsIntroduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart Contracts
 
An Introduction to Blockchain Technology
An Introduction to Blockchain Technology An Introduction to Blockchain Technology
An Introduction to Blockchain Technology
 
Introduction to Corda Blockchain for Developers
Introduction to Corda Blockchain for DevelopersIntroduction to Corda Blockchain for Developers
Introduction to Corda Blockchain for Developers
 
Blockchain
BlockchainBlockchain
Blockchain
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
 
Hyperledger Fabric and Tools
Hyperledger Fabric and ToolsHyperledger Fabric and Tools
Hyperledger Fabric and Tools
 
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
 
Blockchain Fundamentals - Top Rated for Beginners
Blockchain Fundamentals - Top Rated for Beginners Blockchain Fundamentals - Top Rated for Beginners
Blockchain Fundamentals - Top Rated for Beginners
 
Blockchain 2.0
Blockchain 2.0Blockchain 2.0
Blockchain 2.0
 
Write smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumWrite smart contract with solidity on Ethereum
Write smart contract with solidity on Ethereum
 
Hyperledger fabric 20180528
Hyperledger fabric 20180528Hyperledger fabric 20180528
Hyperledger fabric 20180528
 
Blockchain Consensus Protocols
Blockchain Consensus ProtocolsBlockchain Consensus Protocols
Blockchain Consensus Protocols
 

Similar a Hyperledger Fabric Architecture

Securing Millions of Devices
Securing Millions of DevicesSecuring Millions of Devices
Securing Millions of DevicesKai Hudalla
 
Wwc developing hyperledger applications v4
Wwc  developing hyperledger applications v4Wwc  developing hyperledger applications v4
Wwc developing hyperledger applications v4LennartF
 
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_finalOPITZ CONSULTING Deutschland
 
Veer's Container Security
Veer's Container SecurityVeer's Container Security
Veer's Container SecurityJim Barlow
 
Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractThanh Nguyen
 
Lattice Network Yellow Paper.pdf
Lattice Network Yellow Paper.pdfLattice Network Yellow Paper.pdf
Lattice Network Yellow Paper.pdfBijanBurnard
 
Oracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo YooOracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo YooOracle Korea
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Marcin Bielak
 
hyperledger-chaincode & hyperl fabric.pptx
hyperledger-chaincode & hyperl fabric.pptxhyperledger-chaincode & hyperl fabric.pptx
hyperledger-chaincode & hyperl fabric.pptxdeepaksingh160910
 
网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...
网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...
网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...Xiaohui Chen
 
Automating cloud security - Jonny Griffin
Automating cloud security - Jonny GriffinAutomating cloud security - Jonny Griffin
Automating cloud security - Jonny GriffinJonnathan Griffin
 
Bezant platform_20181212
Bezant platform_20181212Bezant platform_20181212
Bezant platform_20181212Kevin Park
 
Using Tetration for application security and policy enforcement in multi-vend...
Using Tetration for application security and policy enforcement in multi-vend...Using Tetration for application security and policy enforcement in multi-vend...
Using Tetration for application security and policy enforcement in multi-vend...Joel W. King
 
Kerberos, Token and Hadoop
Kerberos, Token and HadoopKerberos, Token and Hadoop
Kerberos, Token and HadoopKai Zheng
 
Blockchin architecture azure meetup
Blockchin architecture azure meetupBlockchin architecture azure meetup
Blockchin architecture azure meetupMohammad Asif
 

Similar a Hyperledger Fabric Architecture (20)

Securing Millions of Devices
Securing Millions of DevicesSecuring Millions of Devices
Securing Millions of Devices
 
Wwc developing hyperledger applications v4
Wwc  developing hyperledger applications v4Wwc  developing hyperledger applications v4
Wwc developing hyperledger applications v4
 
Hadoop and Big Data Security
Hadoop and Big Data SecurityHadoop and Big Data Security
Hadoop and Big Data Security
 
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
 
Veer's Container Security
Veer's Container SecurityVeer's Container Security
Veer's Container Security
 
Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart Contract
 
Lattice Network Yellow Paper.pdf
Lattice Network Yellow Paper.pdfLattice Network Yellow Paper.pdf
Lattice Network Yellow Paper.pdf
 
Oracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo YooOracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo Yoo
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
 
01 BlockChain
01 BlockChain01 BlockChain
01 BlockChain
 
hyperledger-chaincode & hyperl fabric.pptx
hyperledger-chaincode & hyperl fabric.pptxhyperledger-chaincode & hyperl fabric.pptx
hyperledger-chaincode & hyperl fabric.pptx
 
Simplify Networking for Containers
Simplify Networking for ContainersSimplify Networking for Containers
Simplify Networking for Containers
 
网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...
网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...
网易云K8S应用实践 | practices for kubernetes cluster provisioning, management and ap...
 
Hyperledger
HyperledgerHyperledger
Hyperledger
 
Automating cloud security - Jonny Griffin
Automating cloud security - Jonny GriffinAutomating cloud security - Jonny Griffin
Automating cloud security - Jonny Griffin
 
Bezant platform_20181212
Bezant platform_20181212Bezant platform_20181212
Bezant platform_20181212
 
Block chain technology
Block chain technologyBlock chain technology
Block chain technology
 
Using Tetration for application security and policy enforcement in multi-vend...
Using Tetration for application security and policy enforcement in multi-vend...Using Tetration for application security and policy enforcement in multi-vend...
Using Tetration for application security and policy enforcement in multi-vend...
 
Kerberos, Token and Hadoop
Kerberos, Token and HadoopKerberos, Token and Hadoop
Kerberos, Token and Hadoop
 
Blockchin architecture azure meetup
Blockchin architecture azure meetupBlockchin architecture azure meetup
Blockchin architecture azure meetup
 

Último

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Último (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

Hyperledger Fabric Architecture

  • 2. 2 ToC I. Background of Enterprise Blockchain II. Basic Architecture of Hyperledger Fabric III. Fabric Network Provisioning IV. Architectural Issues of Hyperledger Fabric
  • 3. I. Background of Enterprise Blockchain
  • 4. 4 Information Security I. Background of Enterprise Blockchain Confidentiality Integrity Availability Disclosed to unauthorized Authentication, Encryption Available when needed Clustering, Fail-over Prevent unauthorized Modification Authorization
  • 5. 5 Public Blockchain / Chain of Block Genesis Block Block    Header DataHashPrevHash Data Tx Data Tx Data Tx Data Tx Data   Header DataHashPrevHash Data Tx Data Tx Data Tx Data Tx Data   blockn.prevHash = hash(blockn-1.header) blockn.dataHash = hash(blockn.data)  Provable Integrity  Resistant to Modification I. Background of Enterprise Blockchain
  • 6. 6 Public Blockchain / Distributed Ledger Peer Peer Peer Peer Peer Peer PeerPeer  Replicated  Synchronized  Decentralized  Open  Extreme Availability  Poor Confidentiality I. Background of Enterprise Blockchain
  • 7. 7 Public Blockchain / Decentralized Consensus  Decentralized Consensus  PoW, PoS, DPoS, ...  Serialized Change  Extreme Integrity  Terrible Performance https://learn.onemonth.com/proof-of-work-vs-proof-of-stake/ https://depositphotos.com/search/bitcoin-mining.html?qview=34106323 I. Background of Enterprise Blockchain
  • 8. 8 Public Blockchain / Fork Peer Peer Peer Peer Peer Peer Peer Peer Peer Proof-of-Work  Mining : Can Make Conflict and Need Merge I. Background of Enterprise Blockchain
  • 9. 9 Public Blockchain / Summary  Extreme Integrity  Extreme Availability  Poor Confidentiality  Terrible Performance  Chain of Block  Distributed Ledger  Decentralized Consensus I. Background of Enterprise Blockchain
  • 10. 10 Enterprise Blockchain / Requirements  Extreme Integrity  Extreme Availability  Poor Confidentiality  Terrible Performance  High Integrity  High Availability  High Confidentiality  Good Performance Public Blockchain Enterprise Blockchain Chain of Block Distributed Ledger Decentralized Consensus How ? I. Background of Enterprise Blockchain
  • 11. 11 Enterprise Blockchain / Core Strategy  High Integrity  High Availability  High Confidentiality  Good Performance  Limited Peers  Access Control  Distributed Ledger  Chain of Block  PoX Alternative I. Background of Enterprise Blockchain
  • 12. II. Basic Architecture of Hyperledger Fabric
  • 13. 13 Hyperledger Fabric / Intro II. Basic Architecture of Hyperledger Fabric  Permissioned Blockchain  Open-source (Apache-2.0)  led by IBM and Linux Foundation  1.1.0 : Mar 2018 1.0.0 : Jul 2017 1.0.0-alpha : Mar 2017 0.6.0-preview : Sep 2016  implemented in Go  Identity management  Membership service  Privacy and confidentiality  Chaincode as smart contract  Endorsement policy  CouchDB as state database
  • 14. 14 Fabric / Full Stack Fabric Network <<smart contract>> Chaincode Fabric Client SDK (Decentralized) Application DBMS Cluster SQL, PL/SQL JDBC,ODBC,OCI Application  Visualize data  Calculate and analyze data  Generate data  General library and connector  Low-level API  Define data structure  Manipulate data (CRUD)  Persist data  Share data  Basic I/O Hyperledger Fabric Traditional Appl. II. Basic Architecture of Hyperledger Fabric
  • 15. 15 Fabric / Projects Project Description Commits Releases fabric Platform, Network, Runtime 5,843 18 fabric-samples Sample codes fabric-sdk-node Client SDK in Node.js 758 14 fabric-sdk-java Client SDK in Java 295 6 fabric-sdk-go Client SDK in Go 779 3 fabric-sdk-py Client SDK in Python 221 1 fabric-sdk-rest Client SDK in REST 110 0 fabric-chaincode-node Chaincode in Node.js 60 3 fabric-chaincode-java Chaincode in Java 24 0 composer Application development framework 4,749 75 Fabric Network <<smart contract>> Chaincode Fabric Client SDK (Decentralized) Application II. Basic Architecture of Hyperledger Fabric
  • 16. 16 Fabric Network / Software Architecture Peer Organization Peer Organization Orderer Orderer Kafka Kafka Kafka Kafka Orderer CA Server Anchor Peer Ledger Ledger Peer Leader Peer Ledger Ledger PeerCA Server Anchor Peer Ledger Leader Peer Ledger Ledger Peer CA Server Anchor Peer Ledger LedgerPeer Leader Peer Ledger LedgerPeer CA Server Client Client Client Peer Organization Orderer Organization Peer Ledger Client Orderer Kafka CA Server II. Basic Architecture of Hyperledger Fabric
  • 17. 17 Fabric Network / Key Concepts  Peer and Leger  Orderer Cluster  Consensus  Membership Service  Channel II. Basic Architecture of Hyperledger Fabric
  • 18. 18 Fabric Network / Peer State DB Chain Data Data Files Index Files State DB Peer Node State DB Chain Data Data Files Index Files gRPC/TLS Chaincode Peer Peer Chaincode Chain Data Data Files Index Files Peer Chaincode II. Basic Architecture of Hyperledger Fabric
  • 19. 19 Fabric Network / Ledger State DBPeer Chain Data Data Files Index Files current/latest state data (k, vn) (k', v'm) (k", v"s) all data (k, v1), (k, v2), (k, v3), .... (k, vn) (k', v'1), (k', v'2), (k', v'3), .... (k', v'm) (k", v"1), (k", v"2), (k", v"3), .... (k", v"s) ("BTC", {price: 10,000,000, at: 3/27}) ("ETH", {price: 800,000, at: 3/27}) ("BTC", {price: 10,000,000, at: 3/27}) ("BTC", {price: 9,500,000, at: 3/26}) ("BTC", {price: 9,000,000, at: 3/25}) ("BTC", {price: 8,000,000, at: 3/24}) ... Chaincode II. Basic Architecture of Hyperledger Fabric
  • 20. 20 Fabric Network / Data Access  Put(k,vn) State DB Chain Data Data Files Index Files  (k,vn-1)  (k,vn)  Contains (k,v1) ... (k,vn-1)  Get(k) State DBPeer Chain Data Data Files Index Files  Select(k): vn Write Transaction Read Transaction II. Basic Architecture of Hyperledger Fabric Peer Chaincode  Add(k,vn) Chaincode  Contains (k,v1) ... (k,vn)
  • 21. 21 Fabric Network / Orderer Cluster Kafka Kafka Kafka Kafka ZooKeeper ZooKeeper ZooKeeper ZooKeeper Ensemble Orderer Orderer Orderer Orderer Kafka Cluster Produce Msg Produce Msg Produce Msg Produce Msg Consume Msg Distributed messaging queue Queuing transactions  Distributed Cluster Coordinator  Manage configs and states of Kafka brokers Build Block II. Basic Architecture of Hyperledger Fabric
  • 22. 22 Fabric Network / Membership Service Peer ca-cert tls-ca-cert key cert tls-key tls-cert Client ca-cert tls-ca-cert key cert tls-key tls-cert Orderer ca-cert tls-ca-cert key cert tls-key tls-cert Signed Data/gRPC/TLS  Hyperledger Fabric V1.0: Block Structure II. Basic Architecture of Hyperledger Fabric
  • 23. 23 Fabric Network / Membership Service Peer1-1 ca1-cert key1-1 cert1-1 ca0-cert ca2-cert CA1 Server Peer1-2 ca1-cert key1-2 cert1-2 ca0-cert ca2-cert Orderer0-1 ca0-cert key0-1 cert0-1 ca1-cert ca2-cert CA0 Server Orderer0-2 Orderer0-3 Peer2-1 ca2-cert key2-1 cert2-1 ca0-cert ca1-cert CA2 Server Peer2-2 Peer2-3 Clienta ca1-cert keya certa org1 org0 org2 II. Basic Architecture of Hyperledger Fabric
  • 24. 24 org3 org0 Fabric Network / Channel org2 org1 Orderer Orderer Orderer Kafka Cluster Peerledger1 ledger1 Leader Peer ledger1 ledger1 Peer ledger1 Leader Peer ledger1 ledger1 Peer ledger2 ledger2ledger2 ledger Leader Peer ledger2 ledger2 ledger2 Peer Peer Peer Peer Peer Project Orderers Peers Ledger channel1 org0 org1, org2 ledger1 channel1 org0 org2, org3 ledger2 channel1 channel2 II. Basic Architecture of Hyperledger Fabric
  • 25. 25 Fabric Network / Channel (2) Fabric Network Chaincode Hyperledger Fabric Channel n 1 n 1 DBMS Table Schema n 1 n 1 RDBMS Channel Chaincode Supply Management  Part  Supplier  Warehouse  Procurement Order Management  Customer  Product  Order  Delivery II. Basic Architecture of Hyperledger Fabric
  • 26. 26  Orderer Cluster  Pull Block Fabric / Consensus / Interaction Peer PeerClient Peer Peer Peer Leader Peer  Propose Tx  Propose Tx  Simulate Tx Inspect Proposal Resp.  Submit Tx  Build Block Block = L(Tx1…Txn) Leader Peer   Simulate Tx  Deliver Block      Validate Txs Update Ledger      Emit Event II. Basic Architecture of Hyperledger Fabric
  • 27. 27 Fabric / Consensus / Sequence Client Endorsing Peer Endorsing Peer Propose Transaction Simulate Transaction Propose Transaction Simulate Transaction Orderer Submit Transaction Kafka Produce Message Orderer Consume Messages Build Block Leader Peer Pull Block Validate Transactions Update Ledger (Commit) Peer Deliver Block Leader Peer Deliver Block Wait Event Emit Event Peer Pull Block 1) Propose Tx 2) Verify Tx 3) Simulate Tx 4) Submit Tx 5) Enqueue Tx 6) Dequeue Tx 7) Build Block 8) Deliver Block 9) Validate Tx 10) Commit Tx 11) Emit Ev II. Basic Architecture of Hyperledger Fabric
  • 28. 28 Fabric Network / Software Architecture / Revisited  Network = Channel1...n  Channel = Peer Org.1...n + Orderer Cluster + Ledger + Chaincode1...m  Peer Org. = Leader Peer + Anchor Peer + Peer0...n + CA Server II. Basic Architecture of Hyperledger Fabric
  • 29. 29 Fabric / Features Revisited  PKI based Membership Service  Ordering Service  Forkless  Limited Peers  Access Control  Proof-of-Work Alternative  High Confidentiality  Good Performance II. Basic Architecture of Hyperledger Fabric
  • 30. III. Fabric Network Provisioning
  • 31. 31 Fabric Network / Production Example III. Fabric Network Provisioning ZooKeeper Kafka Orderer ZooKeeper Kafka Orderer ZooKeeper Orderer Kafka CA Server Kafka [anchor] Peer CouchDB [leader] Peer CouchDB Peer CouchDB Peer CouchDB CA Server org1 [anchor] Peer CouchDB [leader] Peer CouchDB Peer CouchDB Peer CouchDB CA Server org2 [anchor] Peer CouchDB [leader] Peer CouchDB Peer CouchDB Peer CouchDB CA Server org3 Peer CouchDB [leader] Peer CouchDB Peer CouchDB [anchor] Peer CouchDB CA Server org4 [leader] Peer CouchDB [anchor] Peer CouchDB Peer CouchDB Peer CouchDB CA Server org5 org0 Grafana Prometheus Monitoring System Client Client Category #of Instance Host 25 ZooKeeper 3 Kafka 4 Orderer 3 Peer 20 CouchDB 20 CA Server 6 Prometheus 1 Grafana 1  25 Machines  58 Services of 8 Types
  • 32. 32 Fabric Network / PoC Example III. Fabric Network Provisioning machine3 [leader] Peer CouchDB machine1 Orderer ZooKeeper Kafka machine2 Orderer ZooKeeper Kafka Peer CouchDB CA Server Client Category #of Instance Host 4 ZooKeeper 2 Kafka 2 Orderer 2 Peer 4 CouchDB 4 CA Server 2  4 Machines  16 Services of 6 Types machine4 [leader] Peer CouchDB Peer CouchDB CA Server
  • 33. 33 12) Install CA server, Peer, CouchDB images 13) Run CA server containers 14) Run CouchDB containers 15) Run Peer containers Fabric Network / Provisioning Environment III. Fabric Network Provisioning Control Machine Orderer Machine Client Machine Peer Machine 1) Install Fabric/Fabric CA tools 2) Generate crypto artifacts(keys, certs) 3) Generate genesis block 4) Generate config transactions • Building Your First Network • hyperledger/fabric-samples/first-network/ • hyperledger/fabric/examples/e2e_cli/ Monitoring Server 5) Deploy crypto artifacts 6) Deploy crypto artifacts 7) Deploy genesis block 8) Install ZooKeeper, Kafka, Orderer images 9) Run ZooKeeper containers 10) Run Kafka containers 11) Run Orderer containers 16) Create channels 17) Make Peers join channels 18) Register and enroll user accounts 22) Deploy chaincodes 23) Deploy client appls. 24) Run client appls. 19) Install Prometheus, Grafana images 20) Run Prometheus 21) Run Grafana
  • 34. 34 Fabric Network / Provisioning Process III. Fabric Network Provisioning 1. Install Docker, Node.js and so on. 2. Install Fabric and Fabric CA tools. 3. Write down cryptogen input file. 4. Generate crypto artifacts using cryptogen tool. 5. Write down configtxgen input file. 6. Generate genesis block. 7. Generate channel config transactions. 8. Generate anchor update transactions. 9. Deploy crypto artifacts and genesis block. 1. Install Docker images (Fabric CA server, ZooKeeper, Kafka, Orderer, CouchDB, Peer, ...) 2. Run Fabric CA server containers 3. Run ZooKeeper containers 4. Run Kafka containers 5. Run Fabric Orderer containers 6. Run CouchDB containers 7. Run Fabric Peer containers 8. Create Fabric channels 9. Make Fabric Peers join the channels 10.Register and enroll user accounts 11.Deploy test chaincode and client appls. 12.Run test client appls.
  • 35. 35 Fabric Network / Provisioning / Prerequisites III. Fabric Network Provisioning Software Version Remarks Ubuntu 16.04 • For all machines Docker 17.06.2-ce • For all Peer and Orderer machines • Get Docker CE for Ubuntu Docker Composer 1.14.0 • For all Peer and Orderer machines • docker/compose/1.14.0 Node.js 8.10.0 • For all client application machine • Installing Node.js 8.10 on Debian and Ubuntu based Linux distributions npm 5.6.0 • For all client application machine Python 2.7 • For all client application machine Go 1.9.4 • For all Peers • Fabric 1.1 : compiled with Go 1.9.2 • Installing Golang on Ubuntu Recommended Runtime Environment for Fabric 1.1
  • 36. 36 Fabric Network / Provisioning / FabricFabric CA Tools III. Fabric Network Provisioning Tool Description cryptogen • Generate keys and certificates for Fabric network. configtxgen • Create and inspect configuration related artifacts. - genesis block, channel creation tx, ... peer • Operate a channel (peer channel create|fetch|join|list|update|signconfigtx|getinfo) • Operate a chaincode (peer chaincode install|instantiate|invoke|...|upgrade|list) • Log levels (peer logging getlevel|setlevel|revertlevels) • Operate a peer node (peer node start|status) fabric-ca-client • Register, enroll, reenroll or revoke Fabric CA identities  Fabric/Fabric CA command-line tools for provisioning Fabric network  Download Platform-specific Binaries  curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0  https://goo.gl/6wtTN5
  • 37. 37 Fabric Network / Provisioning / Docker Containers III. Fabric Network Provisioning  Hyperledger Docker Repository - https://hub.docker.com/u/hyperledger/  Hyperledger Fabric 1.1 Dockerfile - https://github.com/hyperledger/fabric/tree/release-1.1/images fabric-baseos fabric-peer fabric-orderer fabric-ccenv fabric-ca fabric-baseimage fabric-kafka fabric-zookeeper fabric-couchdb
  • 38. 38 Fabric Network / Provisioning / Prepare Artifacts III. Fabric Network Provisioning Usage Generate keys and certificates(crypto artifacts) for Fabric network. Input crypto-config.yaml Input Samples  hyperledger/fabric-samples/first-network/crypto-config.yaml  hyperledger/fabric/examples/e2e_cli/crypto-config.yaml Output  keys and certificates for Fabric CA server  signing keys and certificates, TLS keys and certificates for Orderers and Peers  signing key and certificate, TLS key and certificate of admin for each Org. Output Samples  hyperledger/fabric/sampleconfig/msp/  cryptogen  configtxgen Usage Create and inspect configuration related artifacts Input configtx.yaml Input Samples  hyperledger/fabric/sampleconfig/configtx.yaml  hyperledger/fabric-samples/first-network/configtx.yaml  hyperledger/fabric/e2e_cli/configtx.yaml Output  genesis block  channel creation transaction for each channel  anchor peer update transactions for each channel Output Samples  hyperledger/fabric-samples/basic-network/config/
  • 39. 39 Fabric Network / Provisioning / Crypto Artifacts III. Fabric Network Provisioning OrdererOrgs: - Name: org0 Domain: org0 CA: HostName : ca0 CommonName: ca0 Specs: - Hostname: orderer1 CommonName: orderer1 - Hostname: orderer2 CommonName: orderer2 PeerOrgs: - Name: org1 Domain: org1 CA: HostName : ca1 CommonName: ca1 Specs: - Hostname: peer1 CommonName: peer1 - Hostname: peer2 CommonName: peer2 - Hostname: peer3 CommonName: peer3 - Hostname: peer4 CommonName: peer4 Users: Count: 1 - Name: org2 Domain: org2 CA: HostName : ca2 CommonName: ca2 Specs: - Hostname: peer5 CommonName: peer5 - Hostname: peer6 CommonName: peer6 - Hostname: peer7 CommonName: peer7 - Hostname: peer8 CommonName: peer8 Users: Count: 1 - Name: org3 Domain: org3 CA: HostName : ca3 CommonName: ca3 Specs: - Hostname: peer9 CommonName: peer9 - Hostname: peer10 CommonName: peer10 - Hostname: peer11 CommonName: peer11 - Hostname: peer12 CommonName: peer12 Users: Count: 1 cryptogen
  • 40. 40 Fabric Network / Provisioning / Config Transactions III. Fabric Network Provisioning Profiles: GenesisProfile: Orderer: <<: *ordererDefaults Organizations: - *org0 Consortiums: Channel1Consortium: Organizations: - *org1 - *org2 - *org3 Channel2Consortium: Organizations: - *org1 - *org2 - *org3 Channel1Profile: Consortium: Channel1Consortium Application: <<: *applicationDefaults Organizations: - *org1 - *org2 - *org3 Channel2Profile: Consortium: Channel2Consortium Application: <<: *applicationDefaults Organizations: - *org1 - *org2 - *org3 Organizations: - &org0 Name: org0 ID: org0 MSPDir: crypto/ordererOrganizations/org0/msp AdminPrincipal: Role.ADMIN - &org1 Name: org1 ID: org1 MSPDir: crypto/peerOrganizations/org1/msp AdminPrincipal: Role.ADMIN AnchorPeers: - Host: *.*.*.173 Port: 7051 ... Orderer: &ordererDefaults OrdererType: kafka Addresses: - *.*.*.188:7050 - *.*.*.166:7050 BatchTimeout: 4s BatchSize: MaxMessageCount: 400 AbsoluteMaxBytes: 5 MB PreferredMaxBytes: 1024 KB Kafka: Brokers: - *.*.*.*:9092 - *.*.*.*:9092 ... configtxgen
  • 41. 41 Fabric Network / Provisioning / Run ZooKeeper III. Fabric Network Provisioning #! /bin/bash docker run -d --name ${zk_name} --network host -e ZOO_MY_ID=${zk_id} -e ZOO_PORT=${zk_port} -e ZOO_SERVERS=${zk_servers} -e ZOO_TICK_TIME ${zk_tick_time} -e ZOO_INIT_LIMIT ${zk_init_limit} -e ZOO_SYNC_LIMIT ${zk_sync_limit} hyperledger/fabric-zookeeper:${host_arch}-${fabric_ver}
  • 42. 42 Fabric Network / Provisioning / Run Kafka III. Fabric Network Provisioning #! /bin/bash docker run -d --name ${name} --network host -e KAFKA_ZOOKEEPER_CONNECT=${zk_connect_str} -e KAFKA_ADVERTISED_HOST_NAME=${name} -e KAFKA_BROKER_ID=${broker_id} -e KAFKA_LISTENERS=PLAINTEXT://${listener_addr}:${listener_port} -e KAFKA_MESSAGE_MAX_BYTES=${message_max_bytes} -e KAFKA_MIN_INSYNC_REPLICAS=${min_insync_replicas} -e KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false -e KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT.MS=${zk_conn_timeout_ms} -e KAFKA_DEFAULT_REPLICATION_FACTOR=${default_replication_factor} -e KAFKA_REPLICA_FETCH_MAX_BYTES=${message_max_bytes} -e KAFKA_METRICS_RECORDING_LEVEL=${metrics_recording_level} -e KAFKA_HEAP_OPTS=${jvm_heap_opts} -e KAFKA_JVM_PERFORMANCE_OPTS=${jvm_perf_opts} -e KAFKA_GC_LOG_OPTS=${jvm_gc_log_opts} -e KAFKA_JMX_OPTS=${jvm_jmx_opts} hyperledger/fabric-kafka:${host_arch}-${fabric_ver}
  • 43. 43 - name: Run Fabric Orderer containers docker_container: image: "{{ docker.images.orderer.repository }}:{{ docker.images.orderer.tag }}" name: "{{ item.name }}" network_mode: host env: ORDERER_GENERAL_LISTENADDRESS: "{{ hostvars[item.host].ansible_host }}" ORDERER_GENERAL_LISTENPORT: "{{ item.port }}" ORDERER_GENERAL_TLS_PRIVATEKEY: /var/hyperledger/orderer/tls/server.key ORDERER_GENERAL_TLS_CERTIFICATE: /var/hyperledger/orderer/tls/server.crt ORDERER_GENERAL_TLS_ROOTCAS: [/var/hyperledger/orderer/tls/ca.crt] ORDERER_GENERAL_LOGLEVEL: "{{ item.config.General.LogLevel }}" ORDERER_GENERAL_GENESISMETHOD: file # provisional | file ORDERER_GENERAL_GENESISFILE: /var/hyperledger/orderer/orderer.genesis.block ORDERER_GENERAL_LOCALMSPDIR: /var/hyperledger/orderer/msp ... volumes: - "~/fabric/configtx/genesis.block:/var/hyperledger/orderer/orderer.genesis.block" - "~/fabric/crypto/ordererOrganizations/{{ item.org }}/orderers/{{ item.name }}/msp :/var/hyperledger/orderer/msp" - "~/fabric/crypto/ordererOrganizations/{{ item.org }}/orderers/{{ item.name }}/tls/ :/var/hyperledger/orderer/tls" - "~/fabric/volumes/{{ item.name }}/var/hyperledger/production/orderer :/var/hyperledger/production/orderer" Fabric Network / Provisioning / Run Orderers III. Fabric Network Provisioning  hyperledger/fabric/fabric/sampleconfig/orderer.yaml
  • 44. 44 - name: Run Fabric Peer Containers docker_container: image: "{{ docker.images.peer.repository }}:{{ docker.images.peer.tag }}" name: "{{ item.name }}" network_mode: host working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer env: CORE_LOGGING_LEVEL: "{{ item.config.logging.level }}" CORE_PEER_ID: "{{ item.name }}" CORE_PEER_LISTENADDRESS: "{{ address }}:{{ item.config.peer.listenPort }}" CORE_PEER_CHAINCODELISTENADDRESS: "{{ address }}:{{ item.config.peer.chaincodeListenPort }}" CORE_PEER_ADDRESS: "{{ address }}:{{ item.config.peer.listenPort }}" CORE_PEER_GOSSIP_USELEADERELECTION: false CORE_PEER_GOSSIP_ORGLEADER: "{{ item.config.peer.gossip.orgLeader }}" CORE_PEER_GOSSIP_ENDPOINT: "{{ address }}:{{ item.config.peer.listenPort }}" CORE_PEER_TLS_CERT_FILE: /etc/hyperledger/fabric/tls/server.crt CORE_PEER_TLS_KEY_FILE: /etc/hyperledger/fabric/tls/server.key CORE_PEER_TLS_ROOTCERT_FILE: /etc/hyperledger/fabric/tls/ca.crt CORE_PEER_FILESYSTEMPATH: /var/hyperledger/production CORE_PEER_MSPCONFIGPATH: msp volumes: - /var/run/:/host/var/run/ - "~/fabric/volumes/{{ item.name }}/var/hyperledger/production:/var/hyperledger/production" - "~/fabric/crypto/peerOrganizations/{{ item.org }}/peers/{{ item.name }}/msp :/etc/hyperledger/fabric/msp" Fabric Network / Provisioning / Run Peers III. Fabric Network Provisioning  hyperledger/fabric/fabric/sampleconfig/core.yaml
  • 45. 45 Fabric Network / Power Tools III. Fabric Network Provisioning Tool Software Remarks Software Provisioning Automation Ansible • Using SSH connection: No agent • Systematic but flexible inventory management • Provides YAML based DSL • Provides templating • Parallel task processing System Monitoring Software Prometheus • Time-series database • Able to define complex (multi-dimensional) data • Provides query language Dashboard Software Grafana • Built-in supports various data source - Graphite, Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL • Provides highly customizable graph, chart, and dashboard • Provides alerting Log Integration ELK Stack
  • 46. 46 Fabric Network / System Monitoring III. Fabric Network Provisioning
  • 47. IV. Architectural Issues of Hyperledger Fabric
  • 48. 48 Fabric / Performance IV. Architectural Issues of Hyperledger Fabric  Optimize Disk and Network over CPU and Memory  Fabric Network Scale : # of Peers  Minimize Virtualization  Bare-metal based Cloud over Virtual Machine based Cloud  Docker free
  • 49. 49 Fabric / Performance host1 container1 eth0 172.17.0.19 veth6df8377 eth0 192.168.75.12 container2 eth0 127.17.0.20 veth7b0e4c6 iptable/NAT docker0 172.17.0.1 host2 container3 eth0 172.17.0.19 veth002aa7a eth0 192.168.75.14 iptable/NAT docker0 172.17.0.1 MySQL WordPress Redmine  https://docs.docker.com/engine/tutorials/networkingcontainers/ https://developer.ibm.com/recipes/tutorials/networking-your-docker-containers-using-docker0-bridge/ How to use "loopback interface" with Docker containers in a same host ? IV. Architectural Issues of Hyperledger Fabric
  • 50. 50 Fabric / Transaction Concurrency /Simulation and Validation Endorsing Peer Ledger Propose tx Client [(p1,u1),...,(pn,un)] [(q1,v1),...,(qn,vn)] tx.simulate() Peer Ledger Validate tx Check read-set for p1...pn [(p1,u1),...,(pn,un)] tx.validate() Prepare read-set for p1...pn Prepare write-set for q1...qn If ui = ui for all, tx is Valid Else tx is Invalid IV. Architectural Issues of Hyperledger Fabric
  • 51. 51 Fabric / Transaction Concurrency / Case 1 Endorsing Peer Ledger Propose tx1:f(k1,a) ver(k1) val(k1) c1:Client u1,v1 [[(k1,u1)],[(k1,v1+a)]] c2:Client Endorsing Peer Ledger ver(k1) val(k1) u1,v1 Propose tx2:f(k1,b) [[(k1,u1)],[(k1,v1+b)]] Peer Ledger ver(k1) (k1,u1) Submit tx1 Validate tx1 (k1,v1+a)Commit tx1 ver(k1) (k1,u1) Abandon tx2 f(k,x): val(k)  val(k) + x Validate tx2 Submit tx2 ① tx1.simulate() ② tx2.simulate() ③ tx1.validate() ④ tx1.commit() ⑤ tx2.validate() ⑥ tx2.failed() IV. Architectural Issues of Hyperledger Fabric
  • 52. 52 Fabric / Transaction Concurrency / Case 2 Endorsing Peer Ledger Propose tx1:f(k1,a) ver(k1) val(k1) c1:Client u1,v1 [[(k1,u1)],[(k1,v1+a)]] c2:Client Endorsing Peer Ledger ver(k1) val(k1) u1,v1 Propose tx2:f(k1,b) [[(k1,u1)],[(k1,v1+b)]] Peer Ledger ver(k1) (k1,u1) Submit tx2 Validate tx2 (k1,v1+b)Commit tx2 ver(k1) (k1,u1) Abandon tx1 f(k,x): val(k)  val(k) + x Validate tx1 Submit tx1 ① tx1.simulate() ② tx2.simulate() ③ tx2.validate() ④ tx2.commit() ⑤ tx1.validate() ⑥ tx1.failed() IV. Architectural Issues of Hyperledger Fabric
  • 53. 53 Fabric / Transaction Concurrency / Review 1 tx1.simulate() tx2.simulate() tx1.validate() tx1.commit() tx2.validate() tx2.failed() Case 1 tx1.simulate() tx2.simulate() tx2.validate() tx2.commit() tx1.validate() tx1.failed() Case 2 tx1.simulate() tx2.simulate() tx1.validate() tx2.validate() tx1.commit() tx2.commit() Case 3  Case 1 for All Peers or Case 2 for All Peers  Never Case 1 for Some and Case 2 for the Others  Never Case 3  Only 1 transaction among concurrent can succeed. (with some conditions)  tx.validate() and tx.commit() are atomic. Why ? IV. Architectural Issues of Hyperledger Fabric
  • 54. 54 Fabric / Transaction Concurrency / Summary  No Dirty Read No Non-repeatable Read  Multi-version Concurrency Control Optimistic Locking  Transaction Isolation Level : ? set(k1,v2) get(k1): v1 get(k1): v2 Read Uncommitted tx1.begin() tx2.begin() tx2.comiit() tx1.commit() get(k1): v1 get(k1): v1 set(k1,v2) get(k1): v2 Read Committed get(k1): v1 tx1.begin() tx1.commit() tx2.begin() tx2.comiit() IV. Architectural Issues of Hyperledger Fabric
  • 55. 55 Fabric / Transaction Concurrency / Write-set only case Peer Endorsing Peer Ledger Propose tx1:g(k1,a) val(k1) c1:Client v1 [[],[(k1, a)]] c2:Client Endorsing Peer Ledger val(k1) v1 Propose tx2:g(k1,b) [[],[(k1, b)]] Ledger Submit tx1 Validate tx1 (k1,a) Commit tx1 Commit tx2 g(k,x): val(k)  x Validate tx2 Submit tx2 (k1,b) IV. Architectural Issues of Hyperledger Fabric
  • 56. 56 FAQ : How many peer organizations? Distributed Ledger : replicated, shared, and synchronized digital data geographically spread across multiple sites ... What is node ? Peer Peer ? Peer Organization ? Public blockchain Private blockchain Independent Location/Access Control/Ownership from Wikipedia IV. Architectural Issues of Hyperledger Fabric
  • 57. 57 FAQ : How many peer organizations? Order Org Peer Org (Broken) Peer Org (Secure) IV. Architectural Issues of Hyperledger Fabric
  • 58. 58 FAQ : How many peers? Distributes Requests Splits Huge Data  Application Server Clustering  Hadoop  No SQL Sharding Availability  Performance  Scale Out Replicated and Synchronized Data  Private Blockchain Availability  Performance  Scale Out Scale Out Scale Up For Availability For Performance IV. Architectural Issues of Hyperledger Fabric
  • 59. 59 FAQ : Where is SPoF (Single Point Of Failure)?  Peer - multiple cluster - multiple organization  Orderer - single cluster - single organization  Peer - Disaster recoverable by nature  Orderer Cluster - Single Point of Failure - More robust access control and security - Standby cluster Standby IV. Architectural Issues of Hyperledger Fabric
  • 60. 60 A. Fabric Block Structure Appendix https://blockchain-fabric.blogspot.kr/2017/04/hyperledger-fabric-v10-block-structure.html
  • 61. 61 B. Resources Appendix Title URL Remarks Hyperledger Homepage https://www.hyperledger.org/ Fabric Sources https://github.com/hyperledger/fabric Fabric Documentation http://hyperledger-fabric.readthedocs.io/ • Getting started • Tutorials • References Fabric CA Documentation http://hyperledger-fabric-ca.readthedocs.io/ Fabric Wiki https://wiki.hyperledger.org/projects/fabric Fabric JIRA https://jira.hyperledger.org/projects/FAB/ • Issue management Hyperledger Docker Repository https://hub.docker.com/u/hyperledger/ Fabric 1.1 Commands Reference http://hyperledger-fabric.readthedocs.io/en/release- 1.1/command_ref.html Fabric Chaincode API (Go) https://godoc.org/github.com/hyperledger/fabric/core/ chaincode/shim Fabric SDK for Node.js Documentation https://fabric-sdk-node.github.io/ • API documentation • Tutorials