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

スマートコントラクトプログラミング(2) イーサリアム(Ethereum)入門 / Introduction to Ethereum, Smart Contract Programming 2

スマートコントラクトプログラミング(2) イーサリアム(Ethereum)入門 / Introduction to Ethereum, Smart Contract Programming 2

ブロックチェーンハブ主催で開催しているブロックチェーン連続講義シリーズ「スマートコントラクトプログラミング」の第2回「イーサリアム(Ethereum)入門」のスライドです。2016年10月14日(金) に使用しました。

Kenji Saito
PRO

October 14, 2016
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

  1. (Ethereum)
    (2)
    SFC / CSO
    [email protected]
    (Ethereum) — (2) – 2016-10-14 – p.1/43

    View Slide

  2. 1.
    2.
    3.
    4.
    5.
    (Ethereum) — (2) – 2016-10-14 – p.2/43

    View Slide

  3. 1.
    2.
    3.
    4.
    5.
    (Ethereum) — (2) – 2016-10-14 – p.3/43

    View Slide

  4. 1.
    (Ethereum) — (2) – 2016-10-14 – p.4/43

    View Slide

  5. Vitalik Buterin, “Ethereum White Paper: A NEXT
    GENERATION SMART CONTRACT &
    DECENTRALIZED APPLICATION PLATFORM”
    12
    (Ethereum) — (2) – 2016-10-14 – p.5/43

    View Slide

  6. 2.
    Mac OS X (Yosemite 10.10.5) + Homebrew
    Linux (Ubuntu 14.04 Desktop)
    Windows 10
    geth (CLI) Ethereum-Wallet (GUI)
    Ethereum | NTT
    (Ethereum) — (2) – 2016-10-14 – p.6/43

    View Slide

  7. URL
    http://goo.gl/Xjluar
    (Ethereum) — (2) – 2016-10-14 – p.7/43

    View Slide

  8. geth
    GO
    https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum
    #installation-instructions
    geth 1.4.17-stable
    $ geth -help
    (Ethereum) — (2) – 2016-10-14 – p.8/43

    View Slide

  9. Ethereum-Wallet
    GUI
    https://github.com/ethereum/mist/releases
    Downloads ZIP
    geth
    ( )
    (Ethereum) — (2) – 2016-10-14 – p.9/43

    View Slide

  10. genesis.json
    {
    "nonce": "0x00006d6f7264656e",
    "difficulty": "0x200",
    "mixhash": "0x0000000000000000000000000000000000000064757
    2616c65787365646c6578",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000
    000000000000000000000000",
    "extraData": "0x",
    "gasLimit": "0x2FEFD8",
    "alloc": {
    }
    }
    “genesis.json”
    Windows geth.exe
    (Ethereum) — (2) – 2016-10-14 – p.10/43

    View Slide

  11. genesis.json cd
    Windows geth.exe
    $ geth init genesis.json
    “successfully wrote genesis block and/or chain rule set”
    (Ethereum) — (2) – 2016-10-14 – p.11/43

    View Slide

  12. $ geth --networkid 12345678 --port 50303 --maxpeers 0 --nodiscover console 2>> node.log
    >
    > exit
    $ tail -f node.log (Mac OS X, Linux)
    > Get-Content node.log -Wait -Tail 10 (Windows PowerShell)
    (Ethereum) — (2) – 2016-10-14 – p.12/43

    View Slide

  13. Ethereum-Wallet
    “LAUNCH APPLICATION”
    (Ethereum) — (2) – 2016-10-14 – p.13/43

    View Slide

  14. ADD ACCOUNT
    2
    (Ethereum) — (2) – 2016-10-14 – p.14/43

    View Slide

  15. (ETHERBASE) Ether
    (Ethereum) — (2) – 2016-10-14 – p.15/43

    View Slide

  16. geth
    > miner.start(2)
    true
    ‘2’
    ( CPU )
    > miner.stop()
    (Ethereum) — (2) – 2016-10-14 – p.16/43

    View Slide

  17. node.log
    DAG (Directed Acyclic Graph)
    Ether
    (Ethereum) — (2) – 2016-10-14 – p.17/43

    View Slide

  18. 3.
    (Ethereum) — (2) – 2016-10-14 – p.18/43

    View Slide

  19. (Ethereum) — (2) – 2016-10-14 – p.19/43

    View Slide

  20. . . .
    (Ethereum) — (2) – 2016-10-14 – p.20/43

    View Slide

  21. vs.
    (Ethereum) — (2) – 2016-10-14 – p.21/43

    View Slide

  22. = run
    (Ethereum) — (2) – 2016-10-14 – p.22/43

    View Slide

  23. Ether
    Ethereum
    EOA : Externally-Owned Account
    Ether EVM
    EVM
    (Ethereum) — (2) – 2016-10-14 – p.23/43

    View Slide

  24. EVM : Ethereum Virtual Machine
    Gas
    (Ethereum) — (2) – 2016-10-14 – p.24/43

    View Slide

  25. EVM
    :
    :
    Solidity — JavaScript
    LLL — Lisp
    (Ethereum) — (2) – 2016-10-14 – p.25/43

    View Slide

  26. Solidity
    contract metaCoin {
    mapping (address => uint) balances;
    function metaCoin() {
    balances[msg.sender] = 10000;
    }
    function sendCoin(address receiver, uint amount) returns(bool sufficient) {
    if (balances[msg.sender] < amount) return false;
    balances[msg.sender] -= amount;
    balances[receiver] += amount;
    return true;
    }
    }
    by hshimo
    (Ethereum) — (2) – 2016-10-14 – p.26/43

    View Slide

  27. (Ethereum) — (2) – 2016-10-14 – p.27/43

    View Slide

  28. 4.
    (Ethereum) — (2) – 2016-10-14 – p.28/43

    View Slide

  29. ADEPT
    ADEPT : IBM IoT
    (Ethereum) — (2) – 2016-10-14 – p.29/43

    View Slide

  30. (Ethereum) — (2) – 2016-10-14 – p.30/43

    View Slide


  31. (Ethereum) — (2) – 2016-10-14 – p.31/43

    View Slide

  32. The DAO ( )
    The DAO
    Split ( )
    360 ETH (50∼60 ) (6/17)
    ( )
    ( ; )
    (7/20 )
    (Ethereum) — (2) – 2016-10-14 – p.32/43

    View Slide

  33. 5.
    (Ethereum) — (2) – 2016-10-14 – p.33/43

    View Slide

  34. ADD ACCOUNT 2
    (Ethereum) — (2) – 2016-10-14 – p.34/43

    View Slide

  35. (1)
    CONTRACTS
    DEPLOY NEW CONTRACT
    (Ethereum) — (2) – 2016-10-14 – p.35/43

    View Slide

  36. (2)
    &
    https://ethereum.github.io/browser-solidity/?#gist=21935dc37c5bfbe92e5a
    &version=soljson-v0.4.1-2016-09-08-8a057e3.js
    (Ethereum) — (2) – 2016-10-14 – p.36/43

    View Slide

  37. (3)
    Pick a contract My Token
    _supply : 0 _name : BcH Coin
    _symbol : BcH _decimals : 0
    (Ethereum) — (2) – 2016-10-14 – p.37/43

    View Slide

  38. DEPLOY TX
    ( )
    12
    (Ethereum) — (2) – 2016-10-14 – p.38/43

    View Slide

  39. (1)
    WALLET
    Ether 1,000,000 BcH
    WALLET
    0 Ether
    (Ethereum) — (2) – 2016-10-14 – p.39/43

    View Slide

  40. (2)
    Transfer Ether & Tokens
    1 BcH
    BcH Coin
    AMOUNT 1
    (Ethereum) — (2) – 2016-10-14 – p.40/43

    View Slide

  41. (3)
    SEND TX
    (Ethereum) — (2) – 2016-10-14 – p.41/43

    View Slide

  42. WALLET
    BcH Coin 1 BcH
    (Ethereum) — (2) – 2016-10-14 – p.42/43

    View Slide

  43. I
    (Ethereum) — (2) – 2016-10-14 – p.43/43

    View Slide