Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

20190423 meetup japan_public

395 vues

Publié le

「Hyperledger & Hyperledger Fabric Updates Apr. 2019」

Hyperledger全体のプロジェクト動向と、Hyperledger Fabricの次期リリースに含まれる予定の新機能について解説する。

講演者 : 下沢 拓 氏
Financial Innovation Lab., R&D Division, Hitachi America, Ltd.

4月23日開催 Hyperledger Tokyo Meetup にて講演

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

20190423 meetup japan_public

  1. 1. © Hitachi America, Ltd. 2019. All rights reserved. Hyperledger & Hyperledger Fabric Updates Apr. 2019 Taku Shimosawa Financial Innovation Lab, R&D Division, Hitachi America, Ltd. Hyperledger Meetup Tokyo Apr. 2019
  2. 2. © Hitachi America, Ltd. 2019. All rights reserved. Hyperledger Community Updates • Hyperledger Iroha 1.0 Approved (Mar 21) • Hyperledger Indy became “active” (Mar 28) • Bootcamp at Hong Kong (Mar 7 & 8) – Focusing on Ursa, Iroha, Cello, Indy and Caliper – More Chinese new contributors • Contributors Summit planned in Japan (Aug 1 & 2) – Venues not settled
  3. 3. © Hitachi America, Ltd. 2019. All rights reserved. New Features in Hyperledger Fabric
  4. 4. © Hitachi America, Ltd. 2019. All rights reserved. Hyperledger Fabric Release Plan • Ver. 1.4.x (LTS) – Ver. 1.4.1 was released on Apr. 11, 2019 – RAFT consensus for the ordering service implemented • (Exceptional) RC1 was released on Mar. 30, 2019 • Ver. 2.0.0 – Alpha was released on Apr. 10, 2019 – 2.0 will be released in June?
  5. 5. © Hitachi America, Ltd. 2019. All rights reserved. New Features in 1.4.1/2.0 • Ver. 1.4.1 – RAFT consensus for the ordering service • Ver. 2.0 – New chaincode lifecycle – Token (UTXO based data model) – Cloud native support of chaincode?? – Container image refactoring (Alpine-based)
  6. 6. © Hitachi America, Ltd. 2019. All rights reserved. RAFT consensus for the ordering service
  7. 7. © Hitachi America, Ltd. 2019. All rights reserved. Consensus in Hyperledger Fabric • Endorsement & Ordering Peers Client Peer Ordering Service 1. Propose 2. Endorse Peer Peer Orderer Orderer Orderer Kafka Kafka Kafka Kafka Zookeeper Zookeeper Zookeeper 3. Submit Consensus on the contents of a transaction Consensus on the order of transactions
  8. 8. © Hitachi America, Ltd. 2019. All rights reserved. RAFT Consensus Algorithm • Motivation – Centralized “ordering” organization in Solo/Kafka – Complex setup of Kafka-based ordering service – Modularization of ordering algorithms (targeting BFT) • Feature – RAFT algorithm based on etcdraft • Crash fault tolerant • Leader-follower model – A leader is elected for each channel – Only orderer process (container) is required • No additional containers required Reference: https://docs.google.com/document/d/138Brlx2BiYJm5bzFk_B0csuEUKYdXXr7Za9V7C76dwo/edit
  9. 9. © Hitachi America, Ltd. 2019. All rights reserved. RAFT Consensus Algorithm (Detail) • Using RAFT – configtx.yaml • Mutual TLS is mandatory for communication among the orderers – Server/client certificates should be specified in configtx (TLS pinning) Orderer: &OrdererDefaults OrdererType: etcdraft Addresses: - orderer0.example.com:7050 - orderer1.example.com:8050 - orderer2.example.com:9050 EtcdRaft: Consenters: - Host: orderer0.example.com Port: 7050 ClientTLSCert: configs/tls/server.crt ServerTLSCert: configs/tls/client.crt ...
  10. 10. © Hitachi America, Ltd. 2019. All rights reserved. New chaincode lifecycle
  11. 11. © Hitachi America, Ltd. 2019. All rights reserved. Chaincode Initialization (Prior to v2.0) Organization 1 Peer Peer Admin 1. Install CC CC 2. Instantiate Ordering Service Policy Organization 2 Peer Peer Admin 1. Install CC CC Organization 3 Peer Peer Admin 1. Install CC CC
  12. 12. © Hitachi America, Ltd. 2019. All rights reserved. New Chaincode Lifecycle • Motivation – Eliminate centralized process (instantiation) – Easier update of the endorsement policy • New lifecycle model – Three steps • Install: Each organization installs a chaincode package to its peer(s) • Approve: Each organization defines an endorsement policy etc. for the chaincode • Commit: Upon a sufficient* number of approvals, one of the organization commits the chaincode definition – A chaincode package is no longer stored in the ledger – No distinction between initialization and update of chaincode * Defined by lifecycle endorsement policy in the channel config
  13. 13. © Hitachi America, Ltd. 2019. All rights reserved. New Chaincode Lifecycle (Detail) • Enabling new lifecycle – configtx.yaml • Enable V2_0 application feature • Chaincode initialization – Peer command – SDK support is under development $ peer lifecycle package $ peer lifecycle chaincode install … $ peer lifecycle chaincode approveformyorg … $ peer lifecycle chaincode commit … Capabilities: Application: &ApplicationCapabilities V2_0: true
  14. 14. © Hitachi America, Ltd. 2019. All rights reserved. Token (FabToken)
  15. 15. © Hitachi America, Ltd. 2019. All rights reserved. FabToken • Motivation – UTXO model in Hyperledger Fabric – Potential use case of non-interactive zero-knowledge proof technology • Token – Lifecycle • Issue: Issue a token • Transfer: Transfer a token to others • Redeem: Remove a token from the network – Transaction model • New command / API for token manipulation • “Proven peers”: trusted peers • Token ID = transaction ID + index – Basic and limited support for now • Fungible tokens only, no smart contract Reference: https://logs.hyperledger.org/production/vex-yul-hyp-jenkins-3/fabric-docs-build-x86_64/1601/html/_images/transactor.png IN OUT 54da6a87776f (Owner:User1@Org1) 100 f4509c2d4eed-0 (Owner:User2@Org2) 50 f4509c2d4eed-1 (Owner:User1@Org1) 50
  16. 16. © Hitachi America, Ltd. 2019. All rights reserved. Using FabToken • Setup – configtx.yaml • Enable V2_0 application feature – No chaincode required • “token” command – issue, list, transfer, redeem • TokenClient (SDK) $ token issue --config org1.json --mspPath admin/msp --channel mychannel --type BYFNcoins --quantity 100 --recipient user1/msp const tokenclient = client.newTokenClient(mychannel); … const result = await tokenClient.issue(issueRequest);
  17. 17. © Hitachi America, Ltd. 2019. All rights reserved. Cloud native support of chaincode
  18. 18. © Hitachi America, Ltd. 2019. All rights reserved. Chaincode invocation • A peer starts a chaincode container when a transaction for the chaincode is requested and it does not exist – Only if the chaincode is installed and instantiated – A peer directly communicates with dockerd in the host via the exposed docker.sock Host dockerd Peer Container Chaincode Container 1. docker build docker run 2. Create a container 3. Execute a transaction
  19. 19. © Hitachi America, Ltd. 2019. All rights reserved. Cloud native support • Motivation – A chaincode container is directly created by a peer – Not conforming to the standard security practice – Not well integrated with cloud native tools (Kubernetes, etc.) • Microservice design • Design (In progress) – Detaching chaincodes from peers • Peers will communicate with remote chaincode containers
  20. 20. © Hitachi America, Ltd. 2019. All rights reserved. Appendix
  21. 21. © Hitachi America, Ltd. 2019. All rights reserved. New Chaincode Lifecycle (1) • Package & Install $ peer lifecycle chaincode package nodecc.tar.gz --path /etc/hyperledger/fabric/chaincode_node --lang node --label nodecc_1 $ peer lifecycle chaincode install nodecc.tar.gz 2019-04-09 00:44:53.763 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"nInodecc_1:b4c489da2074ae28633c885944952f16aa93538b9eb116a49c16d366e2309a3a022 010nodecc_1" > 2019-04-09 00:44:53.763 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: nodecc_1:b4c489da2074ae28633c885944952f16aa93538b9eb116a49c16d366e2309a3a $ peer lifecycle chaincode queryinstalled Installed chaincodes on peer: Package ID: nodecc_1:b4c489da2074ae28633c885944952f16aa93538b9eb116a49c16d366e2309a3a, Label: nodecc_1 CC_Package_ID nodecc_1:b4c489da2074ae28633c885944952f16aa93538b9eb116a49c16d366e2309a3a *Options related to orderer/peer information are omitted
  22. 22. © Hitachi America, Ltd. 2019. All rights reserved. New Chaincode Lifecycle (2) • Approve $ peer lifecycle chaincode approveformyorg --channelID mychannel --name nodecc --version 1.0 --init-required --package-id nodecc_1:b4c489da2074ae28633c885944952f16aa93538b9eb116a49c16d366e2309a3a --sequence 1 -- signature-policy "AND ('Org1MSP.peer','Org2MSP.peer')" $ peer lifecycle chaincode queryapprovalstatus --channelID mychannel --name nodecc -- version 1.0 --sequence 1 --init-required --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer')" { "Approved": { "Org1MSP": true, "Org2MSP": false } }
  23. 23. © Hitachi America, Ltd. 2019. All rights reserved. New Chaincode Lifecycle (3) • Commit $ peer lifecycle chaincode commit --channelID mychannel --name nodecc --version 1.0 -- sequence 1 --init-required --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer')" 2019-04-20 10:13:07.786 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [80e26ee16cc1485e23f603eb97e486f1bc4f3f9c6f4c19143f68466bb37b69bf] committed with status (VALID) at peer0.org2.example.com:9051 2019-04-20 10:13:07.796 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [80e26ee16cc1485e23f603eb97e486f1bc4f3f9c6f4c19143f68466bb37b69bf] committed with status (VALID) at peer0.org1.example.com:7051
  24. 24. © Hitachi America, Ltd. 2019. All rights reserved. Lifecycle endorsement Policy • configtx.yaml Application: &ApplicationDefaults ... Policies: &ApplicationDefaultPolicies LifecycleEndorsement: Type: ImplicitMeta Rule: "MAJORITY Endorsement" Endorsement: Type: ImplicitMeta Rule: "MAJORITY Endorsement" ...
  25. 25. © Hitachi America, Ltd. 2019. All rights reserved. Token (1) • Issue • List • Transfer $ token issue --config configorg1.json --mspPath admin@org1/msp --channel mychannel -- type BYFNcoins --quantity 100 --recipient Org1MSP:User1@org1.example.com/msp Orderer Status [SUCCESS] Committed [true] $ token list --config configorg1.json --mspPath User1@org1/msp --channel mychannel {"tx_id":"54da6a87776fabe14cfd442315046a561929bd8fffe5634660a1afec31bba621"} [BYFNcoins,100] $ token transfer --config configorg1.json --mspPath User1@org1/msp --channel mychannel --tokenIDs '[{"tx_id":"54da6a87776fabe14cfd442315046a561929bd8fffe5634660a1afec31bba621"}]' -- shares shares.json Orderer Status [SUCCESS] Committed [true]
  26. 26. © Hitachi America, Ltd. 2019. All rights reserved. Token (2) • List after transfer • (Failed) Double spending $ token list --config configorg1.json --mspPath User1@org1/msp --channel mychannel {"tx_id":"f4509c2d4eed0b176aaf97cf4b659ea631d9794c0324fe56b3814c70b741e161","index":1} [BYFNcoins,50] $ token list --config configorg2.json --mspPath User1@org2/msp --channel mychannel {"tx_id":"f4509c2d4eed0b176aaf97cf4b659ea631d9794c0324fe56b3814c70b741e161"} [BYFNcoins,50] $ token transfer --config configorg1.json --mspPath User1@org1/msp --channel mychannel --tokenIDs '[{"tx_id":"54da6a87776fabe14cfd442315046a561929bd8fffe5634660a1afec31bba621"}]' -- shares shares.json transfer: failed invoking transfer [mychannel][User1@org1/msp][][[{"tx_id":"54da6a87776fabe14cfd442315046a561929bd8fffe56 34660a1afec31bba621"}]][shares.json]: error from prover: input TokenId (54da6a87776fabe14cfd442315046a561929bd8fffe5634660a1afec31bba621, 0) does not exist or not owned by the user

×