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

Ethereumで開発を始めるなら知っておきたいこと

 Ethereumで開発を始めるなら知っておきたいこと

Ethereumが話題になっていますが、既存のweb開発やアプリ開発とは勝手が少し異なっています。また、色々な情報がネットには落ちているので混乱してしまいがちです。エンジニアだがEthereumはこれから触っていきたい、という人向けに整理しました。

Shuichi Nagao

July 24, 2018
Tweet

More Decks by Shuichi Nagao

Other Decks in Technology

Transcript

  1. Ψε୅ʹ͍ͭͯ TxΛ࣮ߦ͢Δʹ͸ϚΠφʔʹରͯ͠ख਺ྉΛ෷͏ඞཁ͕͋Δ ΞΧ΢ϯτεςʔτΛߋ৽͢Δʹ͸͓͕͔͔ۚΔ DBʹॻ͖ࠐΈ͢Δʹ͸౎౓՝͕ۚ૸Δɺͱ͍͏ΠϝʔδɻϢʔβ͕ෛ୲͢Δͷ ͔ɺαʔϏε͕ෛ୲͢Δͷ͔͸࣮૷࣍ୈ͕ͩɺϢʔβ͕ෛ୲͢Δͷ͕Ұൠత ෷͏ֹ = Gas Limit ×

    Gas Price Gas Limitɿফඅͯ͠΋ྑ͍Ψεྔͷ্ݶɻ࣮ࡍʹ࢖ΘΕΔྔ͸ίϯτϥΫτ࣍ୈ ͕ͩɺ௒ա෼͸ฦͬͯ͘Δɻྫ͑͹ɺETHͷૹۚ͸21000ʹͳΔ Gas Priceɿ෷͏࣌ͷ1୯Ґ͋ͨΓͷΨεͷྉۚɻࠓͩͱ3Gwei͘Β͍ɻΨε୅্͕ ͕͍ͬͯΔɺͱ͍͏ͷ͸ίΠπ্͕͕͍ͬͯΔͱ͍͏͜ͱ Gas LimitΛઃ͚Δ͜ͱͰແݶϧʔϓ͢ΔίϯτϥΫτΛ๷͛Δ 15
  2. ετϨʔδʹ͍ͭͯ ετϨʔδ͸͔ͳΓߴՁ Gas Price = 2Gweiͱͯ͠
 1GB͋ͨΓ1280ETH(7000ສԁऑ)ඞཁ AWS S3ͱൺ΂ͯ໿2700ສഒߴ͍ (ETH

    = 474USD) Ϋϥεͷϝϯόม਺Έ͍ͨʹɺίϯτϥΫτʹϓϩ ύςΟΛఆٛͯͦ͜͠ʹσʔλΛηοτ͍͚ͯͩ͘͠ 22
  3. Minimum Viable Tokenͷ࣮૷ pragma solidity ^0.4.20; contract MyToken { /*

    This creates an array with all balances */ mapping (address => uint256) public balanceOf; /* Initializes contract with initial supply tokens to the creator of the contract */ function MyToken( uint256 initialSupply ) public { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient return true; } } 23
  4. Minimum Viable Tokenͷ࣮૷ pragma solidity ^0.4.20; contract MyToken { /*

    This creates an array with all balances */ mapping (address => uint256) public balanceOf; /* Initializes contract with initial supply tokens to the creator of the contract */ function MyToken( uint256 initialSupply ) public { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient return true; } } ͜Ε͚ͩͰτʔΫϯ͸ग़དྷ্͕Γ 24