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

BBc-1 と Ethereum 入門 / Introduction to BBc-1 and Ethereum

BBc-1 と Ethereum 入門 / Introduction to BBc-1 and Ethereum

2019年6月5日(火)、ブロックチェーンハブ主催で開催されたブロックチェーンアカデミー「実践!スマートコントラクトプログラミング 第1回 BBc-1 と Ethereum 入門」にて使用したスライドです。

Kenji Saito

June 05, 2019
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

  1. ୈ1ճ BBc-1ͱEthereumೖ໳
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά
    ϒϩοΫνΣʔϯϋϒ CSO / ܚጯٛक़େֶ SFC ݚڀॴ ্੮ॴһ
    ੪౻ ݡ࣐
    [email protected]
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.1/34

    View full-size slide

  2. ͜ͷεϥΠυ͸
    https://speakerdeck.com/ks91
    ʹஔ͔Ε·͢
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.2/34

    View full-size slide

  3. ؆୯ͳࣗݾ঺հ
    ੪౻ ݡ࣐ (͍͞ͱ͏ ͚Μ͡)
    ܚጯٛक़େֶ SFC ݚڀॴ ্੮ॴһɾ؀ڥ৘ใֶ෦ ߨࢣ (ඇৗۈ)
    גࣜձࣾϒϩοΫνΣʔϯϋϒ CSO (Chief Science Officer)
    Ұൠࣾஂ๏ਓϏϤϯυϒϩοΫνΣʔϯ ୅දཧࣄ
    Ұൠࣾஂ๏ਓΞΧσϛʔΩϟϯϓ ୅දཧࣄ
    ܦྺ
    1993 ೥ɺίʔωϧେֶΑΓ޻ֶम࢜߸औಘ (ίϯϐϡʔλαΠΤϯε)
    2006 ೥ɺܚጯٛक़େֶΑΓσδλϧ௨՟ͷݚڀͰത࢜߸औಘ (੓ࡦɾϝσΟΞ)
    ܚጯٛक़େֶ େֶӃ ੓ࡦɾϝσΟΞݚڀՊ΍ SFC ݚڀॴʹͯ 18 ೥Ҏ্ʹΘͨΓ
    P2P (Peer-to-Peer) ͓Αͼσδλϧ௨՟౳ͷݚڀʹैࣄ
    2011 ೥ՆΑΓ෱ౡͷ͜Ͳ΋ͨͪͷͨΊͷʮΞΧσϛʔΩϟϯϓʯΛ஥ؒΒͱ։࠵
    ࡢՆ͸ SFC ʹͯ ΞΧσϛʔΩϟϯϓ 2018 ՆʮΦοέʔάʔάϧɺ॓୊΍ͬͱ͍ͯʂʯΛ࣮ࢪ
    ࡢౙɺΞΧσϛʔΩϟϯϓ 2019 ౙʮԵঁͷͨΊͷΦʔτϝʔγϣϯ ∼ ΧϫΠΠ͸ࣗಈԽͰ͖ΔʂʯΛ࣮ࢪ
    → ࢲͷ಄ͷதͰ͸ͭͳ͕͍ͬͯ·͢ (͜Ε͔ΒͷࣾձͷσβΠϯ͸͜Ͳ΋ͨͪͱҰॹʹ)
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.3/34

    View full-size slide

  4. ࠓճͷςʔϚ
    ୈ̍ճͱͳΔຊηϛφʔͰ͸ɺ
    ʮϒϩοΫνΣʔϯͰͰ͖Δͱ͞Ε͍ͯΔ͜ͱΛɺຊ౰ʹʯͷ
    Ωϟ
    ονϑϨʔζͰ։ൃ͕ਐΊΒΕ͍ͯΔ BBc-1 (Beyond Blockchain One) ͱɺ
    εϚʔτίϯτϥΫτͷج൫ͱͯ͠஌ΒΕΔ Ethereum Λ
    ͓खݩͷ؀ڥʹΠϯετʔϧͭͭ͠ɺ
    ͦΕΒͷج൫ͷ֓೦ʹֶ͍ͭͯͼ·͢
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.4/34

    View full-size slide

  5. ࠓճͷߏ੒
    1. Ethereum ௒֓࿦
    2. Ethereum ಋೖ
    3. εϚʔτίϯτϥΫτͱ Ethereum
    4. ॓୊ͷग़୊
    5. BBc-1 ௒֓࿦ɺಋೖ͓Αͼςετ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.5/34

    View full-size slide

  6. 1. Ethereum ௒֓࿦
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.6/34

    View full-size slide

  7. ϒϩοΫνΣʔϯ͸ԿΛఏڙ͢Δٕज़͔
    1) ಺༰΋ଘࡏ΋୭ʹ΋൱ఆͰ͖ͳ͍Α͏ʹه࿥Λอଘɾҡ࣋͢Δ
    2) ͦͷ͔֬͞Λ୭Ͱ΋֬ೝͰ͖Δ (= ͔֬ͩͱূ໌Ͱ͖Δ)
    3) Ҏ্ͷ͜ͱΛ୭ʹ΋ࢭΊͤ͞ͳ͍
    ʮ୭ʹ΋ʯ
    ʮ୭Ͱ΋ʯͱ͸ఆٛ͞ΕͨεςʔΫϗϧμʔͨͪ
    ⇒ ͔͋ͨ΋ۭதʹه࿥ΛݻఆͰ͖Δ
    ϓϩάϥϜͱσʔλ΋ͦΜͳ෩ʹͯ͠ݻఆͰ͖Δ (= εϚʔτίϯτϥΫτ)
    ⇒ ೋॏͷ՝୊͕͋Δ
    ͦͷ͜ͱ͸ຊ౰ʹ࣮ݱͰ͖͍ͯΔͷ͔ʁ
    ͦͷ͜ͱ͕࣮ݱͰ͖ͨΒऔΓࠫଡ͞Ε͍ͯΔԠ༻͕Մೳͳͷ͔ʁ
    ෺ཧత࣮ମͱσδλϧͳه࿥ͱͷؒͷ࣮֬ͳඥ෇͚ͷ໰୊
    · αϓϥΠνΣʔϯʹ͓͍ͯ͸ɺՃ޻౳Λܦͯ΋࣮֬ʹ௥੻Մೳ͔
    ࣮࣌ؒੑɾن໛֦େ/ॖখੑɾదԠੑɾ࣋ଓੑ౳ͷ՝୊ (dependable ͳ΋ͷʹͳΓಘΔͷ͔)
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.7/34

    View full-size slide

  8. ϒϩοΫνΣʔϯ/DLT ͷݱঢ়
    ϒϩοΫνΣʔϯ (ओͱͯ͠ʮۭதʯ͸άϩʔόϧ)
    Bitcoin (βɾϒϩοΫνΣʔϯ)
    Open Assets Protocol (OAP)
    (ϏοτίΠϯϒϩοΫνΣʔϯ্ʹ೚ҙͷྔΛఆٛͯ͠ҠసͰ͖Δ)
    Ethereum (Dapps (ۭதͰಈ࡞͢ΔΞϓϦ) ͷͨΊͷج൫) (ଟ෼ʹ࣮ݧγεςϜ)
    EOS (↓ ͬͪ͜ํ޲΁ͷਐԽʁ)
    ͦͷଞͷ୆ாٕज़ (DLT) (ओͱͯ͠ʮۭதʯ͸ϩʔΧϧ)
    Hyperledger (Linux Foundation)
    Fabric (IBM/DAH), Sawtooth (Intel), Iroha (ιϥϛπ)
    ͳͲͷ։ൃ͕ਐߦத
    Corda (R3),
    . . .
    , BBc-1 (զʑ)
    ຊ౰ʹه࿥ͷ಺༰΋ଘࡏ΋୭ʹ΋൱ఆͰ͖ͳ͍ͷ͔ʁ
    ຊ౰ʹه࿥ͷ ͔֬͞Λ୭Ͱ΋֬ೝͰ͖Δ ͱݴ͑Δͷ͔ʁ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.8/34

    View full-size slide

  9. Ethereum ͱ͸ʁ
    Vitalik Buterin, “Ethereum White Paper: A NEXT GENERATION SMART
    CONTRACT & DECENTRALIZED APPLICATION PLATFORM”
    ϒϩοΫνΣʔϯٕज़ΛԠ༻
    ฏۉϒϩοΫִؒ໿ 15 ඵ
    ͦ͜ʹϓϩάϥϛϯάݴޠΛࡌͤΔ
    νϡʔϦϯά׬શ
    Dapps (୤தԝΞϓϦ/ۭதͰಈ࡞͢ΔΞϓϦ/தԝΛࣗಈԽ͢ΔΞϓϦ) ͷͨΊͷج൫
    ݱࡏͷۚ༥ɾ՟ฎܦࡁγεςϜΛ࣌୅஗Εʹ͠Α͏ͱ͢Δҙਤ͕ݟ͑Δ
    εϚʔτίϯτϥΫτͱ͸ͦ΋ͦ΋ͦ͏͍͏΋ͷ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.9/34

    View full-size slide

  10. 2. Ethereum ಋೖ
    ڭࡐ͸࣍ͷ؀ڥͰςετ͍ͯ͠·͢
    macOS (Mojave 10.14.5) + Homebrew
    Linux (Ubuntu 16.04)
    Windows 10 + Windows Subsystem for Linux (Ubuntu 16.04 ͱͯ͠ςετ)
    Ethereum ؀ڥͱͯ͠ solidity ͓Αͼ brownie Λ࢖༻͠·͢
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.10/34

    View full-size slide

  11. Solidity ͷΠϯετʔϧ
    Ethereum ͷεϚʔτίϯτϥΫτͷ։ൃݴޠͰ͢
    Πϯετʔϧํ๏
    http://solidity.readthedocs.io/en/latest/installing-solidity.html
    Linux (on Windows) Ͱ͸ “sudo apt”, macOS Ͱ͸ “brew” ͰͷΠϯετʔϧͰ͢
    solc 0.5.9 ͕Πϯετʔϧ͞Ε·͢ (6/5 ݱࡏ)
    ࣮ߦͰ͖Δ͜ͱΛ֬ೝ͠·͢
    $ solc --version
    Πϯετʔϧ͞ΕͨόʔδϣϯΛ֬ೝͯ͠Έ·͠ΐ͏
    ࠓճɺ࣮ࡍʹ࢖༻͢ΔίϯύΠϥ͸ brownie ͱҰॹʹΠϯετʔϧ͞ΕΔ py-solc-x Ͱ͕͢ɺ
    solc ͕ґଘ͢Δ؀ڥ (dependencies) ͕ඞཁͱͳΓ·͢ (ద੾ͳ solc ίϯύΠϥΛ py-solc-x ͕Πϯετʔϧ͠·͢)
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.11/34

    View full-size slide

  12. Python3 ͷΠϯετʔϧ
    macOS ͷ৔߹
    $ brew install python3
    Linux ͷ৔߹
    $ sudo add-apt-repository ppa:deadsnakes/ppa
    $ sudo apt update
    $ sudo apt install python3.7 python3.7-dev python3.7-venv python3.7-tk
    16.10 Ҏ߱ͷ൛Ͱ͸ python3(.7) Λͦͷ·· apt ͰΠϯετʔϧͰ͖·͢ɻ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.12/34

    View full-size slide

  13. macOS : ΋͠Ҏ߱ͷεςοϓͰ
    . . .
    macOS ʹ wget ͕ͳ͍ͱݴΘΕͨ৔߹ɺbrew ͰΠϯετʔϧ͍ͯͩ͘͠͞
    ·͋ɺແ͚Ε͹ࠓೖΕͪΌ͑͹Α͍Ͱ͢ΑͶ
    ͞Βʹ
    dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
    ͷΑ͏ʹͳΔ৔߹͸ɺҎԼΛࢼͯ͠Έ͍ͯͩ͘͞
    $ brew uninstall --force gettext
    $ brew install gettext
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.13/34

    View full-size slide

  14. Python Ծ૝؀ڥ (venv)
    macOS ͷ৔߹͸ ‘python3.7’ Λ ‘python3’ ͱಡΈସ͍͑ͯͩ͘͞
    $ python3.7 -m venv bbc1env
    $ source bbc1env/bin/activate
    (bbc1env) $ pip install -U pip
    bbc1env (ࠓޙ BBc-1 ΛΠϯετʔϧ͢ΔͨΊ) ͱ͍͏Ծ૝؀ڥΛͭ͘Γ·ͨ͠
    ௨ৗͷ࡞ۀ͸Ծ૝؀ڥ಺Ͱߦ͍·͢
    Ծ૝؀ڥ͔Βग़Δ৔߹͸࣍ͷίϚϯυΛ༻͍·͢ (ࠓ͸ग़·ͤΜ)
    (bbc1env) $ deactivate
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.14/34

    View full-size slide

  15. Ganache CLI ͷΠϯετʔϧ
    Ethereum ͷ RPC ΫϥΠΞϯτͰ͋Γςετ؀ڥͰ͢
    ·ͣ npm ΛΠϯετʔϧ͠·͢ (͓࢖͍Ͱͳ͍৔߹)
    macOS ͷ৔߹
    https://qiita.com/PolarBear/items/62c0416492810b7ecf7c Λ͝ࢀߟʹ
    Linux ͷ৔߹
    https://qiita.com/seibe/items/36cef7df85fe2cefa3ea Λ͝ࢀߟʹ
    ͦͯ͠ npm Λ࢖ͬͯ Ganache CLI ΛΠϯετʔϧ͠·͢
    $ sudo npm install -g ganache-cli
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.15/34

    View full-size slide

  16. Brownie ͷΠϯετʔϧ
    Python ʹΑΔ Ethereum ͷ։ൃɾςετ؀ڥͰ͢
    https://eth-brownie.readthedocs.io
    Brownie ΛΠϯετʔϧ͠·͢
    $ pip install eth-brownie
    version 1.0.0b7 ͕Πϯετʔϧ͞Ε·͢ (6/5 ݱࡏ)
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.16/34

    View full-size slide

  17. ϓϩδΣΫτͷॳظԽ
    ৽͍͠ϓϩδΣΫτΛͭ͘Γ·͢
    $ brownie init
    ࣮ߦ৔ॴΛج఺ͱͯ͠σΟϨΫτϦߏ଄͕࡞ΒΕ·͢
    Ͱ͕͢ࠓճ͸طଘͷςϯϓϨʔτΛ࢖ͬͯΈ·͠ΐ͏ (؆қͳ ERC-20 ࣮૷Ͱ͢)
    $ brownie bake token
    $ cd token
    ίϯύΠϧ͠·͢ (ίϯτϥΫτͷίʔυΛͪΐͬ͜ͱݟͯΈ·͠ΐ͏)
    $ brownie compile
    ςετ͠·͢ (ςετίʔυΛͪΐͬ͜ͱݟͯΈ·͠ΐ͏)
    $ brownie test
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.17/34

    View full-size slide

  18. ίϯιʔϧΛ࢖ͬͯΈ·͠ΐ͏
    Brownie ͷίϯιʔϧΛ࢖ͬͯɺςετ؀ڥͷঢ়ଶΛݟͯΈ·͢
    $ brownie console
    Ҏ߱ɺPython ΠϯλϓϦλͰૢ࡞Ͱ͖·͢
    >>> len(accounts)
    10
    >>> accounts[0].balance()
    100000000000000000000
    >>> quit()
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.18/34

    View full-size slide

  19. 3. εϚʔτίϯτϥΫτͱ Ethereum
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.19/34

    View full-size slide

  20. ڱ͍ҙຯͰޠΔ
    εϚʔτίϯτϥΫτͱ͸
    σδλϧʹදݱ͞ΕΔࢿ࢈Λ༧ΊఆΊΒΕͨϧʔϧʹैͬͯ
    ࣗಈతʹҠసͤ͞Δ࢓૊Έ
    ޠײͱ͸߹Θͳ͍
    ͔͠͠ɺ͜ͷڱٛͷҙຯʹ͸ҙຯ͕͋Δ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.20/34

    View full-size slide

  21. ޿͍ҙຯͰޠΔ
    εϚʔτίϯτϥΫτͱ͸
    ܖ໿ΛػցͰ࣮૷͢Δ࢓૊Έ
    ·ͨɺͦͷΑ͏ʹ࣮ͯ͠૷͞Εͨܖ໿
    ݪॳతʹ͸ࣗಈൢചػͳͲ΋εϚʔτίϯτϥΫτʹ౰ͨΔ
    ࣗಈൢചػ
    . . .
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.21/34

    View full-size slide

  22. ݱ࣮ vs. ϒϩοΫνΣʔϯ
    ࢥߟ࣮ݧ
    ϏοτίΠϯͰࢧ෷͏ͱɺ্ۭΛඈͿυϩʔϯ͕ӡΜͰ͖ͨ؈δϡʔεΛ
    མͱͯ͘͠ΕΔͱ͍͏αʔϏεΛ࡞Δͱ͢Δ
    υϩʔϯ͸͍ͭ؈δϡʔεΛམͱͤ͹Α͍ͷ͔ʁ
    ࣮࣌ؒͰਐߦ͢Δݱ࣮ͱɺϒϩοΫνΣʔϯͷಈ࡞͸͔͚཭Ε͍ͯΔ
    ͜ͷυϩʔϯʹΑΔࣗൢػͷྫ͸೿खͳ͚ͩ
    ී௨ͷࣗൢػͰ΋·ͬͨ͘ಉ͜͡ͱ͕ݴ͑Δ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.22/34

    View full-size slide

  23. ϒϩοΫνΣʔϯͱঢ়ଶભҠ
    ϒϩοΫνΣʔϯ = ঢ়ଶϚγϯͷ run
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.23/34

    View full-size slide

  24. ༻ޠମܥ
    Ether
    Ethereum ʹ͓͚Δ௨՟
    ֎෦ΞΫλʔ
    σδλϧॺ໊Ͱ͖Δ࣮ࡏͰɺΞΧ΢ϯτΛ΋ͭ
    EOA : Externally-Owned Account
    ࣗ཯ΦϒδΣΫτ
    γεςϜ಺Ͱࣗ཯ಈ࡞͠ɺΞΧ΢ϯτΛ΋ͭ
    ΞΧ΢ϯτ
    Ether ࢒ߴΛ΋ͪɺετϨʔδ΍ EVM ίʔυΛ΋ͯΔ
    EVM ίʔυ
    εϚʔτίϯτϥΫτͷϓϩάϥϜ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.24/34

    View full-size slide

  25. EVM : Ethereum Virtual Machine
    ࣗ཯ΦϒδΣΫτ͕ϝοηʔδΛड͚Δͱىಈ͠ɺίϯτϥΫτΛ࣮ߦɺঢ়ଶΛมԽͤ͞Δ
    ࣮ߦεςοϓຖʹ Gas ͷڙڅ͕ඞཁ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.25/34

    View full-size slide

  26. ϓϩάϥϛϯάݴޠ
    EVM ͕ղऍ͢Δͷ͸όΠτίʔυ
    ͦͷଞʹߴڃݴޠͷίϯύΠϥΛ༻ҙ
    ߴڃݴޠ : ਓ͕ؒಡΈॻ͖Ͱ͖Δݴޠ
    ྫ :
    Solidity — JavaScript ʹࣅͨݴޠ
    ݱࡏͷϓϥΠϚϦݴޠ
    LLL — Lisp ʹࣅͨݴޠ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.26/34

    View full-size slide

  27. Solidity αϯϓϧίʔυ (͜Ε͕ߴڃݴޠͩʂ)
    pragma solidity ˆ0.4.24;
    contract IndivisibleAsset { /* ෼ׂͰ͖ͳ͍ࢿ࢈ͷॴ༗ݖͷҠసΛ࣮ݱ */
    string public _name;
    string public _symbol;
    uint256 public _quantity;
    address public _owner;
    constructor (string name, string symbol, uint256 quantity) public {
    _name = name;
    _symbol = symbol;
    _quantity = quantity;
    _owner = msg.sender;
    }
    function transfer(address to) external returns (bool) {
    require(_owner == msg.sender);
    _owner = to;
    return true;
    }
    }
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.27/34

    View full-size slide

  28. ಛ௃ͱ՝୊
    ಛ௃
    ϒϩοΫͷݕূͷաఔͰϓϩάϥϜΛ࣮ߦ͠ɺ
    ͦͷ݁ՌΛঢ়ଶʹ൓өͤ͞Δ
    ෳ਺ͷݕূऀ͕৑௕ʹ࣮ߦ
    ϒϩοΫνΣʔϯͷதʹด͡Δ
    Ethereum ͷମܥͷதͰ͸੔߹త
    ՝୊
    ϓϩάϥϜͷத͔Βೖग़ྗίϚϯυΛग़ͤͳ͍
    ֎෦ΞΫλʔҎ֎ͷ֎քͷӨڹΛड͚ͨΓɺ
    ֎քʹ௚઀ӨڹΛٴ΅͢͜ͱ͕Ͱ͖ͳ͍
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.28/34

    View full-size slide

  29. 4. ॓୊ͷग़୊
    ࣍ճ·Ͱʹ Ethereum ͷ ropsten ςετωοτΛར༻Ͱ͖ΔΑ͏ʹ͠·͢
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.29/34

    View full-size slide

  30. infura.io ΞΧ΢ϯτऔಘͱ Brownie ͷઃఆ
    https://infura.io ʹ SIGN UP ͯ͠ɺPROJECT ID Λऔಘ͍ͯͩ͘͠͞
    infura ͸ Ethereum ϑϧϊʔυͷػೳΛ API Ͱఏڙ͢ΔαʔϏεͰ͢
    ։ൃ΍࣮ݧʹ͸Α͍Ͱ͕͢ɺϓϩμΫτʹ͸࢖͑ͳ͍ͱߟ͓͖͑ͯ·͠ΐ͏
    infura.io ͷࣗ͝਎ͷϓϩδΣΫτϖʔδ͔Βɺ
    ROPSTEN ༻ͷ ENDPOINT Λίϐʔ͍ͯͩ͘͠͞
    ͓खݩͷ Brownie ͷϓϩδΣΫτͷ “brownie-config.json” Λฤू͠·͢
    “networks” ͷதͷ “ropsten” ͷ “host” URL ͷ “ropsten.∼” ҎԼΛɺ
    ίϐʔͨ͠ ENDPOINT Ͱ্ॻ͖͍ͯͩ͘͠͞
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.30/34

    View full-size slide

  31. ropsten ΞΧ΢ϯτͷ࡞੒ͱ ETH ͷऔಘ
    brownie console Λ༻͍ͯ ropsten ༻ͷΞΧ΢ϯτΛ࡞੒͠·͢
    >>> network.disconnect()
    >>> network.connect(’ropsten’)
    >>> len(accounts)
    0
    >>> accounts.add()

    >>> accounts[0].private_key
    ͜͜ʹΞΧ΢ϯτͷൿີݤͷ 16 ਐ਺จࣈྻ͕දࣔ͞Ε·͢
    >>> quit()
    ॏཁʂΞΧ΢ϯτͱൿີݤΛͦΕͧΕίϐʔͯ͠อ؅͠·͠ΐ͏ʂ
    Ropsten Ethereum Faucet ͔Β 1ETH Λऔಘ͍ͯͩ͘͠͞
    https://faucet.ropsten.be ʹΞΫηε͠ɺ
    ΞΧ΢ϯτ (ൿີݤͰ͸͋Γ·ͤΜ) Λೖྗ͠·͢
    ͏·͍͔͘ͳ͍৔߹͸ https://metamask.io/Λར༻͢Δํ๏౳΋͋Γ·͢ͷͰɺௐ΂ͯࢼͯ͠Έ͍ͯͩ͘͞
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.31/34

    View full-size slide

  32. ropsten ETH ࢒ߴͷ֬ೝ
    brownie console Λ༻͍ͯ ropsten ༻ͷ ETH ࢒ߴΛ֬ೝ͠·͢
    >>> network.disconnect()
    >>> network.connect(’ropsten’)
    >>> len(accounts)
    0
    >>> accounts.add(͜͜ʹൿີݤͷ 16 ਐ਺จࣈྻΛϖʔετ͍ͯͩ͘͠͞)

    >>> accounts[0].balace()
    ͜͜ʹΞΧ΢ϯτͷ ETH ࢒ߴ͕දࣔ͞Ε·͢
    >>> quit()
    Ҏ্Λ࣍ճ·Ͱʹ͓ئ͍͍ͨ͠·͢ʂ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.32/34

    View full-size slide

  33. 5. BBc-1 ௒֓࿦ɺಋೖ͓Αͼςετ
    ҎԼͷϋϯζΦϯʹԊͬͯ΍ͬͯΈ·͢
    https://speakerdeck.com/beyondblockchain/bbc-1-hands-on-installation-and-file-content-proof
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.33/34

    View full-size slide

  34. ࣍ճͷ༧ࠂ
    ʮୈ2ճ BBc-1 ͱ Ethereum ԋशIʯ
    ࣮श՝୊: ূ໌ॻͷൃߦͱݕূͷγεςϜͮ͘Γ
    ࣮ફʂεϚʔτίϯτϥΫτϓϩάϥϛϯά — ୈ 1 ճ BBc-1 ͱ Ethereum ೖ໳ — 2019-06-05 – p.34/34

    View full-size slide