Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ブロックチェーンゲームMyCryptoHeroesの作り方 / Architecture of My Crypto Heroes

ブロックチェーンゲームMyCryptoHeroesの作り方 / Architecture of My Crypto Heroes

AWS Summit Tokyo Startup Architecture Of The Year 2019

Ryo Manzoku

June 13, 2019
Tweet

More Decks by Ryo Manzoku

Other Decks in Technology

Transcript

  1. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    ϒϩοΫνΣʔϯήʔϜ

    ͷ࡞Γํ
    ຬ଍ ྄
    ϦʔυΤϯδχΞ
    double jump.tokyoגࣜձࣾ

    View full-size slide

  2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    My Crypto Heroesͱ͸
    • ʮήʔϜʹ͔͚ͨ࣌ؒ΋͓ۚ΋৘೤΋ɺ͋ͳͨͷࢿ࢈ͱͳΔੈքʯ
    • ྺ্࢙ͷώʔϩʔΛूΊɺΞΠςϜΛ֫ಘ͠ɺότϧ͢ΔϒϩοΫνΣ
    ʔϯRPGήʔϜ
    • ϒϩοΫνΣʔϯEthereum͓Αͼ෼ࢄετϨʔδIPFSΛར༻͠ɺήʔ
    Ϝࢿ࢈ͷඇதԝूݖੑΛ࣮ݱ
    • ϒϩοΫνΣʔϯͷ՝୊Ͱ͋ΔεέʔϥϏϦςΟͱUXͷղܾͷͨΊήʔ
    Ϝͱͯ͠ͷػೳ͸AWS্ʹߏங

    View full-size slide

  3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    My Crypto Heroesͱ͸

    View full-size slide

  4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    ͳͥϒϩοΫνΣʔϯΛ࢖͏ͷʁ
    • ϒϩοΫνΣʔϯͷήʔϜࢿ࢈ͷʮॴ༗৘ใʯ͸Ϣʔβʔͷ΋ͷ
    • ࣗ༝ʹऔҾɺৡ౉͕Մೳ
    • ήʔϜͷ࿮Λඈͼӽ͑ͯʮॴ༗৘ใʯΛ׆༻Ͱ͖Δ
    • ೝূɺܾࡁͷϓϥοτϑΥʔϜ͕ख਺ྉͳ͠Ͱར༻Ͱ͖Δ
    • Ձ஋ͷ͋ΓํΛม͑ΔʮϒϩοΫνΣʔϯٕज़ʯΛ༻͍ͯήʔϜͷະདྷ
    ΛϦϏϧυ͢Δͱ͍͏ձࣾͷϛογϣϯ

    View full-size slide

  5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    &UIFSFVN
    6TFS
    Ϣʔβʔ͸ECDSAॺ໊༻ͷൿີ伴ͱ
    ରʹͳΔΞυϨεΛॴ༗
    ήʔϜࢿ࢈͸ɺEthereum্Λਖ਼ͱͯ͠؅ཧ
    ॴ༗৘ใ͸ɺϢʔβʔͷΞυϨεʹ͋Δ
    ॴ༗৘ใΛ֬ೝ
    ήʔϜࢿ࢈Λ༻͍ͯήʔϜͰ༡Ϳ
    ࢿ࢈ΛҭͯΔ
    MyCryotoHeroesͰ͸
    ɾήʔϜࢿ࢈Λ࢖ͬͨ༡ͼͷఏڙ
    ɾETHʹΑΓήʔϜ಺௨՟Λൢച
    ɾ৽͍͠ήʔϜࢿ࢈ͷ෇༩ɺൢച
    ɾήʔϜࢿ࢈΁ΞʔτΛ෇༩
    My Crypto Heroesͷߏ੒ཁૉ

    View full-size slide

  6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    γεςϜΞʔΩςΫνϟ
    6QMPBEUP*1'4
    4
    &UIFSFVN *1'4
    *NBHFVQMPBE
    8FC "VSPSB
    /-#
    6TFS
    #BUDI
    71$
    1SPYZ
    4FOEUY
    .POJUPSJOH

    &UI
    $%/
    4FOEUY
    4UBUJDEBUB

    0MEEBUB
    1SPYZ

    View full-size slide

  7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    γεςϜΞʔΩςΫνϟ
    User ʢWebΞϓϦʣ Web
    Nginx
    ɾTLS-termination
    ɾgRPC-Web proxy
    ɾL7 Routing
    SPA
    ɾNuxt.js
    ɾWeb3.js
    ɾgRPC-Web
    ɾCore-service (Go/gRPC)
    ɾAuth-service (Go/echo)
    ɾUploader-service (Go/echo)
    ɾEth-proxy-service (Go/echo)
    ɾAmazon S3
    Microservices (Systemd)

    View full-size slide

  8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    ͜ͷΞʔΩςΫνϟΛ࠾༻͍ͯ͠Δཧ༝
    • ϒϩοΫνΣʔϯɺgRPCͱ͍͏৽نྖҬʹඈͼࠐΉʹ͋ͨΓɺͦΕҎ֎
    ͸࣮੷ͱ৴པͷ͋ΔAWSΛ࢖͏͜ͱͰ৽نྖҬʹूத͕Ͱ͖Δ
    • AuroraɺS3ɺLambda͸ܦݧ্ɺ৴པͱ࣮੷͕͋ͬͨ
    • SPAΛ࠾༻ͨ͜͠ͱ΍όοΫΤϯυͷଟ༷ͳॲཧΛҰݩ؅ཧ͢ΔͨΊɺ
    NLBΛར༻͠ɺNginxΛL7ϧʔλͱͯ͠࠷େݶ׆༻͍ͯ͠Δ
    • Nginx͔ΒόοΫΤϯυ΁ͷ௨৴ͷෆ҆ཁૉΛۃྗ΁Βͨ͢Ίɺίϯς
    φͳͲ͸ར༻ͤͣಉҰΠϯελϯε಺ʹඞཁͳαʔϏεΛ͢΂ͯىಈ
    ͍ͤͯ͞Δ

    View full-size slide

  9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    Well Architected ͳ 5 ͭͷϙΠϯτ
    • ৴པੑ: ՝ۚ෦෼͸͢΂ͯϒϩοΫνΣʔϯ্Ͱܾࡁ
    • ηΩϡϦςΟ: ެ։伴҉߸Λ࢖ͬͨFIDOΛ࣮ݱ
    • ӡ༻্ͷ༏लੑ: AuroraετϨʔδͷࣗಈ֦ுʹΑΔ҆৺ײ/ෛ୲ͷܰݮ
    • αʔόίετ࠷దԽ: ૿Ճ͠ଓ͚ΔҰ෦ϩάσʔλʹؔͯ͠Aurora͔Β
    S3ʹίϐʔ͠ɺΞϓϦέʔγϣϯ͔ΒS3Λ௚઀ࢀর
    • ։ൃίετ࠷దԽ: ϑϩϯτΤϯυͱόοΫΤϯυ͸Protobuf͔Βੜ੒͞
    ΕͨϥΠϒϥϦΛ௨ͯ͡௨৴

    View full-size slide

  10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    Well ArchitectedͳύϑΥʔϚϯε
    • gRPC-WebΛ࠾༻ͨ͜͠ͱͰHTTP/2Λ࠷େݶར༻ͨ͠ฒྻΞΫηε
    • ProtobufΛͦͷ··JSONܕʹอଘɺΠϯσοΫε͕ඞཁͳσʔλͷΈ
    ݸผͷΧϥϜΛ࡞੒
    • ΞϓϦέʔγϣϯ͔ΒDB΁ͷJOINΫΤϦ͸Ұ੾ͳ͠
    • কདྷͷεέʔϦϯά΋ࢹ໺ʹ
    • ֎෦ཁૉͰ͋ΔIPFS΁ͷը૾Ξοϓϩʔυ͸ɺS3 PutEventΛτϦΨʔ
    ʹLambdaͰඇಉظॲཧ
    • ETH΁ͷΞΫηεΛҰ෦αʔόͰϓϩΩγ͢Δ͜ͱͰUXվળ

    View full-size slide

  11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    gRPC-WebʹΑΔฒྻΞΫηε

    View full-size slide

  12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    ΞΫηεϨΠςϯγ

    View full-size slide

  13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    DBʹ͓͚ΔSelect Latency

    View full-size slide

  14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    ΞʔΩςΫνϟʹΑΔϏδωε΁ͷߩݙ
    • ݱΞʔΩςΫνϟ͸͓Αͦ2ϲ݄Ͱߏஙɺ2018೥11݄30೔ϦϦʔεɻ
    • ྦྷܭϢʔβʔ਺5ສਓɺ6,000DAUɺ3,000ϢʔβʔτϥϯβΫγϣϯ
    • ྦྷܭച্ֹ 6ϲ݄Ͱ12,000ETH௒
    • EthereumΛ࢖ͬͨੈքҰͷϒϩοΫνΣʔϯήʔϜ
    • ੈքͰ΋਺গͳ͍gRPC-WebͷϓϩμΫγϣϯࣄྫ
    • S3ɺAuroraΛ࢝ΊAWSશମͷ҆৺ײ͔ΒϒϩοΫνΣʔϯ΍gRPCͳͲ
    ৽نྖҬͷٕज़΁શྗͰ౿ΈࠐΉ͜ͱ͕Ͱ͖Δ

    View full-size slide

  15. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    ͍͞͝ʹɺɺ

    View full-size slide

  16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    γεςϜΞʔΩςΫνϟ
    6QMPBEUP*1'4
    4
    &UIFSFVN *1'4
    *NBHFVQMPBE
    8FC "VSPSB
    /-#
    6TFS
    #BUDI
    71$
    1SPYZ
    4FOEUY
    .POJUPSJOH

    &UI
    $%/
    4FOEUY
    4UBUJDEBUB

    0MEEBUB
    1SPYZ

    View full-size slide

  17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    S U M M I T
    γεςϜΞʔΩςΫνϟ
    6QMPBEUP*1'4
    4
    &UIFSFVN *1'4
    *NBHFVQMPBE
    8FC "VSPSB
    /-#
    6TFS
    #BUDI
    71$
    1SPYZ
    4FOEUY
    .POJUPSJOH

    &UI
    $%/
    4FOEUY
    4UBUJDEBUB

    0MEEBUB
    1SPYZ
    VPC಺ʹߏங͍ͨ͠ͷͰ
    Managed BlockchainʢEthereumʣ
    Λ଴ͪΘͼ͓ͯΓ·͢ʂ

    View full-size slide

  18. Thank you!
    S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    ຬ଍ ྄ʢManzoku Ryoʣ
    [email protected] / twitter@rmanzoku

    View full-size slide