Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

サービスデザインプロジェクトB 第1回「ブロックチェーン概論」 / Overview of B...

サービスデザインプロジェクトB 第1回「ブロックチェーン概論」 / Overview of Blockchain

2020年10月12日、慶應義塾大学大学院メディアデザイン研究科の「サービスデザインプロジェクトB (2020 秋)」第1回にて使用したスライドです。

Kenji Saito

October 12, 2020
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

  1. B 2020 1 ( ) B 2020 — 1 —

    2020-10-12 – p.1/56
  2. https://speakerdeck.com/ks91 ( ) ( . . . ) Discord Discord

    ( / / ) Zoom URL ( ) B 2020 — 1 — 2020-10-12 – p.2/56
  3. ( ) SFC ( ) CSO (Chief Science Officer) 1993

    ( ) 2006 ( ) SFC 20 P2P (Peer-to-Peer) ( 9 ) 2011 2018 2019 2019 2020 2020 → ( ) B 2020 — 1 — 2020-10-12 – p.3/56
  4. 2020 9 60 (2020) : . . . ( )

    . . . B 2020 — 1 — 2020-10-12 – p.4/56
  5. . . . ( ) 2018 1 2 2018 OK

    Google, Google ( ) Python (2020 ) ( ) ∈ Alexa, B 2020 — 1 — 2020-10-12 – p.5/56
  6. Alexa, ত࿨࣌୅ ੈلޙ൒ ࣾձγεςϜ ࣾձ؀ڥ ػց ٕज़ ਓؒ ࣗಈγεςϜ ྩ࿨࣌୅

    ੈلલ൒ ిؾ͚ͭͯ ͸͍ ͸͍ ిؾ͚ͭͯ ͜ͷ৚݅ͷͱ͖ ٕज़Ͱ͋Γࣾձ؀ڥˠࣗવ؀ڥ ਓ ⇒ ( ) B 2020 — 1 — 2020-10-12 – p.6/56
  7. (1/2) — World Wide Web SARS-CoV-2 COVID-19 2020 1990 World

    Wide Web End-to-End ( ) ( ) ( ) End-to-End ( ) 2008 B 2020 — 1 — 2020-10-12 – p.9/56
  8. (2/2) — 2020 ( ) B 2020 — 1 —

    2020-10-12 – p.10/56
  9. ← Python Flask (Python ) Ethereum Brownie (Python Ethereum )

    BBc-1 ( ) B 2020 — 1 — 2020-10-12 – p.11/56
  10. ( 2 ) ( ) Discord ( ) ( :

    ) . . . : ( ) : DApp ( ) B 2020 — 1 — 2020-10-12 – p.12/56
  11. ( ) 25% 25% 20% 30% ( ) B 2020

    — 1 — 2020-10-12 – p.13/56
  12. ( ) 1 10 12 • 2 10 19 3

    10 26 1 4 11 2 2 5 11 9 1 6 11 16 2 7 11 30 8 12 7 B 2020 — 1 — 2020-10-12 – p.14/56
  13. ( ) ( ) ( ) (BP : Blockchain Property

    ) BP-1 : BP-2 : BP-3 : ( ) ( ) B 2020 — 1 — 2020-10-12 – p.17/56
  14. ( ) (LIFO : Last In, First Out) ( )

    B 2020 — 1 — 2020-10-12 – p.18/56
  15. ( ) ( ) ( ) ( ) ( 16

    ) SHA (Secure Hash Algorithm) ( ) 1bit B 2020 — 1 — 2020-10-12 – p.19/56
  16. ( ) ( ) < , > ( ) ←

    : < , > : : < , , > : OK ( 1 ) NG ( ) B 2020 — 1 — 2020-10-12 – p.20/56
  17. BP-1 ( ), BP-2 ( ) BBc-1 f : →

    BP-3 ( ) ( ) ( ) ← BP-2 ← BP-3 ( ) ← BP-3 + ← BP-{1,2} B 2020 — 1 — 2020-10-12 – p.21/56
  18. [Lamport 1984][Schneider 1990] (1) (2) (3) (4) ( ) ←

    ↑ B 2020 — 1 — 2020-10-12 – p.22/56
  19. TX : transaction ( 4 TX ) SMRP (State Machine

    Replication Problem) SMRP-1 ( ) SMRP-2 : B 2020 — 1 — 2020-10-12 – p.23/56
  20. ( ) ( ) ϒϩοΫ൪߸O ϒϩοΫ൪߸O  ϒϩοΫ൪߸O  ϒϩοΫ൪߸O

     ϒϩοΫ൪߸O  ϒϩοΫ൪߸O  ϒϩοΫ൪߸O  ϒϩοΫ൪߸O  ͍ͪ͹Μه࿥ɾॻ͖׵͑ͷίετ͕ߴ͍ྺ࢙ ࠷΋վ͟Μ͠ʹ͍͘ྺ࢙ ͕༗ޮ ͻͱͭखલͷϒϩοΫͷ ʮμΠδΣετʯ σδλϧॺ໊͞Εͨ ʮτϥϯβΫγϣϯ औҾ ʯ ϒϩοΫΛ࡞ΔͨΊʹ͸ɺͦͷʮμΠδΣετʯ͕͋Δ਺ҎԼͱ͍͏৚݅Λຬͨͨ͠Γ 1SPPGPG8PSL Ծ૝௨՟ͷ࣋ͪ෼ʹԠͨ͡ݖརΛ࢖ͬͨ౤ථͰউͬͨΓ 1SPPGPG4UBLF ͢Δඞཁ͕͋Δ ίετ͕͔͔Δ ϒϩοΫΛ࡞Δਓ͸ͦͷதʹࣗ෼ʹѼͯͨ Ծ૝௨՟ͰͷใुΛॻ͖ࠐΉ͜ͱ͕Ͱ͖ɺ ͦͷϒϩοΫ͕༗ޮͳྺ࢙ͷதʹ͋Δ৔߹ʹ ݶΓใु΋༗ޮͱͳΔ τϥϯβΫγϣϯͷଘࡏΛ֬ೝ͢Δ ͨΊͷޮ཰తͳํ๏͕ఏڙ͞ΕΔ ਖ਼౰ੑ ଘࡏੑ །Ұੑ Proof of Work ( ) . . . → B 2020 — 1 — 2020-10-12 – p.24/56
  21. (BP-3 ) ( : ) (BP-3 ) ( : )

    BP-{1,2,3} BP-{1, 2} ⇒ B 2020 — 1 — 2020-10-12 – p.25/56
  22. ( ) ( ) ( ) B 2020 — 1

    — 2020-10-12 – p.29/56
  23. ( ) ( ) ( ) B 2020 — 1

    — 2020-10-12 – p.31/56
  24. / ( ) ( ) ( ) ( ) B

    2020 — 1 — 2020-10-12 – p.33/56
  25. ( ) ( ) ( ) B 2020 — 1

    — 2020-10-12 – p.34/56
  26. with ( ) ( ) ( ) B 2020 —

    1 — 2020-10-12 – p.38/56
  27. ( ) ( ) (web ) B 2020 — 1

    — 2020-10-12 – p.40/56
  28. ( ) ( ) ( ) ( ) ( )

    ( ) B 2020 — 1 — 2020-10-12 – p.41/56
  29. ( ) ( ) 3D B 2020 — 1 —

    2020-10-12 – p.42/56
  30. 2. Ethereum macOS (Catalina 10.15.7) + Homebrew Linux (Ubuntu 18.04)

    Windows 10 + Windows Subsystem for Linux (Ubuntu 18.04 ) Ethereum solidity brownie B 2020 — 1 — 2020-10-12 – p.43/56
  31. Solidity Ethereum http://solidity.readthedocs.io/en/latest/installing-solidity.html Linux (on Windows) “sudo apt”, macOS “brew”

    solc 0.7.3 (10/10 ) $ solc --version brownie py-solc-x solc (dependencies) ( solc py-solc-x ) B 2020 — 1 — 2020-10-12 – p.44/56
  32. 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 python3.8 B 2020 — 1 — 2020-10-12 – p.45/56
  33. macOS : . . . macOS wget brew dyld: Library

    not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib $ brew uninstall --force gettext $ brew install gettext B 2020 — 1 — 2020-10-12 – p.46/56
  34. Python (venv) macOS ‘python3.7’ ‘python3’ $ python3.7 -m venv bbc1env

    $ source bbc1env/bin/activate (bbc1env) $ pip install -U pip (bbc1env) $ pip install wheel bbc1env ( BBc-1 ) ( ) (bbc1env) $ deactivate B 2020 — 1 — 2020-10-12 – p.47/56
  35. Ganache CLI Ethereum RPC npm ( ) macOS https://qiita.com/kyosuke5_20/items/c5f68fc9d89b84c0df09 Linux

    https://qiita.com/seibe/items/36cef7df85fe2cefa3ea npm Ganache CLI $ sudo npm install -g ganache-cli B 2020 — 1 — 2020-10-12 – p.48/56
  36. $ brownie init ( ERC-20 ) $ brownie bake token

    $ cd token ( ) $ brownie compile ( ) $ pytest tests B 2020 — 1 — 2020-10-12 – p.50/56
  37. Brownie $ brownie console Python >>> len(accounts) 10 >>> accounts[0].balance()

    100000000000000000000 >>> quit() B 2020 — 1 — 2020-10-12 – p.51/56
  38. infura.io Brownie https://infura.io SIGN UP PROJECT ID infura Ethereum API

    infura . . . infura.io PROJECT ID Brownie “brownie-config.yaml” . . . YAML WEB3_INFURA_PROJECT_ID PROJECT ID (∼/.bash_profile ) $ export WEB3_INFURA_PROJECT_ID= PROJECT ID B 2020 — 1 — 2020-10-12 – p.53/56
  39. ropsten ETH brownie console ropsten >>> network.disconnect() >>> network.connect(’ropsten’) >>>

    len(accounts) 0 >>> accounts.add() <LocalAccount object ’ 16 ’> >>> accounts[0].private_key 16 >>> quit() Ropsten Ethereum Faucet 1.0ETH https://faucet.ropsten.be ( ) https://metamask.io/ B 2020 — 1 — 2020-10-12 – p.54/56
  40. ropsten ETH brownie console ropsten ETH >>> network.disconnect() >>> network.connect(’ropsten’)

    >>> len(accounts) 0 >>> accounts.add( 16 ) <LocalAccount object ’ 16 ’> >>> accounts[0].balace() ETH >>> quit() B 2020 — 1 — 2020-10-12 – p.55/56