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

MCH Hackathon技術情報 / MCH Hackathon API

MCH Hackathon技術情報 / MCH Hackathon API

2019-04-20 開催されたHackthon向けAPI情報です。

Ryo Manzoku

April 20, 2019
Tweet

More Decks by Ryo Manzoku

Other Decks in Programming

Transcript

  1. Hackthonٕज़৘ใ
    2019–04-20 MCH Hackathon
    @rmanzoku

    View full-size slide

  2. ஫ҙ
    ͜͜Ͱ঺հͨ͠΋ͷΛඞͣ࢖Θͳ͚Ε͹ͳΒͳ͍Θ͚Ͱ͸͋
    Γ·ͤΜɻ
    Ұ෦API͸͜ͷϋοΧιϯͷͨΊʹ࡞੒ͨ͠΋ͷͰ͢ɻ༧ࠂ
    ͳ͘มߋɺ࡟আ͞ΕΔ৔߹͕͋Γ·͢ɻ
    GitHubʹ΋ެ։ࡁΈ
    https://github.com/doublejumptokyo/mch-hackathon
    ౰ͨΓલͷઆ໌΍஌Βͳ͍୯ޠ͕ͰΔ͔΋͠Ε·ͤΜ͕ɺ͜
    ͷ͋ͱϝϯλʔͷํʑʹ࣭໰ͯ͠Έ͍ͯͩ͘͞ɻ

    View full-size slide

  3. MyCryptoHeroesʹ͍ͭͯ

    View full-size slide

  4. MyCryptoHeroes͓͞Β͍
    ERC721Λ࢖ͬͨHero / Extension / LandSectorͷ
    Ethereum্ͷAsset
    Ethereum্Ͱͷॴ༗ݖΛӡӦॴ༗ͷεϚʔτίϯτ
    ϥΫτʹ༬͚Δ͜ͱͰɺCryptoWorldʢήʔϜ಺ʣͰ
    ར༻ՄೳʹͳΔʢLandSector͸ྫ֎ʣ
    ήʔϜ಺ͷ৘ใ͸Ұ෦ެ։APIΛ௨ͯ͠ࢀরͰ͖Δ

    View full-size slide

  5. MyCryptoHeroes͓͞Β͍
    Ϣʔβʔ͸ήʔϜ಺ʹUserIDΛ͍࣋ͬͯΔ
    UserIDͱEthereumΞυϨεΛඥ͚ͮͯ؅ཧ͍ͯ͠Δ
    EthereumΞυϨεΛެ։͢ΔػೳʹΑΓɺ༗ޮͳ
    Ϣʔβʔ͸EthereumΞυϨε͔ΒϢʔβʔ৘ใΛऔ
    ಘͰ͖Δ

    View full-size slide

  6. ERC 721 / Metadata

    View full-size slide

  7. ERC 721
    Ethereumͷඪ४ن֨ͷҰͭͰNon-Fungible TokenʢNFTʣΛنఆ
    ͨ͠ΠϯλʔϑΣʔε
    NFTͱ͸ɺ୅ସෆՄೳͳ΋ͷ
    CryptoKittiesΛൃ୺ʹEthereum্ͰToken/Assetͷॴ༗ݖͳͲΛنఆ
    ࢀর࣮૷ͱͯ͠OpenZeppelinOSͷ΋ͷ͕༗໊
    CryptoZombies΋ERC721
    ERC20ͱൺֱ͞ΕΔ

    View full-size slide

  8. ERC721 ར༻Πϝʔδ
    MCHΞηοτ͸OpenZeppelinΛར༻ͨ͠ERC721ʹ
    ४ڌ͍ͯ͠ΔͷͰɺ޿͘࢖ΘΕΔERC721ͱͯ͠ར༻
    Ͱ͖Δ
    ϨϯσΟϯάͳͲ

    View full-size slide

  9. ERC 721 Metadata
    MCHͷHero͕HeroͨΒ͠Ί͍ͯΔϝλ৘ใ
    Heroͷ໊લ΍ϨϕϧɺύϥϝʔλͳͲ
    ΦϑνΣʔϯ৘ใΛ఻͑ΔJSON APIͰ͋Δ͜ͱ͕ଟ͍
    OpenSea΍bazaaar.ioͳͲ͸͜ͷ৘ใΛऔಘͯ͠දࣔͯ͠
    ͍Δ
    MCH+Ͱ͸ɺ͜ͷMetadataΛ֦ு͢Δ͜ͱʹΑͬͯΞ
    ηοτʹ͍ΖΜͳՁ஋Λ௥Ճ͍͚ͯ͠ΔͷͰ͸ͳ͍͔

    View full-size slide

  10. ERC 721 Metadata
    Hero
    https://www.mycryptoheroes.net/metadata/heroes/
    50010001
    Extension
    https://www.mycryptoheroes.net/metadata/extensions/
    50010001
    LandSector
    https://www.mycryptoheroes.net/metadata/
    landSectors/50010001

    View full-size slide

  11. MCH৘ใऔಘܥAPI

    View full-size slide

  12. Ξηοτʹؔ͢Δ৘ใAPI
    Skillઆ໌จͳͲͷऔಘ
    https://www.mycryptoheroes.net/experimental-api/skill/
    1001
    HeroTypeͷऔಘ
    https://www.mycryptoheroes.net/experimental-api/
    heroType/5001
    ExtensionTypeͷऔಘ
    https://www.mycryptoheroes.net/experimental-api/
    extensionType/5001

    View full-size slide

  13. Ϣʔβʔ৘ใAPI
    UserID΋͘͠͸EthereumΞυϨεͰϢʔβʔΛݕࡧ
    https://www.mycryptoheroes.net/experimental-api/
    proxy/mch/users/10001
    https://www.mycryptoheroes.net/experimental-api/
    proxy/mch/users/
    0xd868711BD9a2C6F1548F5f4737f71DA67d821090
    ޙऀ͸EthreaumΞυϨεΛެ։͍ͯ͠Δ৔߹ͷΈ༗ޮ

    View full-size slide

  14. MCH৘ใऔಘܥAPIΠϝʔδ
    ਤؑ΍ότϧγϡϛϨʔλʔͳͲ

    View full-size slide

  15. MarkingContract

    View full-size slide

  16. Ethereum্ͰϢʔβʔ৘ใΛ࢖͏
    ʮϢʔβʔ৘ใʯ͸͋͘·ͰΦϑνΣʔϯͷ৘ใ
    Ethereum্Ͱ৘ใΛѻ͏͜ͱ͕Ͱ͖ͳ͍
    Ϣʔβʔͷ೚ҙͰEthereum্ͷεϚʔτίϯτϥΫ
    τ΁৘ใΛॻ͖ࠐΈͰ͖ΔػೳΛ௥Ճ
    MarkingContractʢԾশʣΛσϓϩΠࡁΈ
    ։࢝࣌఺Ͱ50ਓҎ্ͷϢʔβʔ͕ެ։͍ͯ͠Δ

    View full-size slide

  17. MarkingContractʢԾশʣ
    https://etherscan.io/address/
    0x0085C150c1eb0e084E50a80beA91bc414AA6cbaa
    ΦϑνΣʔϯͷϢʔβʔ৘ใΛه࿥ͨ͠ίϯτϥΫ
    τ
    ͋ΔEthereumΞυϨεͷϢʔβʔ৘ใɺPrime༗ແɺ
    Landॴଐ৘ใ͕औಘͰ͖Δ
    ϥϯυॴଐऀͷΞυϨεҰཡऔಘ΋Մೳ

    View full-size slide

  18. MarkingContractར༻Πϝʔδ
    ಁ໌ੑͷ͋ΔநબίϯτϥΫτ
    ϥϯυϝϯόʔઐ༻ϖʔδ
    MarkingContractʹ৘ใΛ଍͢͜ͱͰʓʓ͕Ͱ͖Δͱ
    ͍͏Ҋ΋׻ܴ
    GitHubʹιʔείʔυެ։ࡁΈ

    View full-size slide

  19. ֦ுMetadata

    View full-size slide

  20. Ձ஋಺༰͸MetadataͰࢀরͰ͖Δ
    ΞηοτͷMetadataΛ௥ՃͰ͖Δ͜ͱͰɺMCHӡӦ
    Ҏ֎͕Ձ஋Λ෇༩Ͱ͖Δ
    Ձ஋͕Ξηοτʹू·Δ͜ͱͰɺ༷ʑͳαʔϏεͷ
    HubʹͳΔ
    Ξηοτ͕ܧଓՄೳͳ΋ͷͱͯ͠Ձ஋Λ࣋ͭΑ͏ʹ

    View full-size slide

  21. Plus Meta APIʢԾশʣ
    ʮΞηοτͷՁ஋಺༰͸MetadataͰࢀরͰ͖Δʯͱ
    ͍͏ߟ͑ʹج͖ͮɺʮՁ஋಺༰ΛMetadataͱͯ͠ొ
    ࿥Ͱ͖ΔʯAPI
    ͜͜Ͱ͸MCH΋ҰͭͷMetadataͰ͔͠ͳ͍

    View full-size slide

  22. Plus Meta APIొ࿥
    POST https://www.mycryptoheroes.net/experimental-
    api/plusmeta/heroes/50010001
    {
    "iss": "0xd868711BD9a2C6F1548F5f4737f71DA67d821090",
    "metadata": {
    "sub": "my crypto derbies",
    "aud": [
    "https://example.com/"
    ],
    "name": "deeeeep blue",
    "description": "͍͢͝",
    "attributes": {
    "hp": 100,
    "speed": 100,
    "skill": [
    "dart",
    "sunny"
    ],
    "kind": "Mare"
    }
    }
    }

    View full-size slide

  23. Plus Meta APIऔಘ
    GET https://www.mycryptoheroes.net/experimental-
    api/plusmeta/heroes/50010001

    View full-size slide

  24. Plus Meta APIར༻Πϝʔδ
    MCHΞηοτΛ࢖ͬͨϛχήʔϜͷ࡞੒ͱͦͷύϥ
    ϝʔλొ࿥
    ΞηοτऔҾॴͳͲʹΑΔ৽ண৘ใͷొ࿥

    View full-size slide

  25. ࠶౓஫ҙࣄ߲
    ͜͜Ͱ঺հͨ͠΋ͷΛඞͣ࢖Θͳ͚Ε͹ͳΒͳ͍Θ͚Ͱ͸͋
    Γ·ͤΜɻ
    Ұ෦API͸͜ͷϋοΧιϯͷͨΊʹ࡞੒ͨ͠΋ͷͰ͢ɻ༧ࠂ
    ͳ͘มߋɺ࡟আ͞ΕΔ৔߹͕͋Γ·͢ɻ
    GitHubʹ΋ެ։ࡁΈ
    https://github.com/doublejumptokyo/mch-hackathon
    ౰ͨΓલͷઆ໌΍஌Βͳ͍୯ޠ͕ͰΔ͔΋͠Ε·ͤΜ͕ɺ͜
    ͷ͋ͱϝϯλʔͷํʑʹ࣭໰ͯ͠Έ͍ͯͩ͘͞ɻ

    View full-size slide