Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hyperledger Fabric ハンズオン手順
Search
Taiji HAGINO
PRO
June 12, 2019
Technology
0
320
Hyperledger Fabric ハンズオン手順
本資料は5月29日、6月12日、7月3日のIBM Developer Dojo用の資料です。
Taiji HAGINO
PRO
June 12, 2019
Tweet
Share
More Decks by Taiji HAGINO
See All by Taiji HAGINO
Automatic Creation of Azure Environment Configuration Diagrams! with Datadog Cloudcraft
taijihagino
PRO
0
20
VS Code の静的分析でリアルタイムのコードフィードバックを取得
taijihagino
PRO
0
52
Backstage of Enterprise Conference
taijihagino
PRO
1
140
どの種は何の花を咲かす?DevRelのターゲットオーディエンスを知ることの意味
taijihagino
PRO
2
210
Datadogの便利な使い方 - 意外と知らない?CoScreenとCloudcraft
taijihagino
PRO
1
1.3k
DatadogとPagerDutyで改善するシステム障害対応
taijihagino
PRO
0
450
ソフトウェアチームのパフォーマンスを向上させる鍵: パイプラインのオブザーバービリティ
taijihagino
PRO
1
100
エンドツーエンドの可視性を実現するクエスト
taijihagino
PRO
1
370
JDDUG (Japan Datadog User Group)始動の舞台裏
taijihagino
PRO
2
260
Other Decks in Technology
See All in Technology
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
140
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
120
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
220
強いチームと開発生産性
onk
PRO
34
11k
Evangelismo técnico: ¿qué, cómo y por qué?
trishagee
0
360
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
970
Terraform Stacks入門 #HashiTalks
msato
0
350
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
190
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
830
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
Featured
See All Featured
Side Projects
sachag
452
42k
Typedesign – Prime Four
hannesfritz
40
2.4k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Designing for Performance
lara
604
68k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Transcript
2019/06/19 10(21 1 / 14 ϖʔδ about:blank 1.IBPͷωοτϫʔΫىಈ IBM CloudͷΧλϩά͔ΒBlockchain
Platform v2.0Λબ https:/ /cloud.ibm.com/catalog Standard PlanΛબͯ͠࡞ΛΫϦοΫ →IBPͷ࡞ϖʔδʹҠಈ͢Δɻ σϓϩΠϝϞ
2019/06/19 10(21 2 / 14 ϖʔδ about:blank DallasͷσʔληϯλʔͰIKSͷΫϥελʔΛ࡞͢Δඞཁ͕͋Δɻ طʹߏஙࡁΈͷΫϥελʔར༻Մೳɻ ͨͩ͠ɺKubernetesͷόʔδϣϯv1.11Ҏ্ਪɻ
IKSͷFreeϓϥϯΛબ͢Ε30ؒແྉͰར༻͢Δ͜ͱ͕Ͱ͖Δɻ IKSͷΫϥελʔબͷϓϧμϯͷ෦ͰϒϥβʹΑͬͯΫϥελ͕දࣔ͞Εͳ͍Մೳੑ͕͋ Δɻ ϒϥβΛ࠷৽όʔδϣϯʹΞοϓσʔτ͢Δ͔ɺଞͷϒϥβΛར༻͢Δ͔Ͱରॲ͢Δɻ IKSͰClusterΛ͍࣋ͬͯͳ͍߹create a new clusterΛΫϦοΫɻ IKSͷΫϥελ࡞ϖʔδͷλϒ͕৽͘͠։͘ɻ ແྉϓϥϯΛબ͠ɺϩέʔγϣϯ͕μϥεʹͳ͍ͬͯΔ͜ͱΛ֬ೝͷ্ɺ࡞ΛΫϦοΫɻ Ϋϥελ͕࡞͞ΕΔ·Ͱ30ɻ
2019/06/19 10(21 3 / 14 ϖʔδ about:blank Ϋϥελͷߏங͕ྃ͢ΔͱworkkerϊʔυͷKuberntesͷόʔδϣϯ͕දࣔ͞ΕΔɻ όʔδϣϯ͕1.11Ҏ্Ͱͳ͍ͱBlockchainͷϊʔυཱ͕ͯΒΕͨʹͨΊɺόʔδϣϯͷߋ৽͕ඞ ཁɻ
·ͣԼਤʹै͍ɺΫϥελͷόʔδϣϯͷߋ৽Λߦ͏ɻΞφϯεʹै͍ɺ1࣌ؒޙɺworkerϊʔ υͷϝχϡʔ͔Βόʔδϣϯߋ৽Λߦ͏ͱworkerϊʔυͷόʔδϣϯ1.11Ҏ্ʹΞοϓσʔτ ͢Δ͜ͱ͕Ͱ͖ΔɻσϑΥϧτͷىಈόʔδϣϯ2/25ݱࡏv1.11ͷͨΊɺόʔδϣϯΞοϓ ෆཁɻ ΫϥελΛબ͠ɺDeploy to clusterΛΫϦοΫɻ ͦͷޙɺLaunch the IBM Blockchain PlatformΛΫϦοΫ
2019/06/19 10(21 4 / 14 ϖʔδ about:blank IBPͷཧίϯιʔϧը໘ 2.ϊʔυ࡞ ࢀߟใʢӳޠ൛ͷΈʣ
https:/ /cloud.ibm.com/docs/services/blockchain/howto?topic=blockchain-ibp-console-build- network&locale=en#ibp-console-build-network (1)CAϊʔυͷ࡞ Blockchain ωοτϫʔΫʹࢀՃ͢Δ৫ͷCAΛىಈ͠ɺCAΛͬͯɺൿີ伴ূ໌ॻΛൃߦ͠ ͯɺ ଞͷϊʔυΛىಈ͍ͯ͘͠ɻ ཧίϯιʔϧͷࠨϝχϡʔͷNodesΛબɻ Add Certificate AuthorityΛΫϦοΫɻ Create a new Certificate AuthorityΛબͯ͠ɺNextΛΫϦοΫɻ Display NameΛ"Org1 CA"ͱهೖɻ
2019/06/19 10(21 5 / 14 ϖʔδ about:blank Enrollment IdΛadminɺsecretΛadminpwͱͯ͠NextΛΫϦοΫɻ ࠷ޙʹsubmitΛԡ͢ͱCAϊʔυ͕࡞͞ΕΔɻ
ಉ༷ͷཁྖͰOrderer༻ͷCA࡞͓ͯ͘͠ɻ (2)adminϢʔβͷ࡞ɻ (1)Ͱ࡞ͨ͠CAϊadminϢʔβΛ࡞͢Δɻ(1)Ͱ࡞ͨ͠σϑΥϧτϢʔβΛͦͷ··ར༻͢Δ ͷɺ ɹηΩϡϦςΟ؍ͰΑΖ͘͠ͳ͍ɻ (1)Ͱ࡞ͨ͠Org1 CAΛબɻ Register UserΛΫϦοΫɻ Enrollment ID"org1admin"Secret"org1adminpw"Ͱ࡞͢Δɻ ϢʔβλΠϓClientΛબɻAffiliationαϯϓϧͰར༻ͳ͍ͨΊɺબࢶ͔ΒҙͷΛҒ Ϳɻ Φϓγϣϯཝهೖͷ··SubmitΛΫϦοΫ͢ΔͱϢʔβ͕࡞͞ΕΔɻ ಉ༷ʹPeerߏங༻ͷϢʔβΛ࡞͢Δɻ Enrollment ID"peer1"Secretpeer1pwͰϢʔβλΠϓpeerΛબ͢Δɻ Ordererಉ༷ʹordereradminͱorderer1Ϣʔβͷ2ͭΛ࡞͢Δɻ (2)৫(MSP)ͷ࡞ɻ IBPͷཧίϯιʔϧͷOrganizationsλϒΛબ͢Δɻ Create MSP definitionΛબ͢Δɻ Display NameΛOrg1 MSPɺMSPIDΛorg1mspͰηοτ͢Δɻ
2019/06/19 10(21 6 / 14 ϖʔδ about:blank CAͷબཝͰઌ΄Ͳ࡞ͨ͠Org1 CAΛબ͢Δɻ Enrollment
IDͱSecretorg1adminͱorg1adminpwʹมߋ͠ɺGenerateϘλϯΛԡ͢ɻ IBPͷཧίϯιʔϧͷwalletଟͰ࡞ͨ͠ϢʔβΛ֬ೝ͢Δ͜ͱ͕Ͱ͖Δɻ ൿີ伴ͱূ໌ॻΤΫεϙʔτͯ͠VSCodeͱͷଓʹར༻͢Δɻ ͜ͷwalletϒϥβͷϩʔΧϧετϨʔδ্ʹอଘ͞Ε͍ͯΔ͚ͩͰɺIKS্ʹอଘ͞Ε͍ͯͳ ͍ͨΊɺ ϢʔβࣗͰΤΫεϙʔτͯ͠ཧ͢Δඞཁ͕͋Δɻ ϒϥβͷཤྺΛআͨ͠ΓɺΩϟογϡΛআ͢Δͱwalletͷσʔλ͕ͳ͘ͳΓɺϊʔυʹΞ ΫηεͰ͖ͳ͘ͳͬͯ͠·͏ͷͰɺ࡞ͨ͠walletͷσʔλඞͣΤΫεϙʔτͯ͠όοΫΞοϓ Λऔಘ͓ͯ͘͠ඞཁ͕͋Δɻ ࠷ޙʹCreate MSPϘλϯΛԡ͢ɻ OrganizationsʹOrg1 MSP͕࡞͞ΕΔɻ ಉ༷ʹOrderer MSP࡞͓ͯ͘͠ɻ (4)PeerɺOrdererϊʔυͷ࡞ɻ IBPͷཧίϯιʔϧͷNodesλϒΛબ͠Add PeerΛબ͢Δɻ display NamePeer Org1ʹઃఆ͢Δɻ CAOrg1 CAɺEnrollment IDͱSecretPeerͷ࡞༻ʹ࡞ͨ͠peer1ϢʔβΛࢦఆ͠NextΛબ ɻ
2019/06/19 10(21 7 / 14 ϖʔδ about:blank TLSͷཝEnrollment IDadminɺSecretadminpwΛબ͢ΔɻʢΦϓγϣϯػೳͷͨΊʣ ࠷ޙʹIdentityΛOrg1
Adminʹͯ͠NextɺSubmitΛબ͢ΔɻPeer͕࡞͞ΕΔɻ ͜͜·ͰͰPeer1ɺOrderer1ɺCA͕2࡞Ͱ͖͍ͯΔ͜ͱΛNodesλϒͰ֬ೝ͢Δɻ (5)࡞ͨ͠৫ΛOrdererͷίϯιʔγΞϜϝϯόʔՃ͢Δɻ
2019/06/19 10(21 8 / 14 ϖʔδ about:blank IBPͷཧίϯιʔϧͷNodesλϒ͔Β࡞ͨ͠OrdererΛબ͢Δɻ Consortium MembersͷAdd
OrganizationΛબ͢Δɻ Org1 MSPΛબͯ͠ɺSubmitΛΫϦοΫ͢Δɻ ࢀՃ༧ఆͷ৫ΛશͯConsortium Memberʹొͯ͠ஔ͔ͳ͍ͱνϟωϧͷ࡞ͰΤϥʔ͕ൃੜ ͢Δɻ (6)νϟωϧͷ࡞ IBPͷίϯιʔϧͷࠨϝχϡʔը໘͔ΒChannelsΛબ͠ɺCreate channelΛબ͢Δɻ ҎԼͷΑ͏ʹΛೖྗ͠ɺAddϘλϯΛԡ͢ɺOrg1MSPʹର͢Δݖݶͷઃఆཝ͕දࣔ͞ΕΔͷ Ͱɺ OperatorʹνΣοΫΛೖΕɺCreate ChannelϘλϯΛબ͢Δɻ
2019/06/19 10(21 9 / 14 ϖʔδ about:blank
2019/06/19 10(21 10 / 14 ϖʔδ about:blank νϟωϧ͕࡞͞ΕΔ͕ɺཧը໘্ʹ·ͩදࣔ͞Εͳ͍ɻ ଓ͍ͯɺJoin channelϘλϯΛΫϦοΫ͢Δɻ
OrdererΛબ͠ɺNext ઌ΄Ͳ࡞ͨ͠channel1Λهೖ͠ɺNextɺ ࠷ޙʹࢀՃͤ͞ΔPeerϊʔυΛબ͠ɺSubmitΛΫϦοΫ͢Δɻ νϟωϧ͕࡞͞ΕΔɻ 3.εϚʔτίϯτϥΫτσϓϩΠ IBPͷࠨϝχϡʔը໘͔ΒSmart contractλϒΛબ͠ɺInstall smart contractΛΫϦοΫɻ Πϯετʔϧ͢ΔνΣʔϯίʔυͷύοέʔδϑΝΠϧ(cds)ϑΝΠϧΛબͯ͠ɺΠϯετʔϧ ͢Δɻ ύοέʔδͷํ๏VSCodeΛར༻͢Δํ๏ͱɺpeerίϚϯυΛར༻͢Δํ๏ͷ2छྨ͕͋Δɻ VSCode͔Βύοέʔδͨ͠ϑΝΠϧInstallͰ͖ͳ͍ 413 (Request Entity Too Large)͕javascriptίϯιʔϧͰฦͬͯདྷ͍ͯͨɻ ༰ྔ͕େ͖͔ͬͨͨΊɺࣦഊͨ͠ͱਪ ޭͨ͠cdsϑΝΠϧ2KBɺࣦഊ͍ͯ͠ΔcdsϑΝΠϧ18.1MB →packaging͢Δࡍʹnode_moduleҰॹʹpackage͞Ε͍ͯͨͨΊɺ༰ྔ͕ංେԽ͍ͯͨ͠ͱਪ ɻ ɹϓϩδΣΫτͷnode_moduleΛআͷ্ɺpackage͢Δͱ27KBʹݮΒ͢͜ͱ͕Ͱ͖ɺ ɹΠϯετʔϧޭͨ͠ɻ
2019/06/19 10(21 11 / 14 ϖʔδ about:blank νΣʔϯίʔυͷinstantiate IBPͷཧը໘ͷࠨϝχϡʔͷSmart contracts͔ΒΠϯετʔϧͨ͠εϚʔτίϯτϥΫτϦετ
Λදࣔ͠ɺӈଆͷϝχϡʔ͔ΒInstantiateΛબɻ εϚʔτίϯτϥΫτΛσϓϩΠ͢ΔνϟωϧΛબ͠ɺEndorsement PolicyΛબͯ͠ɺ Instantiate͢Δࡍʹ࣮ߦ͢Δ໊ؔͱҾΛೖྗͯ͠InstantiateΛΫϦοΫɻ Endorsement Policyγϯϓϧʹ৫Λબ͢ΔύλʔϯͱJSONϑΝΠϧͰࡉ͔͘ࢦఆ͢Δύλ ʔϯͷ2௨Γ͕͋Δɻ Instantiate͕ྃ͢ΔͱInstantiated smart contractͷϦετʹදࣔ͞ΕΔɻ 4.ωοτϫʔΫͷଓ IBPͷཧίϯιʔϧͷࠨϝχϡʔ͔ΒSmart contractsΛબɻ Instantiated smart contractsͷҰཡͷӈϝχϡʔ͔Βconnect with SDKΛબ͠ɺωοτϫʔΫͷ ConfigϑΝΠϧΛμϯϩʔυ͢Δɻ ϑϩϯτΞϓϦ͔ΒIBPͷωοτϫʔΫʹଓ͢ΔͷʹඞཁͳใҎԼ4ͭ ɾConnection Profileʢ্هͰμϯϩʔυͨ͠configϑΝΠϧʣ ɾωοτϫʔΫʹࢀՃ͍ͯ͠Δ৫ͷCAͷadminϢʔβͱsecret(admin/adminpw) ɾଓ͢Δνϟωϧ໊ ɾଓ͢ΔνΣʔϯίʔυ໊ (1)ΞϓϦέʔγϣϯϢʔβͷ࡞
2019/06/19 10(21 12 / 14 ϖʔδ about:blank ɹτϥϯβΫγϣϯʹॺ໊͢ΔͨΊͷΞϓϦέʔγϣϯϢʔβΛ࡞͢Δɻ ɹɾConnection ProfileͷύεΛมߋ
ɹɾCAͷURLΛϙʔτͰࢦఆ ɹɾenrollment IDͱSecretɺOrg1ͷMSP IDΛهࡌɻ node enrollUser.jsͰϢʔβΛ࡞ɻ ผ్package.jsonΛ࡞ͯ͠ɺnpm install͢Δඞཁ͋Γɻ package.jsonfabcarͷαϯϓϧΛίϐʔͯ͠ར༻ɻ (2)τϥϯβΫγϣϯͷૹ৴ ɹ্ه4ͭͷใͱ(1)Ͱ࡞ͨ͠ϢʔβΛͬͯɺτϥϯβΫγϣϯΛૹ৴͢Δɻ ɾconnection ProfileͷύεΛมߋ ɾνϟωϧ໊Λࢦఆ ɾνΣʔϯίʔυ໊Λࢦఆ node invoke.jsͰ࣮ߦ Channel not found....ͱ͍͏Τϥʔ͕ग़Δ͕ɺͦͷޙτϥϯβΫγϣϯਖ਼ৗʹૹ৴͞ΕΔͷͰ ͳ͠ɻ ʢdiscovery Serviceͷόάͱਪʣ 5.VSCode(ධՁ൛)ͱͷଓ (1)network configϑΝΠϧͷμϯϩʔυɻ IBPͷཧը໘ͷsmart contractλϒΛબɻ Instantiated smart contractsͷҰཡ͔ΒσϓϩΠͨ͠εϚʔτίϯτϥΫτΛબ͠ɺӈͷϝχϡ ʔ͔Βconnect SDKΛΫϦοΫɻ
2019/06/19 10(21 13 / 14 ϖʔδ about:blank Download Connection ProfileΛΫϦοΫ͢ΔͱɺjsonܗࣜͰnetworkͷconfigϑΝΠϧ͕μϯϩ
ʔυ͞ΕΔɻ (2)ଓ༻ͷൿີ伴ɺূ໌ॻͷ࡞ɻ IBPͷཧը໘ͷWalletλϒΛબɻ ࡞ͨ͠Identity(Org1Admin)Λબ͢Δɻ ը໘ӈଆʹূ໌ॻͱൿີ伴͕දࣔ͞ΕΔɻ VSCodeͰར༻͢Δʹ͜ΕΒͷσʔλΛPEMϑΥʔϚοτʹม͢Δඞཁ͕͋Δɻ ɹ ҎԼͷίϚϯυΛϩʔΧϧͰ࣮ߦ͢ΔͱPEMϑΝΠϧ͕ੜͰ͖Δɻ #export FLAG=$(if [ "$(uname -s)" == "Linux" ]; then echo "-w 0"; else echo "-b 0"; fi) #echo <base64_string> | base64 --decode $FLAG > <key>.pem <base64_string>ʹ্هཧը໘ͷӈଆʹදࣔ͞ΕΔൿີ伴 or ূ໌ॻͷจࣈྻΛೖΕͯɺ <key>ʹҙͷϑΝΠϧ໊Λهࡌ͢Δɻ (3)VSCodeͱIBPͷωοτϫʔΫΛଓ͢Δɻ ͋Β͔͡ΊVSCodeʹIBM Blockchain PlatformͷΞυΦϯΛΠϯετʔϧ͓ͯ͘͠ɻ https:/ /marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain- platform#overview VSCodeͷࠨϝχϡʔ͔ΒIBM Blockchain PlatformΛબɻ Blockchain Connectionsͷӈଆͷ+ϘλϯΛΫϦοΫɻ ଓઌͷωοτϫʔΫ໊ʹҙͷωοτϫʔΫ໊Λબ͢Δɻ ࣍ʹ্هͰμϯϩʔυͨ͠networkͷconfigϑΝΠϧΛϑΝΠϧ͔Βબ͢Δɻ Create a new wallet for an identity with a certificate and private keyΛબ͠ɺwallet໊Λ
2019/06/19 10(21 14 / 14 ϖʔδ about:blank org1adminͱهࡌ͢ΔɻenrollIDͱಉ໊͡લʹࢦఆ͠ͳ͍ͱError͕ग़ྗ͞ΕΔɻ ࠷ޙʹ(2)Ͱ࡞ͨ͠ূ໌ॻͱൿີ伴ͷPEMϑΝΠϧΛબ͢Δͱɻ VSCode͔ΒIBPͷଓ͕Ͱ͖Δɻ
IBP্ͷεϚʔτίϯτϥΫτͷτϥϯβΫγϣϯͷૹ৴͕Ͱ͖Δɻ VSCode v0.3.0ͰϩʔΧϧωοτϫʔΫͷΈεϚʔτίϯτϥΫτͷσϓϩΠ͕Ͱ͖ɺ֎෦ωο τϫʔΫτϥϯβΫγϣϯͷૹ৴ͷΈͰ͖Δɻ ࣮ࡍҎԼͷΑ͏ͳΤϥʔ͕දࣔ͞ΕɺΠϯετʔϧͰ͖Δ͕ɺInstantiationɺτϥϯβΫγϣ ϯͷૹ৴Ͱ͖ͳ͍ɻ※IBPଆͰInstantiationͰ͖ͨɻIBP for ExtensionͷόʔδϣϯΛ0.3.0ɺ VSCodeͷόʔδϣϯΛ1.31ʢIBP for Extensionͷਪόʔδϣϯʣʹͨ͠ΒΤϥʔ͕දࣔ͞Εͳ ͘ͳͬͨɻʢVSCode͔ΒIBPͷωοτϫʔΫʹରͯ͠ΠϯετʔϧͱInstantiationͰ͖ͣɺτ ϥϯβΫγϣϯͷૹ৴͚ͩͰ͖ΔΑ͏ʹͳͬͨʣ