$30 off During Our Annual Pro Sale. View Details »

スマートコントラクトプログラミング(4) イーサリアム実習 II / Ethereum Exercise II, Smart Contract Programming 4

スマートコントラクトプログラミング(4) イーサリアム実習 II / Ethereum Exercise II, Smart Contract Programming 4

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

Kenji Saito
PRO

October 28, 2016
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

  1. II (4) SFC / CSO ks91@sfc.wide.ad.jp I — (4) –

    2016-10-28 – p.1/51
  2. 1. : 2. ∼ ∼ I — (4) – 2016-10-28

    – p.2/51
  3. 1. : 2. : 3. / I — (4) –

    2016-10-28 – p.3/51
  4. 1. : I — (4) – 2016-10-28 – p.4/51

  5. ( ) $ 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) I — (4) – 2016-10-28 – p.5/51
  6. ( ) geth > miner.start(2) true ‘2’ ( CPU )

    > miner.stop() I — (4) – 2016-10-28 – p.6/51
  7. Ethereum-Wallet “LAUNCH APPLICATION” I — (4) – 2016-10-28 – p.7/51

  8. (m2 ) 1 1 I — (4) – 2016-10-28 –

    p.8/51
  9. IndivisibleAsset string public _name; string public _symbol; uint256 public _quantity;

    address public _owner; _name ( ) _symbol _quantity (m2 ) _owner _ Solidity . . . I — (4) – 2016-10-28 – p.9/51
  10. IndivisibleAsset event Transfer(address indexed from, address indexed to); from to

    I — (4) – 2016-10-28 – p.10/51
  11. IndivisibleAsset function IndivisibleAsset(string name, string symbol, uint256 quantity) { _name

    = name; _symbol = symbol; _quantity = quantity; _owner = msg.sender; } I — (4) – 2016-10-28 – p.11/51
  12. IndivisibleAsset transfer() function transfer(address to) { if (_owner != msg.sender)

    { throw; } _owner = to; Transfer(msg.sender, to); } I — (4) – 2016-10-28 – p.12/51
  13. ( pragma solidity ˆ0.4.2; ) (300m2 ) I — (4)

    – 2016-10-28 – p.13/51
  14. I — (4) – 2016-10-28 – p.14/51

  15. (1) I — (4) – 2016-10-28 – p.15/51

  16. (2) select function Transfer To EXECUTE TX I — (4)

    – 2016-10-28 – p.16/51
  17. (3) _owner I — (4) – 2016-10-28 – p.17/51

  18. (4) . . . throw gas I — (4) –

    2016-10-28 – p.18/51
  19. (5) I — (4) – 2016-10-28 – p.19/51

  20. (6) To Execute from I — (4) – 2016-10-28 –

    p.20/51
  21. (7) I — (4) – 2016-10-28 – p.21/51

  22. 2. : I — (4) – 2016-10-28 – p.22/51

  23. transfer settle, retrieve asset, retrieve token 3 I — (4)

    – 2016-10-28 – p.23/51
  24. OneTimeEscrow settle() function settle() { address addr = this; /*

    this */ if (_token.getBalanceOf(this) < _price || _asset.getOwner() != addr) { throw; } _token.transfer(_seller , _price); _asset.transfer(_buyer); Settled(); /* */ } settle() transfer I — (4) – 2016-10-28 – p.24/51
  25. (1) 1. http://goo.gl/2ICiuu OneTimeEscrow.sol MyToken, IndivisibleAsset OneTimeEscrow 2. ( )

    3. MyToken (BcH Coin, BcH, decimals = 2) 4. IndivisibleAsset (5322 Endo, Fujisawa, 300 m2) 5. Account 2 300.00 BcH I — (4) – 2016-10-28 – p.25/51
  26. (2) 1. BcH Coin 2. 5322 Endo, Fujisawa 3. 4.

    Account 2 I — (4) – 2016-10-28 – p.26/51
  27. Token : BcH Coin Buyer : Account 2 Asset :

    5322 Endo, Fujisawa Seller : Price : 30000 (300.00 ) I — (4) – 2016-10-28 – p.27/51
  28. (1) Account 2 300.00 BcH I — (4) – 2016-10-28

    – p.28/51
  29. (2) 300.00 BcH I — (4) – 2016-10-28 – p.29/51

  30. (1) 5322 Endo, Fujisawa I — (4) – 2016-10-28 –

    p.30/51
  31. (2) 5322 Endo, Fujisawa I — (4) – 2016-10-28 –

    p.31/51
  32. (1) Select function Settle Execute from Account 2 I —

    (4) – 2016-10-28 – p.32/51
  33. (2) 300.00 BcH I — (4) – 2016-10-28 – p.33/51

  34. (3) Account 2 5322 Endo, Fujisawa I — (4) –

    2016-10-28 – p.34/51
  35. (4) Settled I — (4) – 2016-10-28 – p.35/51

  36. 3. / Hyperledger (Fabric) Chain Open Standard R3 Corda I

    — (4) – 2016-10-28 – p.36/51
  37. (Hyperledger ) ( ) ( ) ( ) IoT /

    / I — (4) – 2016-10-28 – p.37/51
  38. (Chain OS ) : USD ( ) USD 1 (

    ) : 1EUR 1.13USD 0.79GBP 10,000EUR USD I — (4) – 2016-10-28 – p.38/51
  39. ( ) ( ) I — (4) – 2016-10-28 –

    p.39/51
  40. Hyperledger https://www.hyperledger.org Fabric : IBM DAH Sawtooth Lake : Intel

    Iroha : Hyperledger Whitepaper (WG page) I — (4) – 2016-10-28 – p.40/51
  41. / I — (4) – 2016-10-28 – p.41/51

  42. (Fabric) (from Hyperledger Whitepaper) I — (4) – 2016-10-28 –

    p.42/51
  43. Chain Open Standard http://chain.com/os/ Nasdaq Linq → → → I

    — (4) – 2016-10-28 – p.43/51
  44. I — (4) – 2016-10-28 – p.44/51

  45. (Chain Core) HTTP+JSON API, RPC , I — (4) –

    2016-10-28 – p.45/51
  46. UTXO SBFT : Simplified Byzantine Fault Tolerance BFT I —

    (4) – 2016-10-28 – p.46/51
  47. R3 Corda Introducing R3 CordaTM: A Distributed Ledger Designed for

    Financial Services http://r3cev.com/s/corda-introductory-whitepaper-final.pdf I — (4) – 2016-10-28 – p.47/51
  48. Corda : : I — (4) – 2016-10-28 – p.48/51

  49. + CAP I — (4) – 2016-10-28 – p.49/51

  50. ⇒ ⇒ I — (4) – 2016-10-28 – p.50/51

  51. 2016 12 6 ( ) 18:30-20:00 @ 20:00-20:30 ( )

    : 30 : I — (4) – 2016-10-28 – p.51/51