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

スマートコントラクトプログラミング(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

October 28, 2016
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

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

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

    > miner.stop() I — (4) – 2016-10-28 – p.6/51
  4. 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
  5. 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
  6. 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
  7. (4) . . . throw gas I — (4) –

    2016-10-28 – p.18/51
  8. 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
  9. (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
  10. (2) 1. BcH Coin 2. 5322 Endo, Fujisawa 3. 4.

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

    5322 Endo, Fujisawa Seller : Price : 30000 (300.00 ) I — (4) – 2016-10-28 – p.27/51
  12. (Hyperledger ) ( ) ( ) ( ) IoT /

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

    ) : 1EUR 1.13USD 0.79GBP 10,000EUR USD I — (4) – 2016-10-28 – p.38/51
  14. Hyperledger https://www.hyperledger.org Fabric : IBM DAH Sawtooth Lake : Intel

    Iroha : Hyperledger Whitepaper (WG page) I — (4) – 2016-10-28 – p.40/51
  15. 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
  16. 2016 12 6 ( ) 18:30-20:00 @ 20:00-20:30 ( )

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