åå㯠â Ethereum ã®ã¹ããŒãã³ã³ãã©ã¯ãã§å¯ŸæŠã²ãŒã ãäœããšã©ããªãã
1. Ethereum ã®ã¬ã¹ä»£ã¯äœæ é«ãã®ã
ååã®èšäºã§ãdApps察æŠã²ãŒã ãäœæããEthereumïŒã® Test NetworkïŒã«ãããã€ããŠåãã£ãäºã¯ã ãã®æ³å€ïŒãšèšã£ãŠãå·®æ¯ããªãã§ãããïŒãªææ°æã®ååšã§ãã ã1å10åããããªãã ããïœããšãæã£ãŠãŸãããçãã£ãã§ãã ãŸããæ°ååãšã¯ã»ã»ã»ã
äžç¬ãæ ãããŠãã®ããšãæããŸããããçŸç¶ã¯æ¬åœã«ãããªæãã¿ããã§ãã ããã ãã®ææ°æãæ¯æã£ãŠååŒããªãããŠããããã§ãã
ãªããããªã«ãææ°æãé«ãã®ã§ããããïŒ
ååã説æããŸããããEthereum ã® Gas Price ã¯åžå Žåçã«åºã¥ããŠçžå Žã圢æãããŠããŸãã ãããã¯ãŒã¯ã®ãã©ã³ã¶ã¯ã·ã§ã³åŠçèœåã«éçãããäžã§ãããé«ã Gas Price ãæ瀺ãããã©ã³ã¶ã¯ã·ã§ã³ãåªå åŠçãããããã çŽ æ©ãååŒãçµããããŠãŒã¶ãŒã¯ãå¹³åãããé«ãäŸ¡æ Œãæ瀺ããŠãã©ã³ã¶ã¯ã·ã§ã³ãäœæããŸãã å šãå²ã«åããªããããã® Gas Price ã«ãªãã°ååŒèªäœãããããŠãŒã¶ãŒãåºãŠæ¥ãã§ããããã Gas Price ã¯äžåã«äžãããªãã®ã§ãããã ãã®ææ°æãåé¡ã«ããªãååŒãçžåœæ°ååšãã蚌æ ã§ããããŸãã
ãã®åé¡ã®äžå¿ãšãªã£ãŠããäºæ ã¯ããããã¯ãŒã¯ã®åŠçèœåã«äŸçµŠéçãããäžã§éèŠãçå¢ããŠããäºã§ãã åŠçèœåãä¹ããã®ã¯ãçŸåšæ¡çšãããŠããåæ圢æã¢ã«ãŽãªãºã ã®ä»çµã¿ã«åå ããããŸãã
çŸåšæ¡çšãããŠããã®ã¯ PoWïŒProof of WorkïŒãšããèšç®éãå€ãã¢ã«ãŽãªãºã ã§ãã ãã®ã¢ã«ãŽãªãºã ã§ã¯ããããã¯ãŒã¯å šäœã§åŠçã§ãããã©ã³ã¶ã¯ã·ã§ã³æ°ãã1ç§åœããæ°å件çšåºŠã«ãããªããŸããã ãããŠãŸããããšã«ããããã¯ãã§ãŒã³ã®åæ£ãããã¯ãŒã¯ã¯ãæ¹ç«ãé²æ¢ããã»ãã¥ãªãã£èœåãé«ããšãã èšç®æ§èœãæ¡å€§ããã¹ã±ãŒãªã³ã°ã«é¢ããŠã¯å šãå¯äžããŸãããããŒãããããå¢ããããæ§èœã¯ã»ãšãã©å€ãããŸããã
ããŠããã®ç¶æ³ã¯ãã€ããŒã«ãšã£ãŠããããæ²é³Žã§ãã ã¬ã¹ä»£ã¯ãã®ãŸãŸãã€ããŒãžã®å ±é ¬ã«å ãŠããããããGas Price ãé«ããã°é«ãçšãããŒããåããç¶ããã¡ãªãããé«ãŸããŸãã ãã€ããŒã«ãšã£ãŠã¯ããã©ã³ã¶ã¯ã·ã§ã³ã®åŠçã«ãããæéã1åã ããã10åã ãããçŽæ¥çã«ã¯é¢ä¿ãªãã®ã§ éèŠãé«ãŸã£ãŠãããªãäŸçµŠãå¢ãããã«äŸ¡æ Œãé£ãäžããã»ããåŸçã§ãã ãããããããã¯ãŒã¯çãªåŠçéçã«éããŠããã®ã§ããã€ããŒèªèº«ã§ã¯äŸçµŠãå¢ããããããªãã®ã§ããã
ãŸãšãããšã
- ææ°æã¯äºå®äžã®æ䟡ã§ãããåžå Žåçã«åºã¥ããŠå¢æžãã
- ãããã¯ãŒã¯ã®åŠçèœåã¯éçããããäŸçµŠã¯ç°¡åã«å¢ãããªãä»çµã¿ã§ãã
- æå·è³ç£ããŒã ã§éèŠãçå¢ããŠãããå€å°ã®ææ°æã¯åé¡ãšãªããªããããã®äŸ¡å€ãæµéããŠãã
ãã®3ã€ã®èŠå ã«ãããäžè¬åº¶æ°ã«ã¯äžåœãšæãããããªäŸ¡å€èŠ³ãŸã§ã¬ã¹ä»£ãé«éš°ããŠããã®ã§ãã
1.1. ã¬ã¹ä»£ã決ãŸãä»çµã¿
ããé«ã Gas Price ãæ瀺ãããã©ã³ã¶ã¯ã·ã§ã³ãåªå ããŠåŠçããããšèª¬æããŸããã ã§ã¯ãGas Price ã¯ã©ã®ããã«æ±ºãŸãã®ã§ããããã ã»ãšãã©ã®äººã¯ãã¬ãœãªã³ã¹ã¿ã³ãããæ³åãããã®æã ã®å€æ®µãæ²ç€ºãããã®ã ãšèããã§ããããã«ãŒãäŒå¡ã¯ããå/Lã¿ãããªæãã§ã
å®éã¯ããã®ãããªå€æ®µã¯æ²ç€ºãããŸãããå€æ®µã¯ãŠãŒã¶ãŒã奜ãã«æ±ºããããŸãã 1 Unit ããã 1 Gwei ã§ãã©ã³ã¶ã¯ã·ã§ã³ãäœãããšãã§ããŸããã1 Unit ããã 1,000 GweiïŒ1 szaboïŒã§äœãããšãã§ããŸãã
åé¡ã¯ãåé ã§è¿°ã¹ããåªå åŠçãã§ãã å€æ®µã決ããããã«ã¯ãçŸåšã©ã㪠Gas Price ã®ãã©ã³ã¶ã¯ã·ã§ã³ãããããã¯ãŒã¯äžã«ããã€ååšãã äŸ¡æ Œåž¯ã«ãã£ãŠã©ããããã®åŸ ã¡æéã§ãã©ã³ã¶ã¯ã·ã§ã³ãå®äºããã®ãç¥ãå¿ èŠããããŸãã
ãã®çºããããã¯ãŒã¯ã§ã¯çŸåšã® Gas Price ãæšå®ãããGas Price Oracleããšããæ©èœãæäŸããŠããŸãã ãããã¯ãã§ãŒã³ãéå»ã«åãã£ãŠèµ°æ»ããçŽè¿ã®ååŒããçŸåšæå¹ãšæããã Gas Price ãæšå®ããŸãã ãŠãŒã¶ãŒã¯ãããããšã« Gas Price ãèšå®ããŠãã©ã³ã¶ã¯ã·ã§ã³ãäœæããããã§ãã
ãããã¯ãã§ãŒã³ã®æ å ±ã¯èª°ã§ãé²èŠ§ã§ããã®ã§ãWebäžã§ã¯ Gas Price ãæããŠããããµãŒãã¹ãããã€ãããã 代衚çãªã®ã¯ Etherscan ã® Ethereum Gas Tracker ã§ãã
Low SpeedãAverageãHigh Speed ã®3段éã«åã㊠Gas Price ãææ¡ããŠãããŸããååŒã®èŠä»¶ã«å¿ã㊠Gas Price ãéžã³ãŸãããã
ã¡ãªã¿ã«ãé£ã³æããŠé«ã Gas Price ãèšå®ãããããšèšã£ãŠ ãã¬ãã¢ã ãªãµãŒãã¹ãåããããããã§ã¯ãããŸããã
1.2. ã¬ã¹ä»£ãã±ãããšã©ããªãã
ãå¥ã«æéãæãã£ãŠããããã§ããããããªã«æ¥ãã§ãªããããšããç¶æ³ãªããã¬ã¹ä»£ã 1 Gwei ã«èšå®ããã°ããã®ã§ã¯ããšæãæ¹ãããã§ãããã
ããã«ã€ããŠã¯ Etherscan ã§é¢çœããã®ãèŠãããŸãã Pending TransactionããèŠãŠã¿ãŸãããã æ€åŠã«ã¯é¢æ§ãã®éããã©ã³ã¶ã¯ã·ã§ã³éã䞊ã³ãŸãã極å°ã® Gas Price ã§ãã©ã³ã¶ã¯ã·ã§ã³ãéãã¹ãã4æ¥ã5æ¥ãåŸ æ©ãç¶ãããã©ã³ã¶ã¯ã·ã§ã³éãã
ãLast Seenãåã® (!) ã«ããŠã¹ãªãŒããŒããäºã§ãã³ãã£ã³ã°ãããŠããæ¥æ°ãããããŸãã
ãã®ããã«å®ããã Gas Price ã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯åŸåãã«ããç¶ãããã€ãŸã§çµã£ãŠãåŠçãããªããšããç¶æ³ã«é¥ããŸãã ãããã®ãã©ã³ã¶ã¯ã·ã§ã³ãäœæåŠçãããã®ãã¯ãäžåã®ä¿èšŒããããŸããã
ãã€ãåŠçããããããããªããããããªããããããªãã ããæè¿ã®æ··ã¿å ·åã ãšããããªãå¯èœæ§ã極ããŠé«ãããïŒ
ãšããã§ãããªãã®ã¢ã«ãŠã³ãã«ãã³ãã£ã³ã°ãããç¶æ ã®ãã©ã³ã¶ã¯ã·ã§ã³ãããå Žåããã®ã¢ã«ãŠã³ãã§ã¯ããã以éã®åŠäœãªããã©ã³ã¶ã¯ã·ã§ã³ããã³ãã£ã³ã°ãããŸãã ãã©ã³ã¶ã¯ã·ã§ã³ã«ã¯ nonce ãšããéãçªå·ãæ¯ãããå¿ ã nonce ã®é çªã«åŠçãããŸããããããåã® nonce ã®ãã©ã³ã¶ã¯ã·ã§ã³ãæ¿èªããããŸã§ã Ethereum ãããã¯ãŒã¯ã§ååŒããããšãåºæ¥ãªããªããŸãã
ãã ãããã®ç¶æ³ãæãåºãè¡ãç¡ãèš³ã§ã¯ãªããåã nonce ã§ãã©ã³ã¶ã¯ã·ã§ã³ãäžæžãããããšãåºæ¥ãŸãã åŸã£ãŠãåãååŒå 容ãåã nonce ã§ãGas Price ã ãå¢é¡ãããã©ã³ã¶ã¯ã·ã§ã³ãçºè¡ãããã 0 ETHãééãããã©ã³ã¶ã¯ã·ã§ã³ã«å·®ãæ¿ããŠãã£ã³ã»ã«ãããšèšã£ãæ¹æ³ã§ç¶æ³ãæéããŠãã ããã
ãŸãšãããšãEthereum ã®ãããã¯ãŒã¯ã§ããŸããã£ãŠããã«ã¯ãGas Price ã¯é©åãªå€ã«èšå®ããŸãããããšããäºã§ãã
1.3. ã¬ã¹ä»£ã¯ããå®ããªããªãã®ïŒ
ãããã¯ãã§ãŒã³ã«ç¶æ ãã³ãããããéã®ã¬ã¹ä»£ã¯é¿ããããŸããã ããã¯å€ããããªã倧èªç¶ã®æçã§ãã
ããããå°æ¥çã« Ethereum 2.0 ã§åæ圢æã¢ã«ãŽãªãºã ãå€æŽãããã·ã£ãŒãã£ã³ã°ãå°å ¥ãããããããã©ã³ã¶ã¯ã·ã§ã³åŠçèœåãé£èºçã«åäžãããšãããŠããŸãã
çŽè¿ã®æ¹åãšããŠã¯ã7æé ã«äºå®ãããŠããã¢ããããŒãïŒããã³ãã³ããšåŒã°ããŠããïŒã§å®è£ ãããããããã¯ãŒã¯ã®èŸŒã¿å ·åã§äžäžããæšæºã®ææ°æãæããããŸãã ãŸããã¬ã¹ä»£ãšããŠæ¯æããã Ether ã®äžéšãçŒåŽãããããšã«ãã£ãŠããã€ããŒã«æ¯æãããå ±é ¬ãæããããäºã«ãªããŸãã
æçµçã«ã©ãããããŸã§äžããã®ãã¯åãããŸããããçŸå®çãªç¯å²ãŸã§èœãšã蟌ãããšãç®æããŠããã§ããããããçè ã¯ããçšåºŠã®æåŸ ãããŠããŸãã
2. Ethereum ã®ã¬ã¹ä»£ãç¯çŽããæ¹æ³
ãšã¯èšããdApps ãéçºããããã§ãçŽè¿ã®ã¬ã¹ä»£åé¡ã解決ããæ¹æ³ã暡玢ããªããã°ãªããŸããã å€ãã®å Žåãçæçãªããšããããã®ã解決çãå°å ¥ããŠããŸãã
ãã®ãã¹ãŠããEthereum ã®å€ã«ãã©ã³ã¶ã¯ã·ã§ã³ããªãããŒããããã¬ã€ã€ãŒ2ããšåŒã°ããææ³ã§ãã
2.1. 代æ¿ã®æ¹æ³ã§è¿œåãããã®ã¯ãã»ãã¥ãªãã£ã®ç¢ºä¿ã
æè¡çã«èšãã°ãã¬ã€ã€ãŒ2ã§åŠçããŠçµæããã¬ã€ã€ãŒ1ïŒEthereum ãããã¯ãã§ãŒã³ïŒãã«åæ ããããšèªäœã¯ã 幟ãã§ãã»ã©ã®æ§ã«ã§ãå®è£ å¯èœã§ãæè¡çãªèª²é¡ã¯ãããŸããã
åé¡ã¯ã»ãã¥ãªãã£ã§ããããããã¯ãã§ãŒã³ãããã©ã¹ãã¬ã¹ïŒçžæãä¿¡çšããå¿ èŠããªãäºïŒããåæãšããŠããç¹ã§ãã ãŠãŒã¶ãŒã¯äžæ£ããããããããªããšããæ§æªèª¬ã«ç«ã£ãä»çµã¿ã«ããªããã°ãªããŸããã
åŸã£ãŠãå šãŠã®æè¡ç課é¡ã¯ãåŠäœã«äžæ£ãé²ãã§ååŒå±¥æŽã®æ£åœæ§ãä¿ã€ãïŒãããã¯åŠ¥åãããïŒãã«æããŸãã
2.2. ãã£ã³ãã«
åå è A ãš B ã®éã«å°çšã®ååŒãã£ã³ãã«ãéããŸãã ãã£ã³ãã«ã®å®è£ ã¯ãªããã§ãŒã³ïŒEthereum å€ïŒã§è¡ããããã£ã³ãã«ãéãããŠããéã¯ãã®äžã ãã§èªç±ã«ååŒãå±éã§ããŸãã ãã£ã³ãã«ãéãéã« Ether ãããŒã¯ã³çã®è³ç£ãã³ã³ãã©ã¯ãã«ãããžããïŒããã¯ããéããæïŒEthereum ã«çµæãåæ ããæïŒã«æž ç®ããããã æäœã§ã 2 ãã©ã³ã¶ã¯ã·ã§ã³åã®ã¬ã¹ä»£ãããããŸãã çæ¹ãäžæ£è¡çºãåããå Žåã¯ãããçæ¹ãäžæ£ã蚌æããäºã§ã³ã³ãã©ã¯ãã«ããã¯ãããè³ç£ãåãæ»ãããšãåºæ¥ãŸãã ã€ãŸãããããã»ãã¥ãªãã£ãšãªããäžæ£ãããããšã«ã¯ãäžæ£ããåŽããããžããããè³ç£ã倱ããšãããªã¹ã¯ãè² ãæ°å¥œã«ãªããŸãã
èšããŸã§ããªãäºã§ãããçµæãåæ ããã«ã¯åå è äž¡åã®åæãå¿ èŠã§ãã ä»ã®æå·è³ç£ïŒäŸïŒBitcoinïŒã®å Žåã¯ããã«ãã·ã°ãšãããã¢ã¯ã»ã¹ã«è€æ°ã®çœ²åãå¿ èŠãšããã¢ã«ãŠã³ããçšããŠå šåå è ã®åæãåŸãã®ã§ããã Ethereum ã®å Žåã¯ãã«ãã·ã°ã®æ©èœããªãçºãã¹ããŒãã³ã³ãã©ã¯ãã§ä»£çšããŸãã
2.3. ãµã€ããã§ãŒã³
ãµã€ããã§ãŒã³ã¯ãã¡ã€ã³ãã§ãŒã³ãšãªã Ethereum ãããã¯ãã§ãŒã³ãšäºææ§ãæã€ãããã¯ãã§ãŒã³ãå¥ã«äœãææ³ã§ãã
ã¡ã€ã³ãã§ãŒã³äžã§ãµã€ããã§ãŒã³ã«è»¢éãããè³ç£ãããã¯ãããµã€ããã§ãŒã³äžã§ä»»æã®ãã©ã³ã¶ã¯ã·ã§ã³ãå®äŸ¡ãªææ°æãæ¯æã£ãŠå±éããŸãã æçµçã«è³ç£ãã¡ã€ã³ãã§ãŒã³ãžæ»ãå Žåã¯ããµã€ããã§ãŒã³ã§è³ç£ãçŒåŽããçŒåŽãã蚌æãã¡ã€ã³ãã§ãŒã³ã«æåºããããšã§ãããã¯ãããè³ç£ã解æŸãããŸãã
ããªããžãšãªãã¡ã€ã³ãã§ãŒã³äžã®ã³ã³ãã©ã¯ãããã¹ãŠã®è³ç£ã®åºå ¥ããç£èŠããŸãããã蟻è€ãåãä»çµã¿ã§ãã
ããŒã¯ã³çã®è³ç£ã¯å¿ ãã¡ã€ã³ãã§ãŒã³ãšãµã€ããã§ãŒã³éã§1察1ã®ãããã³ã°ããããŠããªããã°ãªããŸããã ã€ãŸãããµã€ããã§ãŒã³ã ãã§è³ç£ãçã¿åºãããããšã¯ãããŸããã
ã¡ã€ã³ãã§ãŒã³ããèŠãã»ãã¥ãªãã£ã¯è³ç£ã®éç蟻è€ã®ä¿èšŒã ãã§ãååŒã®å 容ïŒã€ãŸããµã€ããã§ãŒã³å ã®ãã©ã³ã¶ã¯ã·ã§ã³ïŒã«ã¯é¢ç¥ããŸããã å©çšè ããã¿ãã»ãã¥ãªãã£ã¯ããµã€ããã§ãŒã³ãæ¡çšããåæ圢æã¢ã«ãŽãªãºã ãšãããã¯ãŒã¯éçšã«å·Šå³ãããŸãã ãµã€ããã§ãŒã³ã®éå¶ã¯ãã»ãšãã©ãäžå€®éæš©çãšãªããŸãã
2.4. Plasma
Ethereum ã®ãããã¯ãã§ãŒã³ãã«ãŒããã§ãŒã³ãšãããã®åãšãªããµããã§ãŒã³ïŒPlasmaãã§ãŒã³ïŒãäœæãã æ¬æ¥ã«ãŒããã§ãŒã³ã§åŠçãããã¹ããã©ã³ã¶ã¯ã·ã§ã³ãPlasmaãã§ãŒã³ã«ãªãããŒãããŸãã
ãããŸã§ã¯ãµã€ããã§ãŒã³ãšåãã§ããã ãããã¯ããããŒã«ããããŒã¯ã«æšãæ§æããããšã«ãããPlasmaãã§ãŒã³ã®äžã«æŽã«Plasmaãã§ãŒã³ãäœãããšãåºæ¥ãŸãã Plasmaãã§ãŒã³ããã¯ã«ãŒããã§ãŒã³ãžã¯ïŒè² è·ããããªãæ§ã«æ§ããã«ïŒãããã¯ããããŒãéç¥ããã®ã§ãã»ãã¥ãªãã£ãã«ãŒããã§ãŒã³ã«ãã£ãŠä¿è·ãããŸãã
Plasmaãã§ãŒã³ã®å®äœã¯ã«ã¹ã¿ã ããããããã¯ãã§ãŒã³ããã°ã©ã ã§ãããä»»æã®æ©èœãå®è£ ã§ããŸãã
ãµã€ããã§ãŒã³ãšã®éãã¯ãåžžã«ã«ãŒããã§ãŒã³ã«å ±åããããšã§ã»ãã¥ãªãã£ã確ä¿ããŠããç¹ãšã ã«ãŒããã§ãŒã³ïŒEthereumïŒã§åãããŠããã¹ããŒãã³ã³ãã©ã¯ãããã£ãããã®ãŸãŸåãããã§ã¯ãªããšããç¹ã§ãã
ã«ãŒããã§ãŒã³ã«è³ç£ãæ»ãå Žåã¯ãç°è°ç³ãç«ãŠæéãšããŠãæ°æ¥ïŒ7æ¥ãã14æ¥ïŒãèŠããŸãã äžæ£ããã£ãå Žåã¯ãäžæ£ã®èšŒæ ãã«ãŒããã§ãŒã³ã«æåºããããšã§ãäžæ£ãããã¯ã®çŽåã«å·»ãæ»ããŸãã
äžèšã¯éåžžã«ãã£ãããšãã Plasma ãã¬ãŒã ã¯ãŒã¯ã®èª¬æã§ããããã®å®è£ ã¯å€æ§ã«ååšããŸãã Plasma ãšããåºæã®å®è£ ã¯ãããŸããã
æããã¬ã¹ä»£ã¯å®è£ ã«ãã£ãŠãŸã¡ãŸã¡ã§ãããæäœã§ãPlasmaãã§ãŒã³ãžã®è³ç£ç§»è¡ãšã«ãŒããã§ãŒã³ãžã®åŒåºãç³è«ã«ãããã1åãã€ã ç°è°ç³ç«æéåŸã®åŒåºããå«ããŠãåèš3ååã®ã¬ã¹ä»£ãçºçããŸãã ãŸããPlasmaãã§ãŒã³ã«ãããŠãïŒéåžžã«å®äŸ¡ã ãšã¯æããŸããïŒå¹Ÿèš±ãã®å©çšæãæããäºã§ãããã
ã»ãã¥ãªãã£ã¯ãã«ãŒããã§ãŒã³ã«æ ä¿ãããŸãããPlasmaãã§ãŒã³ã®éå¶ã«ã¯äžå€®éæš©ççµç¹ãé¢ããããšãšãªããŸãã
2.5. Rollups
Rollups ã¯ç°¡åã«èšãã°ã1 åã«å€ãã®ãã©ã³ã¶ã¯ã·ã§ã³ãè©°ã蟌ãã§éä¿¡ããã¡ã€ã³ãã§ãŒã³ã® Rollups ã³ã³ãã©ã¯ãå ã§å解ããŠæ€èšŒãããäºã§ãã ãã©ã³ã¶ã¯ã·ã§ã³ã®å®è¡ã¯ã¬ã€ã€ãŒ2ãšãªããªããã§ãŒã³ãŸãã¯ãµã€ããã§ãŒã³ã§è¡ããç¶æ ã Rollups ã³ã³ãã©ã¯ãã«éç¥ããŸãã ãŠãŒã¶ãŒãè³ç£ãã¬ã€ã€ãŒ2ã«ç§»åãããå¿ èŠãããã®ã¯ããããŸã§ã®ææ³ãšåãã§ãã ã€ãŸãã¬ã€ã€ãŒ2ãžã®ç§»è¡ãšåŒåºãã®æäœ 2 åã¯æ£èŠã®ã¬ã¹ä»£ãæãããŸãã
Rollups ãå®çŸãããããã« 2 çš®é¡ã®ãŠãŒã¶ãŒãå¿ èŠãšãªããŸãã1 ã€ã¯ãã©ã³ã¶ã¯ã¿ã§ããã 1 ã€ããªã¬ã€ã€ãŒïŒã¢ã°ãªã²ãŒã¿ãŒãšãïŒã§ãã ãã©ã³ã¶ã¯ã¿ã¯ããã®åã®éããã©ã³ã¶ã¯ã·ã§ã³ãäœæããŠãããã¯ãŒã¯ã«éä¿¡ããŸãã ãªã¬ã€ã€ãŒã¯å€ãã®ãã©ã³ã¶ã¯ã·ã§ã³ã 1 ã€ã«çºãäžãããããŒã«ã¢ããããå®è¡ããŸãã ãã©ã³ã¶ã¯ã¿ã¯ãªã¬ã€ã€ãŒã«ææ°æãæ¯æãããªã¬ã€ã€ãŒã Ethereum ã®ã¬ã¹ä»£ãæããŸãã è€æ°ã®ãã©ã³ã¶ã¯ã·ã§ã³ãäžæã«åŒãåãããªã¬ã€ã€ãŒãæãã¬ã¹ä»£ã¯å®ããªãã®ã§ããã 仮㫠1 åã®ããŒã«ã¢ããã§æ°çŸä»¶ã®ãã©ã³ã¶ã¯ã·ã§ã³ãçºããããã°ã ãã©ã³ã¶ã¯ã·ã§ã³ 1 ã€ã«ãããã¬ã¹ä»£ã¯åäœã§æ¯æããããå®ããªããŸãã ãŸãããªã¬ã€ã€ãŒã«ã¯èª°ã§ããªããŸãããäžæ£ãé²æ¢ãã芳ç¹ããããªã¬ã€ã€ãŒãšãªãã«ã¯äžå®ã®è³ç£ã Rollups ã³ã³ãã©ã¯ãã«é ããå¿ èŠããããŸãã
çŸåšãRollups ã«ã¯ã»ãã¥ãªãã£ã®å®è£ ã«éããããäºéãã®çš®é¡ããããŸãã ãŒãç¥è蚌æïŒZero knowledgeãZK ãšãïŒRollupsãšã楜芳çïŒOptimisticïŒRollupsã§ãã åè ã¯ãã©ã³ã¶ã¯ã·ã§ã³æ¯ã« Rollups ã³ã³ãã©ã¯ãã§æ€èšŒãè¡ãæ¹åŒã§ã åŸè ã¯ãã©ã³ã¶ã¯ã·ã§ã³ã楜芳çã«åæ±ããæ¯åºŠã®æ€èšŒã¯è¡ãããçµæã«ç°è°ãåºãå Žåã®ã¿æ€èšŒãè¡ãæ¹åŒã§ãã
Optimistic rollups 㯠CALLDATA ãšåŒã°ããã³ã³ãã©ã¯ãåŒã³åºãããŒã¿ãã ãã®ãŸãŸã¡ã€ã³ãã§ãŒã³ã«ä¿åããŠããã ããªã®ã§å®è£ ã«ãã¬ãã·ããªãã£ãããã OVM ãšãã EVM äºæã®ä»®æ³ãã·ã³ãéçºããããããã¬ã€ã€ãŒ2ã§ä»»æã®ã³ã³ãã©ã¯ããå®è¡åºæ¥ãããã«ãªããŸããã
ãã ããæ€èšŒã¯è¡ãããŠããªãã®ã§ãã¬ã€ã€ãŒ1ã«è³ç£ãåŒãåºãéãPlasmaãšåæ§ã«ç°è°ç³ãç«ãŠã®æéïŒ1é±éïœïŒãèšããå¿ èŠããããŸãã ç°è°ç³ãç«ãŠã«ã¯ãã¡ã€ã³ãã§ãŒã³ã«ä¿åããã CALLDATA ãå床å®è¡ããŠåãçµæã«ãªããïŒãããã¯ç°ãªããïŒã蚌æããæ¹æ³ãçšããããŸãã
ZK rollups ã¯ãä»ã®ãšããç°¡åãªè»¢éããåãã£ãŠæ±ºããããåŠçã«éãããŸããã ãã©ã³ã¶ã¯ã·ã§ã³ã¯åžžã«æ€èšŒæžã¿ãªã®ã§ãè³ç£ãçŽ æ©ãã¬ã€ã€ãŒ1ã«æ»ãäºãåºæ¥ãŸãã ãŸããä»åŸæè¡éçºãé²ãã°ãZK rollups ã§ãä»»æã®ã³ã³ãã©ã¯ããå®è¡ã§ããå¯èœæ§ããããŸãã
3. ã©ããäžçªãã¹ããïŒ
åã« 1 åã ãã®ååŒãèããå Žåãã©ã®æ§ãªæ段ãåã£ããšããŠãåãã ãã¬ã¹ä»£ãæãããŸãã ã¹ã±ãŒã«ã¡ãªãããçãŸããã®ã¯ãäœåºŠãååŒããäºãæ³å®ããå Žåã§ãã äžæŠè³ç£ããããžããããŠããŸãã°ãåŸã¯ã¬ã€ã€ãŒ2ã§åŠçããäºã«ãããå®äŸ¡ãªææ°æã§ç¹°ãè¿ãååŒããããšãåºæ¥ãŸãã
ç¿»ã£ãŠçºããŠã¿ãã°ãã»ãã¥ãªãã£ã®éãã ãã§ãã©ããæ¹æ³ãšããŠã¯äžé·äžçãšãã£ãå°è±¡ã§ãã
ãããã®äžã§ãæã Ethereum ãããã¯ãŒã¯ã®å ç¢æ§ã®æ©æµãåããããã®ã¯ ZK rollups ã ãšæããŸãã
察ããŠæãã¹ã±ãŒã«ããã®ã¯ãµã€ããã§ãŒã³ããŸãã¯Plasmaã§ãã ã¬ã€ã€ãŒ2ãåŠäœæ§ã«ãå®è£ ã§ããã®ã§ã倧æ決æžäŒç€ŸäžŠã¿ã®ã¹ã«ãŒããããå®çŸããããšãå¯èœã§ãã æ°åãè¯ããã°ææ°æãåªã«ããããšãã§ããŸãã
ãããããµã€ããã§ãŒã³ã¯äžå€®éæš©çã§ãåºæ¬çã«Ethereumã®ã»ãã¥ãªãã£ããæ©æµãåããããŸããã
ãã£ã³ãã«ã¯ãããããªãŒãã³åå ãåºæ¥ãªãã®ã§è«å€ãšããŠã Plasma ã¯äžå€®éæš©çã§ãéäžã®ãã©ã³ã¶ã¯ã·ã§ã³ããŒã¿ãã¡ã€ã³ãã§ãŒã³ã«å ¬éãããªãïŒå¯çšæ§ãäœãïŒãšããåé¡ãããã ã«ãŒããã§ãŒã³ã«å®æå ±åãããšèšã£ãæ§ãªå®è£ ã®æéãå€ããã§ãã Optimistic rollups 㯠Plasma ã®ãã¡ãªããã解æ¶ããæ¹æ³ãšèšããŸãã
ZK rollups ã¯çºå±éäžãšèšã£ãç¶æ³ãèžãŸãããšãä»ã®ãšããã®æé©è§£ãšããŠã¯ãOptimistic rollupsãããªãšæããŸããã
Optimistic rollups ã¯å®è£ ãã»ãŒçµãã£ãŠããŸãããã¡ã€ã³ãããã§ã®çšŒåã¯äžéšã®ã¢ããªã±ãŒã·ã§ã³ã«éå®ãããŠããŸãã ãã¹ããããã¯è§£æŸãããŠããã®ã§ãä»åã¯ãOptimistic rollupsãã®å°å ¥ãé²ããŠã¿ãããšæããŸãã
DeJunkeng ã¿ãããªã»ãã¥ãªãã£ãªããŠã©ãã§ããããã㪠dApps ã¯ããµã€ããã§ãŒã³ãã§ããããããšæããããããããŸãããã DeJunkeng ã¯ãããŸã§ããµã³ãã«ãªã®ã§ããããã¯ã»ãã¥ãªãã£ãéèŠãªã¢ããªã§ããããšããåæã§èããŸãã
ãšèšããããµã€ããã§ãŒã³ã䜿ããªãæ®éã® Web ã¢ããªãšããŠå®è£ ã㊠Firebase 蟺ãã«ãããã€ããã»ã»ã»
4. DeJunkeng ã«å°å ¥ããŠã¿ã
ããã§ã¯å®éã« Optimistic rollups ã®å®è£ ã§ãã Optimistic Etehreum ã䜿çšããŠã DeJunkeng ãã¬ã€ã€ãŒ2ã«ãªãããŒãããŠã¿ãããšæããŸãã
DeJunkeng 㯠GitHub ãªããžããªã® master ãã©ã³ã ããä¿®æ£ãå ããæ³å®ã§èª¬æããŸãã
ã¢ãŒããã¯ãã£ãšããŠã¯ä»¥äžã®æ§ã«ãªããŸãã
4.1. ã¹ããŒãã³ã³ãã©ã¯ããä¿®æ£
Optimistic rollups ã§ã¯ãOVMãšããEVMïŒEthereum Virtual MachineïŒäºæã®ããŒãã£ã«ãã·ã³ã§ã¹ããŒãã³ã³ãã©ã¯ããå®è¡ã§ããŸãã ãããã¯å³å¯ã«èšãã°éãç©ãªã®ã§ãEVMçšã®Solidityã³ã³ãã€ã©ã§ã³ã³ãã€ã«ãããã€ãã³ãŒãã¯å®è¡ã§ããŸããã ãããã£ãŠãã¬ã€ã€ãŒ2ã«ãããã€ããã¹ããŒãã³ã³ãã©ã¯ãã¯OVMçšã®å°çšã³ã³ãã€ã©ã§ã³ã³ãã€ã«ããŸãã
4.1.1. JunkCoinDepositedERC20.sol
ãŸããã¬ã€ã€ãŒ2 㧠JunkCoin ããŒã¯ã³ã管çããã³ã³ãã©ã¯ã JunkCoinDepositedERC20 ãäœæããŸãã
ãã®ã³ã³ãã©ã¯ãã¯ãã¬ã€ã€ãŒ1 ãã移è¡ãããå šãŠã® JunkCoin ãåãåã£ãŠç®¡çããŸãã ã€ãŸããå šãŠã®ã³ã€ã³ãã¬ã€ã€ãŒ2ã§MintïŒé å¹£ïŒããã®ã§ã¯ãªããã¬ã€ã€ãŒ1ã§çºè¡ããŠã¬ã€ã€ãŒ2ã«ãããžãããããšããææ³ãåããŸãã
æºåãšããŠä»¥äžã®ã¢ãžã¥ãŒã«ãšãã©ã°ã€ã³ãå°å ¥ããŸãã
$ yarn add -D @eth-optimism/contracts @eth-optimism/plugins
hardhat.config.ts
ã®åé ïŒimport æã䞊ãã§ããšããïŒã«ä»¥äžã®äžè¡ãè¿œå ããŠãã©ã°ã€ã³ãæå¹ã«ããŠãã ããã
import "@eth-optimism/plugins/hardhat/compiler";
@eth-optimism/contracts
ã«ã¯ãOptimistic rollups ã«å¿
èŠãªã³ã³ãã©ã¯ãããã¹ãŠåå°ãããŠããŸãã
ãã®ã¢ãžã¥ãŒã«ãã Abs_L2DepositedToken
ãæåããŠä»¥äžã®æ§ãªã³ã³ãã©ã¯ããäœæããŸããã
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import { JunkCoinERC20 } from "./JunkCoinERC20.sol";
import { Abs_L2DepositedToken } from "@eth-optimism/contracts/build/contracts/OVM/bridge/tokens/Abs_L2DepositedToken.sol";
/**
* Runtime target: OVM
*/
contract JunkCoinDepositedERC20 is Abs_L2DepositedToken, JunkCoinERC20 {
address admin;
address dispenser;
constructor(
address _l2CrossDomainMessenger,
string memory _name,
string memory _symbol
)
Abs_L2DepositedToken(_l2CrossDomainMessenger)
JunkCoinERC20(_name, _symbol, 0)
{
admin = msg.sender;
}
/**
* Associate dispenser account/contract
*/
function setDispenser(address _dispenser) external {
require(msg.sender == admin, "Permission denied.");
dispenser = _dispenser;
}
function _handleInitiateWithdrawal(
address _to,
uint _amount
)
internal
override
{
require(msg.sender == _to || (dispenser != address(0) && msg.sender == dispenser), "Permission denied.");
_burn(_to, _amount);
}
function _handleFinalizeDeposit(
address _to,
uint _amount
)
internal
override
{
_mint(_to, _amount);
}
}
ããŒã¯ã³ãšããŠã®æ©èœã¯å
šãŠãå
ãšãªã JunkCoinERC20
ããç¶æ¿ããŠããŸãã
ãã ã Mint ã¯è¡ããããªãã®ã§ãã³ã³ã¹ãã©ã¯ã¿ã§ initialSupply ãæå®ã§ããããã«ã㊠0 ãèšå®ããŠããŸãã
dispenser
㯠JunkCoin ãã³ã³ãã©ã¯ãããçŽæ¥æãåºããã¢ã«ãŠã³ããŸãã¯ã³ã³ãã©ã¯ããæå®ããçºã«èšããŸããã
åŸã£ãŠãã¬ã€ã€ãŒ1 ã« JunkCoin ã転éã§ããã®ã¯ JunkCoin ã®æã¡äž»ããããã㯠dispenser ã§æå®ããã¢ã«ãŠã³ããªããã³ã³ãã©ã¯ãã®ã¿ãšãªããŸãã
_l2CrossDomainMessenger
ã¯ãã¬ã€ã€ãŒ1 ãšéä¿¡ãè¡ãããã® Optimistic rollups çµã¿èŸŒã¿ã³ã³ãã©ã¯ãã§ãã
4.1.2. JunkCoinERC20.sol
JunkCoinERC20 ã¯ä»¥äžã®æ§ã«ä¿®æ£ããŸããã ã³ã³ã¹ãã©ã¯ã¿ã§èšå®é ç®ãæ³šå ¥ã§ããããã«ããã ãã§ããã å°ããã¡ãã®ã³ã³ãã©ã¯ãã¯ã¬ã€ã€ãŒ1ã«ãããã€ãããŸãã
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/**
* Runtime target: EVM
*/
contract JunkCoinERC20 is ERC20 {
constructor(string memory _name, string memory _symbol, uint _initialSupplies) ERC20(_name, _symbol) {
_mint(msg.sender, _initialSupplies);
}
function decimals() public view override returns (uint8) {
return 0;
}
}
4.1.3. Junkeng.sol
é©ãã¹ãããšã« Junkeng ã³ã³ãã©ã¯ãã«ã¯ ã»ãšãã©å€æŽã®å¿ èŠããããŸããã
UX ãèæ ®ããã²ãããã JunkCoin ãåŒãåºãé¢æ°ãwithdrawãã«æ¹é ãå ãã ã¬ã€ã€ãŒ2 ã®ãŠã©ã¬ããã§ã¯ãªããã¬ã€ã€ãŒ1 ã®ãŠã©ã¬ããã«çŽæ¥åŒãåºããããã«æžãæããŸãã
import { iOVM_L2DepositedToken } from "@eth-optimism/contracts/build/contracts/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol";
contract Junkeng {
// ... äžç¥ ...
/**
* Withdraw JunkCoin
*/
function withdraw() public timeout haveCoins phaseAdvance {
uint amount = coinStock[msg.sender];
coinStock[msg.sender] = 0;
IERC20(coin).transferFrom(admin, msg.sender, amount);
iOVM_L2DepositedToken(coin).withdrawTo(msg.sender, amount);
emit Withdrew(msg.sender, amount);
}
4.1.4. ã³ã³ãã€ã«
ã¬ã€ã€ãŒ 1 ã®ã³ã³ãã©ã¯ãã¯ãã®ãŸãŸåŸæ¥éã npx hardhat compile
ã§ã³ã³ãã€ã«ããã° OK ã§ããã
ã¬ã€ã€ãŒ 2 ã¯å°çšã® OVM ã³ã³ãã€ã©ã§ãã€ãã³ãŒãã«å€æããå¿
èŠããããŸãã
ãã®çºã« TARGET=ovm
ãšããç°å¢å€æ°ãèšå®ããªããã°ãªããŸããã
ç°å¢å€æ°ã®OSäŸåãç¡ãããã cross-env
ãå°å
¥ããŸãã
$ yarn add -D cross-env
ã³ã³ãã€ã«çšã®ä»¥äžã®ã³ãã³ãã package.json ã«è¿œå ããŸããã
frontend èªäœã¯ã¬ã€ã€ãŒ2ã§åäœããããããã¬ã€ã€ãŒ1ã®ã³ã³ãã©ã¯ããtypechainïŒèªåçæãããTypeScriptçšã®åå®çŸ©ãã¡ã€ã«ïŒãæ±æããªãæ§ã«ã
--no-typechain
ãªãã·ã§ã³ãæå®ããŸãã
"scripts": {
...
"compile": "npm run compile:evm && npm run compile:ovm",
"compile:evm": "npx hardhat compile --no-typechain",
"compile:ovm": "cross-env TARGET=ovm npx hardhat compile",
yarn compile
ã§ã¬ã€ã€ãŒ1çšã»ã¬ã€ã€ãŒ2çšãäžåºŠã«ã³ã³ãã€ã«åºæ¥ã
yarn compile:evm
ã§ã¬ã€ã€ãŒ1ïŒEVMïŒçšãyarn compile:ovm
ã§ã¬ã€ã€ãŒ2ïŒOVMïŒçšãåå¥ã«ã³ã³ãã€ã«åºæ¥ãŸãã
4.2. åäœãã¹ã
çŸåšã® hardhat ã§è€æ°ã¬ã€ã€ãŒæ§æã®ãããã¯ãã§ãŒã³ãåãæ±ãã®ã¯é£ããã®ã§ã ãã¹ãã¯ã¢ãã¯ãçšã㊠hardhat local network ã®åäžã¬ã€ã€ãŒã§åäœããããã«ããŠåäœãã¹ããå®æœããŸãã
OVM ã§ã³ã³ãã€ã«ããæ§ã«èª¬æããšããŠãªãã§ããããã€ãã³ãŒã㯠EVM çšã䜿çšããŸãã
deploy/
ïŒhardhat-deployãã©ã°ã€ã³çšïŒã«ãããã€ã¹ã¯ãªããã¯çœ®ããªãã®ã§ããã¹ãã³ãŒãå
ã«å°çšã®ãããã€ã³ãŒããæžããŸãã
å¿
èŠãšãªãã¢ãã¯ã¯ mockOVM_CrossDomainMessenger
ã§ã@eth-optimism/contracts
ã«å«ãŸããŠããŸãã
以äžã¯ãã¹ãç°å¢ãã»ããã¢ããããã³ãŒãã§ãã
import { ContractFactory } from "ethers";
import {getContractFactory} from "@eth-optimism/contracts";
import {TransactionResponse} from "@ethersproject/abstract-provider";
import hre from "hardhat";
import * as JunkCoinERC20 from '../artifacts/contracts/JunkCoinERC20.sol/JunkCoinERC20.json';
import * as JunkCoinDepositedERC20 from '../artifacts/contracts/JunkCoinDepositedERC20.sol/JunkCoinDepositedERC20.json';
import * as Junkeng from '../artifacts/contracts/Junkeng.sol/Junkeng.json';
export const setupLocal = hre.deployments.createFixture(async () => {
const { deployer } = await hre.ethers.getNamedSigners();
// Mock of CrossDomainMessenger
const L1CrossDomainMessengerFactory = getContractFactory('mockOVM_CrossDomainMessenger', deployer);
const L1CrossDomainMessenger = await L1CrossDomainMessengerFactory.deploy(0);
await L1CrossDomainMessenger.deployTransaction.wait();
console.log('(L1)CrossDomainMessenger: ' + L1CrossDomainMessenger.address);
const L2CrossDomainMessengerFactory = getContractFactory('mockOVM_CrossDomainMessenger', deployer);
const L2CrossDomainMessenger = await L2CrossDomainMessengerFactory.deploy(0);
await L2CrossDomainMessenger.deployTransaction.wait();
await L1CrossDomainMessenger.setTargetMessengerAddress(L2CrossDomainMessenger.address)
.then((tx: TransactionResponse) => tx.wait());
await L2CrossDomainMessenger.setTargetMessengerAddress(L1CrossDomainMessenger.address)
.then((tx: TransactionResponse) => tx.wait());
console.log('(L2)CrossDomainMessenger: ' + L2CrossDomainMessenger.address);
// Deploy L1 contracts
const L1JunkCoinERC20Factory = new ContractFactory(JunkCoinERC20.abi, JunkCoinERC20.bytecode, deployer);
const L1JunkCoinERC20 = await L1JunkCoinERC20Factory.deploy(
"JunkCoin",
"JKC",
100000000,
)
await L1JunkCoinERC20.deployTransaction.wait();
console.log('(L1)JunkCoinERC20: ' + L1JunkCoinERC20.address);
// Deploy L2 contracts
const L2JunkCoinDepositedERC20Factory = new ContractFactory(JunkCoinDepositedERC20.abi, JunkCoinDepositedERC20.bytecode, deployer);
const L2JunkCoinDepositedERC20 = await L2JunkCoinDepositedERC20Factory.deploy(
L2CrossDomainMessenger.address,
"JunkCoin",
"JKC"
)
await L2JunkCoinDepositedERC20.deployTransaction.wait();
console.log('(L2)JunkCoinDepositedERC20: ' + L2JunkCoinDepositedERC20.address);
const L2JunkengFactory = new ContractFactory(Junkeng.abi, Junkeng.bytecode, deployer);
const L2Junkeng = await L2JunkengFactory.deploy(
L2JunkCoinDepositedERC20.address
)
await L2Junkeng.deployTransaction.wait();
console.log('(L2)Junkeng: ' + L2Junkeng.address);
// Deploy L1 contracts
const L1ERC20GatewayFactory = getContractFactory('OVM_L1ERC20Gateway', deployer);
const L1ERC20Gateway = await L1ERC20GatewayFactory.deploy(
L1JunkCoinERC20.address,
L2JunkCoinDepositedERC20.address,
L1CrossDomainMessenger.address,
)
await L1ERC20Gateway.deployTransaction.wait();
console.log('(L1)OVM_L1ERC20Gateway: ' + L1ERC20Gateway.address);
// Init L2 contracts
await L2JunkCoinDepositedERC20.init(L1ERC20Gateway.address, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
await L2JunkCoinDepositedERC20.increaseAllowance(L2Junkeng.address, 100000000, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
await L2JunkCoinDepositedERC20.setDispenser(L2Junkeng.address, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
console.log('(L2)JunkCoinDepositedERC20 has been initialized.');
// Deposit full balance of token
await L1JunkCoinERC20.increaseAllowance(L1ERC20Gateway.address, 100000000, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
await L1ERC20Gateway.deposit(100000000, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
await L2CrossDomainMessenger.relayNextMessage({ gasLimit: 9500000 })
.then((tx: TransactionResponse) => tx.wait());
console.log('(L1)JunkCoinERC20 has been deposited.');
return {
L1CrossDomainMessenger,
L2CrossDomainMessenger,
L1JunkCoinERC20,
L2JunkCoinDepositedERC20,
L2Junkeng,
L1ERC20Gateway,
}
})
@eth-optimism/contracts
ã®åå®çŸ©ãã¡ã€ã«ããªãã®ã§ããããžã§ã¯ãã«ãŒãã«index.d.ts
ãäœã£ãŠdeclare module "@eth-optimism/contracts" { import { ContractFactory, Signer } from 'ethers' export function getContractFactory( name: string, signer?: Signer, ovm?: boolean ): ContractFactory; }
ãšæžã蟌ãã§ãã ããã ãŸãã
tsconfig.json
ã®include
ã«index.d.ts
ãè¿œå ããŠãã ããã
ã¬ã€ã€ãŒ1 ã§ã¯ãOVM_L1ERC20Gateway
ãšããã³ã³ãã©ã¯ã㧠JunkCoinERC20
ãã©ããããŠããŸããã
ãã®ã³ã³ãã©ã¯ããè³ç£ãããã¯ããŠã¬ã€ã€ãŒ2ã«è»¢éããŸãã
åœç¶ãã¬ã€ã€ãŒ2ããæ»ã£ãŠããè³ç£ãææè
ã¢ã«ãŠã³ãã«æž¡ã圹å²ãæ
ããŸãã
mockOVM_CrossDomainMessenger
ã¯ã¡ãã»ãŒãžãéä¿¡ãã¥ãŒã«å
¥ããã ãã§ã
æ¬æ¥ã¯ã·ã¹ãã ãåæã«ãã£ãŠãããã¡ãã»ãŒãžã®é
ä¿¡ãŸã§ã¯ããŠãããªãã®ã§ã
relayNextMessage
ãæåã§åŒã³åºããŠãã¬ã€ã€ãŒ2ã®ã³ã³ãã©ã¯ãïŒããã§ã¯ JunkCoinDepositedERC20
ïŒã«ã¡ãã»ãŒãžãçä¿¡ãããŸãã
createFixture ã§ã©ããããŠããã®ã§ããã¹ãã³ãŒãã® beforeEach ã§åŒã³åºããŠããã°ã 2åç®ä»¥é㯠hardhat ãã»ããã¢ããæžã¿ã®ã¹ãããã·ã§ããã埩å ããŠãããã®ã§ã é«éã«åäœãã¹ããå®è¡ã§ããŸãã
ãã¹ãã³ãŒãåŽã§ã¯ã
describe('Junkeng', () => {
let contracts: {[name: string]: Contract };
beforeEach(async () => {
contracts = await setupLocal();
})
ãšæžããŠããã°ãããã€æžã¿ã®ã³ã³ãã©ã¯ãã«ã¢ã¯ã»ã¹ã§ããããã«ãªããŸãã
å šãŠã®åäœãã¹ãã³ãŒã㯠ãã¡ã ã«ãããŸãã
yarn test
ã§ãã¹ããå®è¡ã§ããããã« package.json
ã«ä»¥äžãè¿œå ããŸããã
"scripts": {
...
"test": "npm run compile:evm && npx hardhat test --no-compile --network hardhat",
4.3. ãããã€ã¹ã¯ãªããã®äœæ
ããã³ããšã³ãçšã« frontend/src/hardhat/deployments
ãèªåçæãããã®ã§ãhardhat-deploy ã¯åŒãç¶ã䜿çšããŸãã
ãã ããhardhat-deploy ããããã€å¯Ÿè±¡ãšããã®ã¯ã¬ã€ã€ãŒ2ã®ã¿ã«ããŸãã
ã¬ã€ã€ãŒ1ã®ã³ã³ãã©ã¯ã㯠hardhat-deploy ã®ç®¡çå€ã§ãããã€ããŠãã³ã³ãã©ã¯ãã¢ãã¬ã¹ã ã䜿çšããŸãã
ãŸããhardhat-deploy ã® OVM ã³ã³ãã€ã©å¯Ÿå¿ã¯äžå®å šã§ãOVM çšã®ãã€ãã³ãŒããåŒã£åŒµã£ãŠæ¥ãªãæ§ãªã®ã§ã èªå㧠artifactsïŒã³ã³ãã€ã©ã®çæç©ïŒãã€ã³ããŒãããŠãããã€ããŸãã
以äžã¯ãå®éã®ãããã€ã¹ã¯ãªãã deploy/Junkeng.ts
ã§ãã
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';
import assert from "assert";
import {JsonRpcProvider} from "@ethersproject/providers";
import {Contract, ContractFactory, Wallet} from "ethers";
import {getContractFactory} from "@eth-optimism/contracts";
import {TransactionResponse} from "@ethersproject/abstract-provider";
import * as JunkCoinERC20 from "../artifacts/contracts/JunkCoinERC20.sol/JunkCoinERC20.json";
import * as JunkCoinDepositedERC20 from '../artifacts-ovm/contracts/JunkCoinDepositedERC20.sol/JunkCoinDepositedERC20.json';
import * as Junkeng from '../artifacts-ovm/contracts/Junkeng.sol/Junkeng.json';
const deployL1JuncCoinERC20 = async (l1Wallet: Wallet): Promise<Contract> => {
// Deploy L1 contracts
const L1JunkCoinERC20Factory = new ContractFactory(JunkCoinERC20.abi, JunkCoinERC20.bytecode, l1Wallet);
const L1JunkCoinERC20 = await L1JunkCoinERC20Factory.deploy(
"JunkCoin",
"JKC",
100000000,
)
await L1JunkCoinERC20.deployTransaction.wait();
console.log('(L1)JunkCoinERC20: ' + L1JunkCoinERC20.address);
return L1JunkCoinERC20;
}
const deployL1ERC20Gateway = async (
L1MessengerAddress: string,
L1JunkCoinERC20Address: string,
L2JunkCoinDepositedERC20Address:
string, l1Wallet: Wallet
): Promise<Contract> => {
// Deploy L1 contracts
const L1ERC20GatewayFactory = getContractFactory('OVM_L1ERC20Gateway');
const L1ERC20Gateway = await L1ERC20GatewayFactory.connect(l1Wallet).deploy(
L1JunkCoinERC20Address,
L2JunkCoinDepositedERC20Address,
L1MessengerAddress,
)
await L1ERC20Gateway.deployTransaction.wait();
console.log('(L1)OVM_L1ERC20Gateway: ' + L1ERC20Gateway.address);
return L1ERC20Gateway;
}
// Deposit full balance of token
const depositL1JunkCoinERC20 = async (L1JunkCoinERC20: Contract, L1ERC20Gateway: Contract) => {
await L1JunkCoinERC20.increaseAllowance(L1ERC20Gateway.address, 100000000, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
await L1ERC20Gateway.deposit(100000000, { gasLimit: 1000000 })
.then((tx: TransactionResponse) => tx.wait());
console.log('(L1)JunkCoinERC20 has been deposited.');
}
const deploy: DeployFunction = async function ({
getNamedAccounts,
deployments,
getChainId,
getUnnamedAccounts
}: HardhatRuntimeEnvironment) {
assert(process.env.WALLET_PRIVATE_KEY_DEPLOYER);
assert(process.env.L1_WEB3_URL);
assert(process.env.L1_MESSENGER_ADDRESS);
assert(process.env.L2_MESSENGER_ADDRESS);
const { deploy, execute, save } = deployments;
const { deployer } = await getNamedAccounts();
const l1Provider = new JsonRpcProvider(process.env.L1_WEB3_URL);
const l1Wallet = new Wallet(process.env.WALLET_PRIVATE_KEY_DEPLOYER, l1Provider);
const L1JunkCoinERC20 = await deployL1JuncCoinERC20(l1Wallet);
const L2JunkCoinDepositedERC20 = await deploy("JunkCoinDepositedERC20", {
from: deployer,
gasLimit: 8000000,
args: [process.env.L2_MESSENGER_ADDRESS, "JunkCoin", "JKC"],
contract: {
abi: JunkCoinDepositedERC20.abi,
bytecode: JunkCoinDepositedERC20.bytecode,
deployedBytecode: JunkCoinDepositedERC20.deployedBytecode,
},
skipIfAlreadyDeployed: false,
})
console.log('(L2)JunkCoinDepositedERC20: ' + L2JunkCoinDepositedERC20.address);
const L1ERC20Gateway = await deployL1ERC20Gateway(
process.env.L1_MESSENGER_ADDRESS, L1JunkCoinERC20.address, L2JunkCoinDepositedERC20.address, l1Wallet);
const junkeng = await deploy("Junkeng", {
from: deployer,
gasLimit: 8000000,
args: [L2JunkCoinDepositedERC20.address],
contract: {
abi: Junkeng.abi,
bytecode: Junkeng.bytecode,
deployedBytecode: Junkeng.deployedBytecode,
},
skipIfAlreadyDeployed: false,
})
console.log('(L2)Junkeng: ' + junkeng.address);
await execute("JunkCoinDepositedERC20", {from: deployer, gasLimit: 8000000}, 'init', L1ERC20Gateway.address);
console.log('(L2)Executed JunkCoinDepositedERC20.init()');
await execute("JunkCoinDepositedERC20", {from: deployer, gasLimit: 8000000}, 'approve', junkeng.address, '100000000');
console.log('(L2)Executed JunkCoinDepositedERC20.approve()');
await execute("JunkCoinDepositedERC20", {from: deployer, gasLimit: 8000000}, 'setDispenser', junkeng.address);
console.log('(L2)Executed JunkCoinDepositedERC20.setDispenser()');
await depositL1JunkCoinERC20(L1JunkCoinERC20, L1ERC20Gateway);
}
export default deploy;
åäœãã¹ãã®æã«æžãããããã€ã³ãŒããšäŒŒããããªæé ãèžãã§ããŸãããå®éã«ã¬ã€ã€ãŒ1ãšã¬ã€ã€ãŒ2ã§å¥ã ã®ãããã¯ãã§ãŒã³ã«ãããã€ããŠããŸãã ïŒãããéåžžã«ãããããïŒïŒ
å®éã«ãããã€ããåã«ã¯ã
WALLET_PRIVATE_KEY_DEPLOYER
ã¬ã€ã€ãŒ1ãžãããã€ãããšãã«äœ¿ãã¢ã«ãŠã³ãã®ç§å¯éµL1_WEB3_URL
ã¬ã€ã€ãŒ1ã® JsonRpc URLL1_MESSENGER_ADDRESS
ã¬ã€ã€ãŒ1ã®CrossDomainMessengerã³ã³ãã©ã¯ãã¢ãã¬ã¹L2_MESSENGER_ADDRESS
ã¬ã€ã€ãŒ2ã®CrossDomainMessengerã³ã³ãã©ã¯ãã¢ãã¬ã¹
äžèšã®ç°å¢å€æ°ãå¿ èŠãšããŸãã .env ãäœã£ãŠæå®ããŠãã ããã
4.4. ããŒã«ã«ãã¹ãç°å¢ãžã®ãããã€
Optimistic Ethereum ã§ã¯å°çšã®ããŒã«ã«ãã¹ãç°å¢ãçšæãããŠããŸãã git ã³ãã³ããš Docker ã䜿ããããäºãã€ã³ã¹ããŒã«ãããŠãã ããã ïŒããã©ããããã° optimism-integration ã®å°å ¥ãé£ã°ããŠãèšå®ãš Test Network ãžã®ãããã€ã«é²ãã§ãã ããïŒ
4.4.1. optimism-integration ã®å°å ¥
GitHub ããã¯ããŒã³ããŠã»ããã¢ããããŸãã
git clone git@github.com:ethereum-optimism/optimism-integration.git --recurse-submodules
cd optimism-integration
docker-compose pull
ããŒããç«ã¡äžãããšãã¯ä»¥äžã®ã³ãã³ãã§ãã
$ ./up.sh
localhost:8545
ã«ã¬ã€ã€ãŒ2ãlocalhost:9545
ã«ã¬ã€ã€ãŒ1ã®ããŒããèµ·åããŸãã
å°ãçŸåš optimism-integration ã¯éçºã¢ã¯ãã£ããã£ãé«ãã®ã§ã ããŸã«ææ°ããŒãžã§ã³ãåäœããªããªãäºããããããããŸããã
ãã®å Žåã¯ãã®åãã¹ããŒãã§æµããŠãããšã©ãŒã¡ãã»ãŒãžã確èªããŠãåé¡åæãç¹å®ããªããã°ãªããŸããïŒ çµéšäžã§ããã倧æµã¯
docker-compose.env.yml
ã®èšè¿°ãã¹ãåå ã§ãã
4.4.2. èšå®ããŠãããã€
ãããžã§ã¯ãã«ãŒãã«ãã dot.env
ã .env
ã«ãªããŒã ããŠãå
容ã以äžã®æ§ã«ä¿®æ£ããŠãã ããã
å°ããŠã©ã¬ããã®ç§å¯éµã¯ãããŒããç«ã¡äžãããšãã«è¡šç€ºããããã®ã§ãã¬ã€ã€ãŒ1ã§ã¯ 10000ETH ãäºãä»äžãããŸãã
# Default account on optimism-integration
WALLET_PRIVATE_KEY_DEPLOYER=0x754fde3f5e60ef2c7649061e06957c29017fe21032a8017132c0078e37f6193a
WALLET_PRIVATE_KEY_SEQUENCER=0xd2ab07f7c10ac88d5f86f1b4c1035d5195e81f27dbe62ad65e59cbf88205629b
WALLET_PRIVATE_KEY_TESTER1=0x23d9aeeaa08ab710a57972eb56fc711d9ab13afdecc92c89586e0150bfa380a6
WALLET_PRIVATE_KEY_TESTER2=0x5b1c2653250e5c580dcb4e51c2944455e144c57ebd6a0645bd359d2e69ca0f0c
# Default settings on optimism-integration
L1_WEB3_URL=http://localhost:9545
L2_WEB3_URL=http://localhost:8545
L1_MESSENGER_ADDRESS=0x6418E5Da52A3d7543d393ADD3Fa98B0795d27736
L2_MESSENGER_ADDRESS=0x4200000000000000000000000000000000000007
hardhat.config.ts
ã® networks ã« layer1 ãš layer2 ãè¿œå ããç°å¢å€æ°ãèªã¿èŸŒã¿ãŸãã
import dotenv from "dotenv";
dotenv.config();
// ... äžç¥ ...
import assert from "assert";
assert(process.env.WALLET_PRIVATE_KEY_DEPLOYER);
assert(process.env.WALLET_PRIVATE_KEY_SEQUENCER);
assert(process.env.WALLET_PRIVATE_KEY_TESTER1);
assert(process.env.WALLET_PRIVATE_KEY_TESTER2);
assert(process.env.L1_WEB3_URL);
assert(process.env.L2_WEB3_URL);
assert(process.env.L1_MESSENGER_ADDRESS);
assert(process.env.L2_MESSENGER_ADDRESS);
// ... äžç¥ ...
const config: HardhatUserConfig = {
react: {
providerPriority: ["web3modal", "hardhat"],
},
defaultNetwork: "layer2",
networks: {
// ... äžç¥ ...
layer2: {
url: process.env.L2_WEB3_URL,
accounts: [
process.env.WALLET_PRIVATE_KEY_DEPLOYER,
process.env.WALLET_PRIVATE_KEY_SEQUENCER,
process.env.WALLET_PRIVATE_KEY_TESTER1,
process.env.WALLET_PRIVATE_KEY_TESTER2,
],
},
layer1: {
url: process.env.L1_WEB3_URL,
accounts: [
process.env.WALLET_PRIVATE_KEY_DEPLOYER,
process.env.WALLET_PRIVATE_KEY_SEQUENCER,
process.env.WALLET_PRIVATE_KEY_TESTER1,
process.env.WALLET_PRIVATE_KEY_TESTER2,
],
},
ãããã€ã³ãã³ãã package.json
ã«ä»èŸŒã¿ãŸãã
"scripts": {
...
"deploy": "npm run compile:evm && cross-env TARGET=ovm npx hardhat deploy --reset --network layer2",
ã³ãã³ãã©ã€ã³ãã㯠yarn deploy
ã§å®è¡ã§ããŸãã
network ãšããŠãlayer2 ãæå®ããŠããã®ãšããããã€ã®åå©çšãããªãæ§ã« --reset
ã䜿çšããŠããŸãã
åŸã£ãŠããããã€ãå®è¡ãã床ã«ãå
šã³ã³ãã©ã¯ãã®ã¢ãã¬ã¹ãå€æŽã«ãªããŸãã
layer2 ãæå®ããŠããŸãããäŸåãã layer1 ã®ã³ã³ãã©ã¯ããäžç·ã«ãããã€ãããŸãã
frontend/src/hardhat/deployments
ãæŽæ°ãããããã³ããšã³ãã«ãã³ã³ãã©ã¯ãã¢ãã¬ã¹ãåæ ãããŸãã
ãŸãããããã€æã«è¡šç€ºãããã³ã³ãã©ã¯ãã¢ãã¬ã¹ã¯ãåŸã ã®çºã«ã¡ã¢åž³ãªã©ãžæ§ããŠãããŠãã ããã
4.4.3. åäœç¢ºèª
ã³ã³ãœãŒã«ã§ã³ã³ãã©ã¯ãã«ã¢ã¯ã»ã¹ããŠåäœç¢ºèªãããŠã¿ãŸãããã
$ npx hardhat console --no-compile --network layer2
hardhat ã³ã³ãœãŒã«ãèµ·åãããã以äžã®é ã§ã³ãã³ããæã¡èŸŒãã§ãã ããã
> const signers = await ethers.getSigners()
> const JunkCoinDepositedERC20 = await ethers.getContract('JunkCoinDepositedERC20', signers[0])
> (await JunkCoinDepositedERC20.totalSupply()).toNumber()
100000000
æ£åžžã«ãããã€ãããJunkCoin ããããžãããããŠããŸããã
4.4.4. ããã³ããšã³ãããã¢ã¯ã»ã¹
幞éã«ããŠããã³ããšã³ãã«ã¯äœãä¿®æ£ãå ããå¿ èŠããããŸããã åã«ãããžã§ã¯ãã«ãŒãã§ã
$ yarn frontend
ãå®è¡ããŠãã¹ããµãŒããŒãèµ·åããŸãããã
MetaMask ã§ã«ã¹ã¿ã ãããã¯ãŒã¯ã®è¿œå ãå¿ èŠã«ãªããŸãã 以äžã®æ§ã«è¿œå ããŠãã ããã å¿ èŠãªã®ã¯ layer2 ã ãã§ãlayer1 ã¯å¿ é ã§ã¯ãããŸããã
MetaMask 㧠layer2 ã®ãããã¯ãŒã¯ã«åãæ¿ã㊠Join game ããŠã¿ãŸãããã
ããŒã«ã«ã§èµ·åãã layer2 ããŒãã§ã¯ Gas Price ã 0 ã«ããŠããã©ã³ã¶ã¯ã·ã§ã³ãéããŸãã åŸã£ãŠ ETH ã¯å¿ èŠãããŸããïŒ
ããŠããã¡ããšåäœããã§ããããããšã©ãŒãåºãŠé²è¡ããªãå Žåã¯ããããã€ããããçŽããŠã¿ãŠãã ããã ãŸããã¢ã«ãŠã³ãã®ãªã»ããïŒMetaMask ã® Settings â Advanced â Reset Account ïŒãè¡ã£ãŠãã ããã
å ¥æããã³ã€ã³ãã¬ã€ã€ãŒ1ã«åŒãåºãã«ã¯ãåã« Withdraw ãã¯ãªãã¯ããŸãã ãã¹ãçšã®ããŒã«ã«ããŒãã§ã¯ããŒãé 延ã§ã¬ã€ã€ãŒ1ã«è»¢éãããŸãïŒæ¬æ¥ã¯1é±éããããŸãïŒ
å ¥æããã³ã€ã³ã®æ®é«ã確èªããã«ã¯ããããã€æã«è¡šç€ºããã JunkCoinERC20 ã®ã¢ãã¬ã¹ããAdd Token 㧠MetaMask ã«è¿œå ããŠãã ããã ãã®éãå¿ããã«ãããã¯ãŒã¯ã layer1 ãžåãæ¿ããŠãã ããã
4.5. Test Network ã«ãããã€
Optimistic Ethereum ã§ã¯ Kovan Test Network ã«æ¥ç¶ããããã¹ãããããå ¬éãããŠããã®ã§ã ã¬ã€ã€ãŒ2çšã®ã¹ããŒãã³ã³ãã©ã¯ãããããªãã¯ã«ãããã€åºæ¥ãŸãã
æªã Mainnet ã«ã¯ãããã€ã§ããŸããã
4.5.1. ETH ã®å ¥æ
åæºåãšã㊠Kovan Test Network äžã® ETH ããã¡ã ã§å ¥æããŠãã ããã ïŒGitHub ã®ã¢ã«ãŠã³ããå¿ èŠã§ãïŒ
4.5.2. ããŒãã®æºå
ååã䜿ã£ã Alchemy 㧠Kovan Test Network ã®ããŒããç«ã¡äžããŠïŒã¢ããªãäœæããŠïŒ API URL ãååŸããŠãã ããã ã¬ã€ã€ãŒ1çšã®ã³ã³ãã©ã¯ãã Kovan Test Network ãžãããã€ããã®ã«å¿ èŠã§ãã
4.5.3. .env ã®ç·šéãšãããã€å®è¡
.evn
ã以äžã®æ§ã«ç·šéããŠãã ããã
WALLET_PRIVATE_KEY_DEPLOYER=ã¢ã«ãŠã³ãã®ç§å¯éµã«çœ®æïŒKovan Test Network äžã§ ETH ãå¿
èŠã§ãïŒ
WALLET_PRIVATE_KEY_SEQUENCER=ã¢ã«ãŠã³ãã®ç§å¯éµã«çœ®æïŒé©åœãªã¢ã«ãŠã³ãïŒ
WALLET_PRIVATE_KEY_TESTER1=ã¢ã«ãŠã³ãã®ç§å¯éµã«çœ®æïŒé©åœãªã¢ã«ãŠã³ãïŒ
WALLET_PRIVATE_KEY_TESTER2=ã¢ã«ãŠã³ãã®ç§å¯éµã«çœ®æïŒé©åœãªã¢ã«ãŠã³ãïŒ
L1_WEB3_URL=çšæãã Kovan Test Network ããŒãã® API URL
L2_WEB3_URL=https://kovan.optimism.io
L1_MESSENGER_ADDRESS=0xb89065D5eB05Cac554FDB11fC764C679b4202322
L2_MESSENGER_ADDRESS=0x4200000000000000000000000000000000000007
以äžã§ãããã€ã®æºåãæŽããŸããã
yarn deploy
ã§å®è¡ã§ãã
4.5.4. MetaMask ã®èšå®
Kovan Test Network ã¯ããã©ã«ãã§ãããã¯ãŒã¯ãªã¹ãã«å«ãŸããŠããŸãã ã¬ã€ã€ãŒ2 ã以äžã®æ§ã«è¿œå ããŠãã ããã
ããšã¯åãæ¿ããŠäœ¿çšããŸãã
ãããªãã¯ã® Optimistic Ethereum ãã¹ããµãŒããŒããGas Price 0 ã§ãã©ã³ã¶ã¯ã·ã§ã³ãéãããšãåºæ¥ãŸãã å®éã¯å¹Ÿèš±ãã®ææ°æãæãããŸãããéåžžã«å®äŸ¡ã«ãªããä»ã®æ§ãªé«éš°ãèµ·ãããªããã®ãšæãããŸãã
ææ°æ㯠ETH ã§æ¯æããŸããããã®çºã®è³éã¯ã¬ã€ã€ãŒ1ãããããžããããŠããå¿ èŠãããã§ãããïŒä»åã¯ãã®æé ã¯çãããŠããŸãïŒ åŸã£ãŠããããžããçšã® UI ãå¥éå®è£ ããå¿ èŠãããããã§ãã
ãã¹ããµãŒããŒã§ã¯ãã¬ã€ã€ãŒ2ããã¬ã€ã€ãŒ1ã«è³ç£ãæã¡åºãããšãããšãåŸ ã¡æéãçºçããããã§ã ïŒçè ã®ãã¹ããåŸ ã¡æéäžãªã®ã§ãã©ããããã®æéæããã®ã確èªã§ããŠãªãïŒ
5. å®è£ ããŠã¿ãææã»åé¡ç¹
5.1. ãã¿ã€ã ã¹ã¿ã³ããåé¡
ãã¡ã ã«æžãããŠããã®ã§ããã
DeJunkeng ãæéã«äŸåããdAppsã§ãã
Optimistic rollups ã®ã¬ã€ã€ãŒ2ã§ã¯ãããæ·±å»ãªåé¡ã§ãblock.timestamp
ã«å€§ããªé
延ãçããçºã
ã²ãŒã éå§ããŠãã5åéã®å¶éæéãæ£ç¢ºã«æž¬ãããšãåºæ¥ãŸããã
ã¬ã€ã€ãŒ2 ã«ããã block.timestamp
ã¯ãã¬ã€ã€ãŒ1ãžãã©ã³ã¶ã¯ã·ã§ã³ãæåŸã«ããŒã«ã¢ããããæé ã«èšå®ãããããã
å®æéããæ倧10åçšåºŠã®ãããçããŸãã
Optimistic Ethereum ã®ã¬ã€ã€ãŒ2ã«ã¯ããããã¯ããšããæŠå¿µã¯ååšãããæãã®ã¯åãªããã©ã³ã¶ã¯ã·ã§ã³ã®ãªã¹ãã§ãïŒå³ã¡ãããã¯ãã§ãŒã³ã§ãããªãïŒ
ããšããš Ethereum ã®ã¹ããŒãã³ã³ãã©ã¯ãã«ãããæéã®æ±ãã«ã¯èª²é¡ãããã
ãããã¯ã®çææ¯ã«æŽæ°ããã block.timestamp
ã®ç²ŸåºŠã¯èããã®ã§ã
ããã«äŸåããäºã¯æšå¥šãããŠããŸããã§ããã
æéãã»ãã¥ã¢ã«æ±ãããã«ã¯ãäžå€®éæš©çãªãµãŒããŒãçšæããããå¥ã®ãœãªã¥ãŒã·ã§ã³ãèãåºãå¿ èŠãããããã§ãã
5.2. ãã©ã³ã¶ã¯ã·ã§ã³æ¿èªãæ©ãããã®ã§æ³å®å€ã®ç¶æ ã«ãªã
ããã¯ããã³ããšã³ãã®ã³ãŒããçŽãã°ãã話ã§ããã ãã©ã³ã¶ã¯ã·ã§ã³ãçºè¡ããŠããã»ãŒã©ã°ç¡ãæ¿èªãããã®ã§ã å€ãªç¶æ ã«å ¥ããã°ãçãŸããŠããŸããŸããã
ã¹ã«ãŒããããé«ããªã£ããæ ã«é²èŠãããã°ãšãããã€ã§ããã
5.3. ã¬ã€ã€ãŒ2 ã®è³ç£ãã¬ã€ã€ãŒ1 ã«æã¡åºãéã®åŸ ã¡æé
ã¬ã€ã€ãŒ2ã«ããè³ç£ãã¬ã€ã€ãŒ1ã«æã¡åºãããšãããšã7æ¥çšåºŠã®åŸ ã¡æéãçºçããã®ã¯ UX ãšããŠå³ãããããããªãã§ãã ãããåãªãEtherãERC20ããŒã¯ã³ãšèšã£ã代æ¿ãå¯èœãªè³ç£ã®å Žåã¯ãåŒãåºãããšããè³ç£ãæ ä¿ã«åããã®ãçæ貞ä»ãã圢ã§ã é 延ãçãããä»çµã¿ãäœãããã§ãããNFTïŒé代æ¿æ§ããŒã¯ã³ïŒã®ãããªäžåç©ã¯é£ããã§ããã
ãã®åŸ ã¡æéäžã¯ãåŒãåºãããšããè³ç£ãæ¶ãããããªç¶æ ã«ãªãã®ã§ããEtherã»ããŒã¯ã³ã¯è»¢éäžã§ãããšåããäœããã®ä»çµã¿ãå¿ èŠããªãšæããŸããã
5.4. MetaMask ã§ãããã¯ãŒã¯ãåãæ¿ããã®ã¯é¢å
MetaMask ã§ã«ã¹ã¿ã ãããã¯ãŒã¯ãè¿œå ããŠã¬ã€ã€ãŒ2ã«åãæ¿ãããšããæäœãå¿ èŠãšããã®ã¯ UX ãšããŠå³ãããããããªãã§ãã
ééã£ããããã¯ãŒã¯ãéžæããŠããŠæ°ä»ããªããšããäºãçºçããŠãåãåããé »åºŠãçå¢ãããã§ãã
dApps ã®ããã³ããšã³ãã«ç¬èªã®ãŠã©ã¬ãããå®è£ ããŠãMetaMask ã¯åãæ¿ããããªããšããã®ã UX ã«ãšã£ãŠã¯ãã¹ããªæ¡ããã
5.5. éçºç°å¢ïŒhardhatïŒã®å¯Ÿå¿ã¯æªå®å š
ã¬ã€ã€ãŒ2 ãš OVM ã³ã³ãã€ã©ããã£ãšäžæãæ±ããããã« hardhat-deploy ãã©ã°ã€ã³ã®ããã©ã°ã€ã³ããéçºããå¿ èŠãããããã§ãã
5.6. å®éã©ããããå®ããªããã¯ãã£ãŠã¿ãªããšåãããªã
Test Network ã§ã¯ Gas Price 0 ã§ãã©ã³ã¶ã¯ã·ã§ã³ãéãã®ã§ãå®é幟ããããæããã®ãã¯èŠç©ãããŸããã§ããã Optimistic rollups ã¬ã€ã€ãŒ2 ã®äž»ãªç¶æã³ã¹ãã¯ãã·ã¹ãã ç¶æè²»ãšã¬ã€ã€ãŒ1ãžã®ããŒã«ã¢ããæã«çºçããã¬ã¹ä»£ã§ãããããã å©çšè ãå€ããã°ã¹ã±ãŒã«ã¡ãªãããåŸããããã§ãããä»ã®ãšããè¯ãããããªãã§ããã ãããããèããã°ãã¬ã€ã€ãŒ2ã¯èª°ã§ãç«ã¡äžããããä»çµã¿ãªã®ã§ãã¬ã€ã€ãŒ2éå¶è ãä»»æã«æéãèšå®ããã°ãããšãã話ãªã®ãããããŸããã ããèãããšãã¬ã€ã€ãŒ2ã§å±éãã dApps ã®åçæ§ã«ãã£ãŠã¯ç¡æã«åºæ¥ãç©ãããã§ãããã
6. ä»åã¯ãããŸã§
ä»åã¯ãEthereum ã«èµ·ãã£ãŠãããã¬ã¹é«éš°åé¡ããžã®å¯Ÿçãæ€èšãã€ã€ã çŸåšé²è¡åœ¢ã§éçºãé²ãã§ããã¬ã€ã€ãŒ2æè¡ã®äžã€ãOptimistic rollupsããå®éã«äœ¿ã£ãŠã¿ãããšã§çŽ¹ä»ããŸããã
å®æããã° Ethereum ã§ã»ãã¥ãªãã£ã確ä¿ãããŸãŸãå®äŸ¡ãªå©çšæ㧠dApps ã䜿ããç¬èªãã©ãããã©ãŒã ãå±éããæå¹ãªæ段ã«ãªãããã§ãã åŒç€ŸãšããŠãåŒãç¶ãè¿œã£ãŠãããããšèããŠããŸãã
ä»åã¯ãããŸã§ãšããŸããããã§ã¯ãŸãïŒ
7. ãœãŒã¹ã³ãŒã㯠GitHub ã§å ¬éäž
MITã©ã€ã»ã³ã¹ã§å ¬éäžã§ãã ãå©çšã¯èªå·±è²¬ä»»ã§ã©ããã ïŒ optimism ãã©ã³ãã«ã¢ãããããŠããŸãïŒ
ãã°ãªã©èŠã€ããã Issue ãŸã§ã©ããã