Lightning ã¯ã2 ã€ã®åœäºè ïŒããŒã«ã«ããŒããšãªã¢ãŒãããŒãïŒããªããã§ãŒã³ã§ååŒãè¡ãããšãå¯èœã«ããŸããããã«ãããååœäºè ã«çžäºçœ²åãããã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãäžãããããã£ãã«ã®çŸåšã®ç¶æ ïŒåºæ¬çã«ã¯çŸåšã®æ®é«ïŒãèšè¿°ããŸãããã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã¯ãæ°ããæ¯æããè¡ããããã³ã«æŽæ°ãããåžžã«äœ¿çšå¯èœã§ãã
ãã£ãã«ãçµäºããæ¹æ³ã¯ 3 ã€ãããŸãïŒ
- è¯ãæ¹æ³ïŒçžäºã¯ããŒãºïŒïŒããæç¹ã§ããŒã«ã«ããŒããšãªã¢ãŒãããŒãããã£ãã«ãéããããšã«åæããŸãã圌ãã¯ã¯ããŒãºãã©ã³ã¶ã¯ã·ã§ã³ïŒã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«äŒŒãŠããŸãããä¿çäžã®æ¯æãã¯ãããŸããïŒãçæããããããããã¯ãã§ãŒã³ã«å ¬éããŸãïŒBOLT #2: Channel Close ãåç §ïŒã
- æªãæ¹æ³ïŒäžæ¹çã¯ããŒãºïŒïŒäœããããŸãããããã©ã¡ãã®åŽã«ãæªæããªãå¯èœæ§ããããŸããäŸãã°ãäžæ¹ã®åœäºè ãã¯ã©ãã·ã¥ãããããããŸãããäžæ¹ãææ°ã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãå ¬éããŸãã
- éãæ¹æ³ïŒåãæ¶ããããã©ã³ã¶ã¯ã·ã§ã³ã¯ããŒãºïŒïŒäžæ¹ã®åœäºè ãæ æã«äžæ£ãè©Šã¿ãå€ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãå ¬éããŸãïŒããããã以åã®ããŒãžã§ã³ã§ãããæå©ãªãã®ã§ãïŒã
Lightning ã¯ä¿¡é Œãå¿ èŠãšããªãããã«èšèšãããŠããããããããã® 3 ã€ã®ã±ãŒã¹ã®ãããã«ãããŠãè³éã倱ããªã¹ã¯ã¯ãããŸããããã ããç¶æ³ãé©åã«åŠçãããããšãæ¡ä»¶ã§ãããã®ææžã®ç®çã¯ãäžèšã®ç¶æ³ã«ãªã³ãã§ãŒã³ã§ééãããšãã«ããŒããã©ã®ããã«åå¿ãã¹ãããæ£ç¢ºã«èª¬æããããšã§ãã
- äžè¬çãªåœåæ³
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³
- ãã£ãã«ã®å€±æ
- çžäºã¯ããŒãºã®åŠç
- äžæ¹çã¯ããŒãºã®åŠçïŒããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³
- äžæ¹çã¯ããŒãºã®åŠçïŒãªã¢ãŒãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³
- åãæ¶ããããã©ã³ã¶ã¯ã·ã§ã³ã¯ããŒãºã®åŠç
- HTLC ãã©ã³ã¶ã¯ã·ã§ã³ã®çæ
- äžè¬çãªèŠä»¶
- ä»é² A: æåŸ ãããéé
- èè
æªäœ¿çšã®ã¢ãŠãããã㯠æªè§£æ±º ãšèŠãªããããã®ããã¥ã¡ã³ãã§è©³è¿°ãããŠãããã㫠解決 ãããŸããéåžžãããã¯å¥ã® 解決 ãã©ã³ã¶ã¯ã·ã§ã³ã§ããã䜿çšããããšã«ãã£ãŠéæãããŸãããã ããæã«ã¯åŸã§ãŠã©ã¬ããã§äœ¿çšããããã«ã¢ãŠãããããèšé²ããŠããã ãã§ååãªå Žåãããããã®å Žåãã¢ãŠãããããå«ããã©ã³ã¶ã¯ã·ã§ã³èªäœã 解決 ãã©ã³ã¶ã¯ã·ã§ã³ãšèŠãªãããŸãã
解決 ãããã¢ãŠããããã¯ããªã¢ãŒã㮠解決 ãã©ã³ã¶ã¯ã·ã§ã³ãæãäœæ¥éã®å€ããããã¯ãã§ãŒã³ã§å°ãªããšã 100 ãããã¯æ·±ãå«ãŸãããšãã« äžå¯éçã«è§£æ±º ããããšèŠãªãããŸãã100 ãããã¯ã¯ãæãé·ãæ¢ç¥ã®ãããã³ã€ã³ãã©ãŒã¯ãããã¯ããã«é·ãããã€ããŒã®å ±é ¬ã®ç¢ºèªã«äœ¿çšãããåŸ ã¡æéãšåãã§ãïŒReference Implementationãåç §ïŒã
ããŒãã¯ïŒ
- è³é調éãã©ã³ã¶ã¯ã·ã§ã³ããããŒããã£ã¹ãããå ŽåããŸã㯠HTLC ã¢ãŠãããããå«ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã®ã³ãããã¡ã³ã眲åãéä¿¡ããå ŽåïŒ
- ãã¹ãŠã®ã¢ãŠããããã äžå¯éçã«è§£æ±º ããããŸã§ïŒ
- äžå¯éçã«è§£æ±º ãããŠããªãã¢ãŠãããããæ¶è²»ãããã©ã³ã¶ã¯ã·ã§ã³ããããã¯ãã§ãŒã³ã§ç£èŠããªããã°ãªããŸããã
- ãã¹ãŠã®ã¢ãŠããããã äžå¯éçã«è§£æ±º ããããŸã§ïŒ
- 以äžã«æå®ãããŠããããã«ããã¹ãŠã®ã¢ãŠããããã 解決 ããªããã°ãªããŸããã
- ãããã¯ãã§ãŒã³ã®åç·šæãçºçããå Žåã«åããŠãã¢ãŠãããããè€æ°å解決ããæºåãããŠãããªããã°ãªããŸããã
- è³é調éãã©ã³ã¶ã¯ã·ã§ã³ãæ¶è²»ãããå Žåããã£ãã«ããã§ã«éããããŠããªãå ŽåïŒ
- 説æçãª
error
ãéä¿¡ããŠãããŸããŸããã - ãã£ãã«ã倱æãããã¹ãã§ãã
- 説æçãª
- ç¡å¹ãªãã©ã³ã¶ã¯ã·ã§ã³ãç¡èŠããã¹ãã§ãã
ããŒã«ã«ããŒããããããã®è³éãè³ããŠããå Žåããªã¢ãŒãããŒããäžæ¹çã«éããªãããã«ããããã«ãããã¯ãã§ãŒã³ãç£èŠããå¿ èŠããããŸãã
ç¡å¹ãªãã©ã³ã¶ã¯ã·ã§ã³ïŒäŸãã°ãæªã眲åïŒã¯èª°ã§ãçæã§ããŸãïŒãããŠãããã¯ãã§ãŒã³ã«ãã£ãŠç¡èŠãããŸãïŒãããããã¯äœããã®ã¢ã¯ã·ã§ã³ãåŒãèµ·ããã¹ãã§ã¯ãããŸããã
ããŒã«ã«ããã³ãªã¢ãŒãããŒãã¯ãããã ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ ãä¿æããŠããŸãããããã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«ã¯æ倧㧠6 çš®é¡ã®ã¢ãŠããããããããŸãïŒ
- ããŒã«ã«ããŒãã®ã¡ã€ã³ã¢ãŠããããïŒãŒããŸã㯠1 ã€ã®ã¢ãŠããããã§ãããŒã«ã«ããŒã ã® delayed_pubkey ã«æ¯æããŸãã
- ãªã¢ãŒãããŒãã®ã¡ã€ã³ã¢ãŠããããïŒãŒããŸã㯠1 ã€ã®ã¢ãŠããããã§ããªã¢ãŒãããŒã ã® delayed_pubkey ã«æ¯æããŸãã
- ããŒã«ã«ããŒãã®ã¢ã³ã«ãŒã¢ãŠããããïŒ1 ã€ã®ã¢ãŠããããã§ãããŒã«ã«ããŒã ã® funding_pubkey ã«æ¯æããŸãã
- ãªã¢ãŒãããŒãã®ã¢ã³ã«ãŒã¢ãŠããããïŒ1 ã€ã®ã¢ãŠããããã§ããªã¢ãŒãããŒã ã® funding_pubkey ã«æ¯æããŸãã
- ããŒã«ã«ããŒããæäŸãã HTLCsïŒãŒããŸãã¯è€æ°ã®ä¿çäžã®æ¯æã (HTLCs) ã§ãæ¯æãã®ãã¬ã€ã¡ãŒãžãšåŒãæãã« ãªã¢ãŒãããŒã ã«æ¯æããŸãã
- ãªã¢ãŒãããŒããæäŸãã HTLCsïŒãŒããŸãã¯è€æ°ã®ä¿çäžã®æ¯æã (HTLCs) ã§ãæ¯æãã®ãã¬ã€ã¡ãŒãžãšåŒãæãã« ããŒã«ã«ããŒã ã«æ¯æããŸãã
ããŒã«ã«ããŒããšãªã¢ãŒãããŒããååããããã«ã€ã³ã»ã³ãã£ããäžããããã«ãOP_CHECKSEQUENCEVERIFY
çžå¯Ÿã¿ã€ã ã¢ãŠãã ããŒã«ã«ããŒãã®åºåïŒããŒã«ã«ããŒãã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³å
ïŒãš ãªã¢ãŒãããŒãã®åºåïŒãªã¢ãŒãããŒãã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³å
ïŒã«èª²ãããŸããããšãã°ãããŒã«ã«ããŒãããã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãå
¬éããå Žåãèªåã®è³éãè«æ±ããããã«åŸ
ã€å¿
èŠããããŸããããªã¢ãŒãããŒãã¯èªåã®è³éã«å³åº§ã«ã¢ã¯ã»ã¹ã§ããŸãããã®çµæã2ã€ã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã¯åäžã§ã¯ãããŸããããïŒéåžžïŒå¯Ÿç§°çã§ãã
詳现㯠BOLT #3: Commitment Transaction ãåç §ããŠãã ããã
ãã£ãã«ãéããæ¹æ³ã¯ããã€ããããŸãããæãå¹ççãªæ¹æ³ãæšå¥šãããŸãã
ããŸããŸãªãšã©ãŒã±ãŒã¹ããã£ãã«ãéããããšã«é¢äžããŸãããã¢ã«ãšã©ãŒã¡ãã»ãŒãžãéä¿¡ããããã®èŠä»¶ã¯ BOLT #1: The error
Message ã«æå®ãããŠããŸãã
ããŒãã¯ä»¥äžãè¡ããŸãïŒ
- ããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã
to_local
ãŸã㯠HTLC åºåãäžåºŠãå«ãã§ããªãå ŽåïŒ- ãã£ãã«ãåã«å¿ããŠãããŸããŸããã
- ãã以å€ã®å ŽåïŒ
- çŸåšã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã
to_local
ãŸãã¯ä»ã® HTLC åºåãå«ãã§ããªãå ŽåïŒ- ãªã¢ãŒãããŒãããã£ãã«ãéããã®ãåã«åŸ ã£ãŠãããŸããŸããã
- ãªã¢ãŒãããŒããéãããŸã§ïŒ
- ãã£ãã«ãå¿ããŠã¯ãªããŸããã
- ãã以å€ã®å ŽåïŒ
- ååãªææ°æãå«ãæå¹ãª
closing_signed
ã¡ãã»ãŒãžãåãåã£ãå ŽåïŒ- ãã®ææ°æã䜿çšã㊠çžäºã¯ããŒãº ãè¡ãã¹ãã§ãã
- ãã以å€ã®å ŽåïŒ
- ããŒãããã£ãã«ã®ç¶æ
ãå€ããšç¥ã£ãŠããããããä»®å®ããŠããå ŽåïŒ
- æåŸã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããããŒããã£ã¹ãããŠã¯ãªããŸããã
- ãã以å€ã®å ŽåïŒ
- æåŸã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãã眲åãæã£ãŠãããã®ããããŒããã£ã¹ãã㊠äžæ¹çã¯ããŒãº ãè¡ããªããã°ãªããŸããã
- ååãªææ°æãæäŸããŠ
to_local_anchor
åºåã䜿ããã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããããã¯ã«å«ããã€ã³ã»ã³ãã£ããäžããªããã°ãªããŸããã第äžè ã«æ¯æãéã«ã¯ç¹ã«æ³šæãå¿ èŠã§ããããã¯ãéã¢ã³ã«ãŒåºåã« CSV é 延ãè¿œå ããããšã§å¯ŸåŠãããè匱æ§ãåå°å ¥ããããšã«ãªãããã§ãã - ååŒããããã¯ã«è¿ éã«å«ãŸããã®ã«äžååã§ããå Žåãreplace-by-fee ãŸãã¯ä»ã®ã¡ã«ããºã ã䜿çšããã¹ãã§ãã
- ããŒãããã£ãã«ã®ç¶æ
ãå€ããšç¥ã£ãŠããããããä»®å®ããŠããå ŽåïŒ
- ååãªææ°æãå«ãæå¹ãª
- çŸåšã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã
dust_limit_satoshis
ã¯éçµæžçãªã¢ãŠããããã®äœæãé²ãããã®ãã®ã§ããïŒããã§ãªããã°ãããã¯ãã§ãŒã³äžã§æ°žé ã«æªäœ¿çšã®ãŸãŸæ®ã£ãŠããŸããŸãïŒããã¹ãŠã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã®ã¢ãŠããããã¯æ¶è²»ãããªããã°ãªããŸããã
ãã£ãã«ã®åæ段éã§ã¯ãäžæ¹ããã£ãã«å ã«ã»ãšãã©ãŸãã¯å šãè³éãæããªãããšãäžè¬çã§ãããã®å Žåããªã¹ã¯ããªããããããŒãã¯ãã£ãã«ã®ç¶æ ãç£èŠããããã®ãªãœãŒã¹ãæ¶è²»ããå¿ èŠã¯ãããŸããã
çžäºã¯ããŒãºã¯äžæ¹çãªã¯ããŒãºããã奜ãŸããåŸåããããŸãããªããªããåè
ã®ã¢ãŠããããã¯é
延ã«ãã£ãŠå¶çŽãããããŠã©ã¬ããã«ãã£ãŠçŽæ¥æ¶è²»å¯èœã ããã§ããããã«ãçžäºã¯ããŒãºã®ææ°æã¯ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã®ææ°æïŒãŸã㯠option_anchors
ã®å Žåãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããã€ãã³ã°ãããããã«åãã©ã³ã¶ã¯ã·ã§ã³ãå¿
èŠãšãããããããŸããïŒãããèªåŒµãããããšãå°ãªãåŸåããããŸãããããã£ãŠãclosing_signed
ã®çœ²åã䜿çšããªãå¯äžã®çç±ã¯ãæ瀺ãããææ°æãåŠçãããã«ã¯å°ããããå Žåã§ãã
ã¯ããŒãºãã©ã³ã¶ã¯ã·ã§ã³ã¯ãã¡ã³ãã£ã³ã°ãã©ã³ã¶ã¯ã·ã§ã³ã®ã¢ãŠããããã解決ããŸãã
çžäºã¯ããŒãºã®å ŽåãããŒãã¯ä»ã«äœãããå¿
èŠã¯ãããŸããããã§ã«åæããã¢ãŠãããããæå®ããã scriptpubkey
ã«éä¿¡ãããããã§ãïŒBOLT #2: ã¯ããŒãºã®éå§: shutdown
ãåç
§ïŒã
ããã¯äžæ¹çãªã¯ããŒãºã«é¢ããäºã€ã®ã±ãŒã¹ã®ãã¡ã®äžã€ã§ãããã®å ŽåãããŒãã¯èªåã®ããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãçºèŠããããããã¡ã³ãã£ã³ã°ãã©ã³ã¶ã¯ã·ã§ã³ã®ã¢ãŠããããã解決ããŸãã
ããããããŒãã¯äžæ¹çãªã¯ããŒãºãéå§ããå Žåããã®ã¢ãŠããããããè³éãååŸããããšã¯ã§ããŸãããOP_CHECKSEQUENCEVERIFY
ã®é
延ãçµéãããŸã§ã¯ïŒãªã¢ãŒãããŒãã® to_self_delay
ãã£ãŒã«ãã§æå®ãããŠããŸãïŒãé¢é£ããå Žåããã®ç¶æ³ã¯ä»¥äžã«èšèŒãããŠããŸãã
ããŒãã¯ä»¥äžãè¡ããŸãïŒ
- ããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãçºèŠããå ŽåïŒ
to_local
ã¢ãŠããããã䟿å©ãªã¢ãã¬ã¹ã«æ¶è²»ããã¹ãã§ããOP_CHECKSEQUENCEVERIFY
ã®é 延ãçµéãããŸã§ïŒãªã¢ãŒãããŒãã®to_self_delay
ãã£ãŒã«ãã§æå®ãããŠããŸãïŒã¢ãŠãããããæ¶è²»ããŠã¯ãããŸããã- 泚ïŒã¢ãŠãããããæ¶è²»ãããå ŽåïŒæšå¥šãããããã«ïŒããã®ã¢ãŠããããã¯æ¶è²»ãã©ã³ã¶ã¯ã·ã§ã³ã«ãã£ãŠè§£æ±ºãããŸããããã§ãªããã°ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠè§£æ±ºããããšèŠãªãããŸãã
to_remote
ã¢ãŠãããããç¡èŠããŠãããŸããŸããã- 泚ïŒããŒã«ã«ããŒãã«ããã¢ã¯ã·ã§ã³ã¯äžèŠã§ãã
to_remote
ã¯ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠè§£æ±ºããããšèŠãªãããŸãã
- 泚ïŒããŒã«ã«ããŒãã«ããã¢ã¯ã·ã§ã³ã¯äžèŠã§ãã
- èªåèªèº«ã«ãã£ãŠæäŸããã HTLC ã以äžã«æå®ãããããã«åŠçããªããã°ãªããŸããïŒHTLC Output Handling: Local Commitment, Local Offersã
- ãªã¢ãŒãããŒãã«ãã£ãŠæäŸããã HTLC ã以äžã«æå®ãããããã«åŠçããªããã°ãªããŸããïŒHTLC Output Handling: Local Commitment, Remote Offersã
to_local
åºåã䜿ãããšã§ãåŸã§äœ¿ãããã«ç¹å®ã®ãã£ãã«ã«é¢é£ä»ããããè€éãªèšŒäººã¹ã¯ãªãããèŠããŠããå¿
èŠããªããªããŸãã
to_remote
åºåã¯å®å
šã«ãªã¢ãŒãããŒãã®åé¡ã§ãããç¡èŠããŠããŸããŸããã
å HTLC åºåã¯ãããŒã«ã«ãªãã¡ãŒè ãã¿ã€ã ã¢ãŠãåŸã« HTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããŠæ¶è²»ãããããªã¢ãŒãåå人 ãæ¯æããã¬ã€ã¡ãŒãžãæã£ãŠããå Žåã«ã®ã¿æ¶è²»ã§ããŸãã
HTLC ã¯ããã¹ããšããŠããªãã³ã°ããããããã©ã³ã¶ã¯ã·ã§ã³ãéšåçã«ããã³ããããããŠããªããããåºåãšããŠè¡šãããªãå ŽåããããŸãã
HTLC åºåã¯ãææ°ã®ãããã¯ã®é«ãã HTLC cltv_expiry
以äžã«ãªã£ããšãã« ã¿ã€ã ã¢ãŠã ããŸãã
ããŒãã¯ä»¥äžãè¡ããŸãïŒ
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã® HTLC åºåãæ¯æããã¬ã€ã¡ãŒãžã䜿çšããŠæ¶è²»ãããå Žåããã®åºå㯠äžå¯éçã«è§£æ±ºããã ãšèŠãªãããŸãïŒ
- ãã©ã³ã¶ã¯ã·ã§ã³å ¥å蚌人ããæ¯æããã¬ã€ã¡ãŒãžãæœåºããªããã°ãªããŸããã
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã® HTLC åºåã ã¿ã€ã ã¢ãŠã ãã解決 ãããŠããªãå ŽåïŒ
- HTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããŠåºåã 解決 ããªããã°ãªããŸããã
- 解決ãã©ã³ã¶ã¯ã·ã§ã³ãé©åãªæ·±ãã«éãããïŒ
- 察å¿ããåä¿¡ HTLCïŒããå ŽåïŒã倱æãããªããã°ãªããŸããã
- ãã® HTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ã®åºåã解決ããªããã°ãªããŸããã
- HTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ã䟿å©ãªã¢ãã¬ã¹ã«ééããŠè§£æ±ºããããšãæšå¥šããŸãã
- 泚ïŒåºåãæ¶è²»ãããå ŽåïŒæšå¥šãããããã«ïŒãåºåã¯æ¶è²»ãã©ã³ã¶ã¯ã·ã§ã³ã«ãã£ãŠ 解決 ãããŸããããã§ãªãå Žåã¯ãHTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠ 解決 ããããšèŠãªãããŸãã
OP_CHECKSEQUENCEVERIFY
ã®é 延ãçµéãããŸã§åŸ ããªããã°ãªããŸããïŒãªã¢ãŒãããŒãã®open_channel
to_self_delay
ãã£ãŒã«ãã§æå®ãããŠããããã«ïŒãã® HTLC-timeout åºåãæ¶è²»ããåã«ã
- ãã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«åºåããªãã³ãããããã HTLC ã«ã€ããŠïŒ
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãé©åãªæ·±ãã«éãããïŒ
- 察å¿ããåä¿¡ HTLCïŒããå ŽåïŒã倱æãããªããã°ãªããŸããã
- HTLC ã«å¯Ÿå¿ããåºåãå«ã æå¹ãª ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããªãå Žåã
- 察å¿ããåä¿¡ HTLC ãæ©ãã«å€±æãããŠãããŸããŸããã
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãé©åãªæ·±ãã«éãããïŒ
æ¯æãã®ãã¬ã€ã¡ãŒãžã¯ãæ¯æãã蚌æããããïŒæäŸããŒããæ¯æããéå§ããå ŽåïŒãŸãã¯å¥ã®ãã¢ããã®å¯Ÿå¿ããåä¿¡ HTLC ãåŒãæããããïŒæäŸããŒããæ¯æãã転éããŠããå ŽåïŒã«äœ¿çšãããŸããããŒããæ¯æããæœåºããåŸã¯ãHTLC ãæ¶è²»ãããã©ã³ã¶ã¯ã·ã§ã³èªäœã®éåœã«ã¯é¢å¿ããªããªããŸãã
äž¡æ¹ã®è§£æ±ºãå¯èœãªå ŽåïŒäŸãã°ãããŒããã¿ã€ã ã¢ãŠãåŸã«æ¯æãæåãåãåã£ãå ŽåïŒãã©ã¡ãã®è§£éãåãå ¥ããããŸãããã®å Žåãåå人ããããçºçããåã«æ¶è²»ãã責任ããããŸãã
ããŒã«ã« HTLC ã¿ã€ã ã¢ãŠããã©ã³ã¶ã¯ã·ã§ã³ã¯ããªã¢ãŒãããŒãããããå±¥è¡ããŠè³éãè«æ±ããã®ãé²ãããã«ãHTLC ãã¿ã€ã ã¢ãŠããããããã«äœ¿çšããå¿
èŠããããŸãããã®åŸãããŒã«ã«ããŒãã¯å¯Ÿå¿ããåä¿¡ HTLC ã update_fail_htlc
ïŒããããçç±ã¯ permanent_channel_failure
ïŒã䜿çšããŠããã¯ãã§ã€ã«ã§ããŸãã詳现㯠BOLT #2 ã«èšèŒãããŠããŸããåä¿¡ HTLC ããªã³ãã§ãŒã³ã«ããå ŽåãããŒãã¯åã«ã¿ã€ã ã¢ãŠããåŸ
ã€å¿
èŠããããŸããæ©æ倱æãéç¥ããæ¹æ³ã¯ãããŸããã
HTLC ã ãããªãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ ã«ãçŸããªãã»ã©å°ããå Žåãããã¯å³åº§ã«å®å šã«å€±æãããããšãã§ããŸããããã§ãªãå ŽåãHTLC ã ããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ ã«å«ãŸããŠããªãå ŽåãããŒãã¯ãããã¯ãã§ãŒã³ã®åç·šæã競äºããããŒããããã倱æãããåã« HTLC ãå«ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«åãæ¿ãããªãããã«ç¢ºèªããå¿ èŠããããŸãïŒãããã£ãŠåŸ æ©ãå¿ èŠã§ãïŒãåä¿¡ HTLC ããã®ã¿ã€ã ã¢ãŠãåã«å€±æããå¿ èŠããããšããèŠä»¶ã¯ãäžéãšããŠäŸç¶ãšããŠé©çšãããŸãã
å HTLC åºåã¯ãåå人ãæ¯æãã®ãã¬ã€ã¡ãŒãžãæã£ãŠããå Žåã«ã®ã¿ãHTLC æåãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããŠæ¶è²»ã§ããŸãããã¬ã€ã¡ãŒãžãæã£ãŠããªãå ŽåïŒãããŠãããçºèŠããªãå ŽåïŒããªãã¡ãŒåŽãã¿ã€ã ã¢ãŠãåŸã« HTLC åºåãæ¶è²»ãã責任ããããŸãã
æäŸããã HTLC ã«ã¯ããã€ãã®å¯èœæ§ããããŸãïŒ
- ãªãã¡ãŒåŽãããã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããªããåå人ã¯éåžžããã¬ã€ã¡ãŒãžãç¥ããªãã§ãããããªããªããå®å šã«ã³ãããããããŸã§ HTLC ã転éããªãããã§ãããããã£ãŠããã¬ã€ã¡ãŒãžã䜿çšãããšããã®åå人ãæçµãããã§ããããšãæããã«ãªããŸãããã®å ŽåãHTLC ãã¿ã€ã ã¢ãŠããããã®ãæåã§ãã
- ãªãã¡ãŒåŽãæäŸããã HTLC ã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããããåå人ããŸã éä¿¡ HTLC ã«ã³ãããããŠããªãããã®å Žåãåå人ã¯æäŸããã HTLC ã転éãããã¿ã€ã ã¢ãŠããããããšãã§ããŸãã
- åå人ãæäŸããã HTLC ãšåŒãæãã«éä¿¡ HTLC ã«ã³ãããããŠããããã®å Žåãåå人ã¯éä¿¡ HTLC ãããã¬ã€ã¡ãŒãžãåãåã£ããããã䜿çšããªããã°ãªããŸãããããããªããšãåä¿¡æ¯æããåŒãæããã«éä¿¡æ¯æããéä¿¡ããããšã§è³éã倱ãããšã«ãªããŸãã
ããŒã«ã«ããŒãïŒ
- æªè§£æ±ºã® HTLC åºåã«å¯ŸããŠãæ¯æãã®ãã¬ã€ã¡ãŒãžãåãåã£ãïŒãŸãã¯æ¢ã«æã£ãŠããïŒå Žåã§ããã€éä¿¡ HTLC ã«ã³ãããããŠããå ŽåïŒ
- HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããŠããããæ¶è²»ããããšã§åºåã解決ããªããã°ãªããŸããã
- èªåãæçµåå人ã§ãªãå Žåãèªåã®ãã¬ã€ã¡ãŒãžãå ¬éããŠã¯ãªããŸãããPreimage-Extraction
- ãã® HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ã®åºåã解決ããªããã°ãªããŸããã
- ãã以å€ã®å ŽåïŒ
- ãªã¢ãŒãããŒãã HTLC ã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããªãå ŽåïŒ
- ãããæ¶è²»ããããšã§åºåã解決ããŠã¯ãªããŸããã
- ãªã¢ãŒãããŒãã HTLC ã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããªãå ŽåïŒ
- ãã® HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ã®åºåãã䟿å©ãªã¢ãã¬ã¹ã«æ¶è²»ããããšã§è§£æ±ºããã¹ãã§ãã
OP_CHECKSEQUENCEVERIFY
ã®é 延ãçµéãããŸã§åŸ ããªããã°ãªããŸããïŒãªã¢ãŒãããŒãã®open_channel
ã®to_self_delay
ãã£ãŒã«ãã§æå®ãããŠããéãïŒããã® HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ã®åºåãæ¶è²»ããåã«ã
åºåãæ¶è²»ãããå ŽåïŒæšå¥šãããããã«ïŒãæ¶è²»ãã©ã³ã¶ã¯ã·ã§ã³ã«ãã£ãŠåºåã解決ãããŸããããã§ãªãå Žåã¯ãHTLC-success ãã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠè§£æ±ºããããšèŠãªãããŸãã
ä»ã«è§£æ±ºãããªãå ŽåãHTLC åºåãæéåãã«ãªããšãããã¯äžå¯éçã«è§£æ±ºããããšèŠãªãããŸãã
ãªã¢ãŒãããŒãã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã¯ãè³éãã©ã³ã¶ã¯ã·ã§ã³ã®åºåã解決ããŸãã
ãã®å ŽåãããŒãã®åäœãå¶çŽããé 延ã¯ãªããããããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãçºèŠããå ŽåãããããŒãã«ãšã£ãŠæ±ããããã§ãïŒäžæ¹çãªã¯ããŒãºåŠçïŒããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãåç §ïŒã
ããŒã«ã«ããŒãïŒ
- ãªã¢ãŒãããŒãã«ãã£ãŠãããŒããã£ã¹ããããæå¹ãªã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãçºèŠããå ŽåïŒ
- å¯èœã§ããã°ïŒ
- 以äžã«æå®ãããéãã«ååºåãåŠçããªããã°ãªããŸããã
- é¢é£ãã
to_remote
ã«é¢ããŠã¯ãäœãè¡ããªããŠãããã§ããããã¯åã«ããŒã«ã«ããŒããžã® P2WPKH åºåã§ãã- 泚ïŒ
to_remote
ã¯ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠè§£æ±ºããããšèŠãªãããŸãã
- 泚ïŒ
- é¢é£ãã
to_local
ã«é¢ããŠã¯ãäœãè¡ããªããŠãããã§ããããã¯ãªã¢ãŒãããŒããžã®æ¯æãåºåã§ãã- 泚ïŒ
to_local
ã¯ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠè§£æ±ºããããšèŠãªãããŸãã
- 泚ïŒ
- èªåèªèº«ãæäŸãã HTLC ã HTLC åºååŠçïŒãªã¢ãŒãã³ãããã¡ã³ããããŒã«ã«ãªãã¡ãŒ ã«æå®ãããéãã«åŠçããªããã°ãªããŸããã
- ãªã¢ãŒãããŒããæäŸãã HTLC ã HTLC åºååŠçïŒãªã¢ãŒãã³ãããã¡ã³ãããªã¢ãŒããªãã¡ãŒ ã«æå®ãããéãã«åŠçããªããã°ãªããŸããã
- ãã以å€ã®å ŽåïŒäœããã®çç±ã§ãããŒããã£ã¹ããåŠçã§ããªãå ŽåïŒïŒ
- æœåšçã«å€±ãããè³éã«ã€ããŠãŠãŒã¶ã«éç¥ããªããã°ãªããŸããã
- å¯èœã§ããã°ïŒ
commitment_signed
ãéããŠçœ²åãåãåãããåŸã察å¿ãã revoke_and_ack
ã®åã«ãè€æ°ã®æå¹ãª æªåãæ¶ã ã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãååšããå¯èœæ§ããããŸãããã®ãããã©ã¡ãã®ã³ãããã¡ã³ãã ãªã¢ãŒãããŒã ã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãšããŠæ©èœããå¯èœæ§ããããããŒã«ã«ããŒãã¯äž¡æ¹ãåŠçããå¿
èŠããããŸãã
ããŒã¿æ倱ãçºçããå ŽåãããŒã«ã«ããŒã㯠ãªã¢ãŒãããŒã ã®ãã¹ãŠã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã® HTLC åºåãèªèã§ããªãç¶æ
ã«éããããšããããŸããããã¯ããã©ã³ã¶ã¯ã·ã§ã³ã«çœ²åããŠãããã³ãããã¡ã³ãçªå·ãäºæ³ãã倧ããããšããããŒã¿æ倱ç¶æ
ãæ€åºã§ããŸãããã©ã³ã¶ã¯ã·ã§ã³ã®ããã«èªåã® remotepubkey
ãå°ãåºããèªåã®è³éãååããããšãã§ããŸãã泚æïŒãã®ã·ããªãªã§ã¯ãããŒã㯠HTLC ãååããããšãã§ããŸããã
å HTLC åºåã¯ãã¿ã€ã ã¢ãŠãåŸã« ããŒã«ã«ãªãã¡ãŒè ã«ãã£ãŠããŸãã¯æ¯æããã¬ã€ã¡ãŒãžãæã£ãŠããå Žåã« HTLC æåãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšã㊠ãªã¢ãŒãåå人 ã«ãã£ãŠã®ã¿æ¶è²»ãããŸãã
åºåããã¹ããšããŠããªã ãããããããŸãã¯ãªã¢ãŒãããŒããç°ãªã HTLC ãæ〠2 ã€ã® æå¹ãª ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãæã£ãŠãããããåºåã§è¡šãããŠããªã HTLC ãååšããããšããããŸãã
HTLC åºåã¯ãææ°ã®ãããã¯ã®æ·±ãã HTLC cltv_expiry
以äžã«ãªã£ããšãã« ã¿ã€ã ã¢ãŠã ããŸãã
ããŒã«ã«ããŒãã¯ïŒ
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã® HTLC åºåãæ¯æããã¬ã€ã¡ãŒãžã䜿çšããŠæ¶è²»ãããå ŽåïŒ
- HTLC æåãã©ã³ã¶ã¯ã·ã§ã³ã®å
¥å蚌人ããæ¯æããã¬ã€ã¡ãŒãžãæœåºããªããã°ãªããŸããã
- 泚æïŒåºå㯠äžå¯éçã«è§£æ±ºããã ãšèŠãªãããŸãã
- HTLC æåãã©ã³ã¶ã¯ã·ã§ã³ã®å
¥å蚌人ããæ¯æããã¬ã€ã¡ãŒãžãæœåºããªããã°ãªããŸããã
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã® HTLC åºåã ã¿ã€ã ã¢ãŠã ãã解決 ãããŠããªãå ŽåïŒ
- åºåã䟿å©ãªã¢ãã¬ã¹ã«ééã㊠解決 ããªããã°ãªããŸããã
- ãã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«åºåããªãã³ãããããã HTLC ã«å¯ŸããŠïŒ
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãé©åãªæ·±ãã«éãããïŒ
- 察å¿ããåä¿¡ HTLCïŒããå ŽåïŒã倱æãããªããã°ãªããŸããã
- ããã§ãªãå ŽåïŒ
- æå¹ãª ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã« HTLC ã«å¯Ÿå¿ããåºåãå«ãŸããŠããªãå ŽåïŒ
- æ©ãã«å€±æãããŠãããŸããŸããã
- æå¹ãª ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã« HTLC ã«å¯Ÿå¿ããåºåãå«ãŸããŠããªãå ŽåïŒ
- ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãé©åãªæ·±ãã«éãããïŒ
ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããªã¢ãŒãããŒãã«å±ããå ŽåãHTLCåºåãæ¯åºããå¯äžã®æ¹æ³ïŒæ¯æããã¬ã€ã¡ãŒãžã䜿çšããïŒã¯ãHTLC-successãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããããšã§ãã
æ¯æããã¬ã€ã¡ãŒãžã¯ãæ¯æãã®èšŒæãšããŠæ©èœãããïŒæäŸããŒããæ¯æãã®çºä¿¡è ã§ããå ŽåïŒãå¥ã®ãã¢ããã®å¯Ÿå¿ããåä¿¡HTLCãåŒãæããããã«äœ¿çšãããŸãïŒæäŸããŒããæ¯æãã転éããŠããå ŽåïŒãããŒããæ¯æããåãåã£ãåŸã¯ãHTLCæ¯åºãã©ã³ã¶ã¯ã·ã§ã³èªäœã®éåœãæ°ã«ããå¿ èŠã¯ãããŸããã
äž¡æ¹ã®è§£æ±ºçãå¯èœãªå ŽåïŒäŸïŒããŒããã¿ã€ã ã¢ãŠãåŸã«æ¯æãæåãåãåãå ŽåïŒãã©ã¡ãã®è§£éãåãå ¥ããããŸããåå人ããããçºçããåã«ãããæ¯åºãã責任ããããŸãã
ã¿ã€ã ã¢ãŠãããåŸãããŒã«ã«ããŒãã¯HTLC-successãã©ã³ã¶ã¯ã·ã§ã³ããªã¢ãŒãããŒãã䜿çšããã®ãé²ãããã«ãHTLCåºåãæ¯åºããå¿
èŠããããŸãããã®åŸã察å¿ããåä¿¡HTLCãupdate_fail_htlc
ïŒããããçç±ã¯permanent_channel_failure
ïŒã䜿çšããŠããã¯ãã§ã€ã«ã§ããŸãã詳现ã¯BOLT #2ã«èšèŒãããŠããŸãã
åä¿¡HTLCããªã³ãã§ãŒã³ã«ããå ŽåãããŒãã¯åã«ã¿ã€ã ã¢ãŠããåŸ
ã¡ãŸããæ©æ倱æãéç¥ããæ¹æ³ããªãããã§ãã
HTLCããããªãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«ãçŸããªãã»ã©å°ããå Žåãããã¯å³åº§ã«å®å šã«å€±æãããããšãã§ããŸããããã§ãªãå ŽåãHTLCãããŒã«ã«ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«ãªãå ŽåãããŒãã¯ãããã¯ãã§ãŒã³ã®åç·šæã競äºããããå«ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«åãæ¿ãããªãããšã確èªããå¿ èŠããããŸãããã®ãããåŸ æ©ãå¿ èŠã§ããåä¿¡HTLCãèªèº«ã®ã¿ã€ã ã¢ãŠãåã«å€±æããå¿ èŠããããšããèŠä»¶ã¯ãäžéãšããŠäŸç¶ãšããŠé©çšãããŸãã
ãªã¢ãŒãHTLCåºåã¯ãããŒã«ã«ããŒããæ¯æããã¬ã€ã¡ãŒãžãæã£ãŠããå Žåã«ã®ã¿æ¯åºã§ããŸããããŒã«ã«ããŒãããã¬ã€ã¡ãŒãžãæã£ãŠããªãïŒãŸãã¯çºèŠããªãïŒå ŽåãHTLCåºåãã¿ã€ã ã¢ãŠãããåŸã«ãããæ¯åºããã®ã¯ãªã¢ãŒãããŒãã®è²¬ä»»ã§ãã
æäŸãããHTLCã«ã¯å®éã«ããã€ãã®å¯èœæ§ããããŸãïŒ
- æäŸè ãããã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããªãããã®å Žåãåå人ã¯éåžžãã¬ã€ã¡ãŒãžãç¥ããªãã§ããããHTLCãå®å šã«ã³ãããããããŸã§è»¢éããªãããã§ãããã¬ã€ã¡ãŒãžã䜿çšãããšããã®åå人ãæçµãããã§ããããšãæããã«ãªããããHTLCãã¿ã€ã ã¢ãŠãããã®ãèš±ãã®ãæåã§ãã
- æäŸè ãæäŸãããHTLCã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããããåå人ããŸã éä¿¡HTLCã«ã³ãããããŠããªãããã®å Žåãåå人ã¯ããã転éããããã¿ã€ã ã¢ãŠããåŸ ã€ããšãã§ããŸãã
- åå人ãæäŸãããHTLCãšåŒãæãã«éä¿¡HTLCã«ã³ãããããŠããããã®å Žåãåå人ã¯éä¿¡HTLCãããã¬ã€ã¡ãŒãžãåãåã£ãå Žåãããã䜿çšããªããã°ãªããŸãããããã§ãªããã°ãåä¿¡æ¯æããåŒãæããã«éä¿¡æ¯æããéãããšã§è³éã倱ãããšã«ãªããŸãã
ããŒã«ã«ããŒãïŒ
- æªè§£æ±ºã® HTLC åºåã«å¯ŸããŠãæ¯æãã®ãã¬ã€ã¡ãŒãžãåãåã£ãïŒãŸãã¯æ¢ã«æã£ãŠããïŒå Žåã§ããã€éä¿¡ HTLC ã«ã³ãããããŠããå ŽåïŒ
- åºåã䟿å©ãªã¢ãã¬ã¹ã«ééããããšã§è§£æ±ºããªããã°ãªããŸããã
- ãã以å€ã®å ŽåïŒ
- ãªã¢ãŒãããŒãã HTLC ã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããªãå ŽåïŒ
- åºåãééããããšã§è§£æ±ºããŠã¯ãããŸããã
- ãªã¢ãŒãããŒãã HTLC ã«å¯ŸããŠäžå¯éçã«ã³ãããããŠããªãå ŽåïŒ
ä»ã«è§£æ±ºãããªãå ŽåãHTLC åºåãæéåãã«ãªããšãããã¯äžå¯éçã«è§£æ±ºããããšèŠãªãããŸãã
ããä»»æã®ããŒããå€ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ïŒææ°ã®ãã®ä»¥å€ã®ä»¥åã®ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ïŒããããŒããã£ã¹ãããŠäžæ£ãè©Šã¿ãå Žåããã£ãã«ã®ããäžæ¹ã®ããŒãã¯åãæ¶ãç§å¯éµã䜿çšããŠããã£ãã«ã®å ã®è³é調éãã©ã³ã¶ã¯ã·ã§ã³ãããã¹ãŠã®è³éãè«æ±ã§ããŸãã
ããŒããèªåã®åãæ¶ãç§å¯éµãæã€ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ãçºèŠããå Žåãè³é調éãã©ã³ã¶ã¯ã·ã§ã³ã®åºåã¯è§£æ±ºãããŸãã
ããŒã«ã«ããŒãïŒ
- èªåã
per_commitment_secret
ãå ¬éããã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããããŒããã£ã¹ãããŠã¯ãããŸããã - ããŒã«ã«ããŒãã®ã¡ã€ã³åºå ã«é¢ããŠã¯ãäœãè¡ããªããŠãããã§ããããã¯èªåèªèº«ãžã®åçŽãª P2WPKH åºåã§ãã
- 泚ïŒãã®åºåã¯ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³èªäœã«ãã£ãŠè§£æ±ºããããšèŠãªãããŸãã
- åãæ¶ãç§å¯éµã䜿çšããŠããªã¢ãŒãããŒãã®ã¡ã€ã³åºå ã解決ããªããã°ãªããŸããã
- ãªã¢ãŒãããŒãã®æäŸãã HTLC ã次ã®ããããã®æ¹æ³ã§è§£æ±ºããªããã°ãªããŸããïŒ
- æ¯æãåãæ¶ãç§å¯éµã䜿çšããŠã³ãããã¡ã³ã tx ãééããã
- æ¯æããã¬ã€ã¡ãŒãžã䜿çšããŠã³ãããã¡ã³ã tx ãééããïŒæ¢ç¥ã®å ŽåïŒã
- ãªã¢ãŒãããŒããå ¬éããå ŽåãHTLC-timeout tx ãééããã
- ããŒã«ã«ããŒãã®æäŸãã HTLC ã次ã®ããããã®æ¹æ³ã§è§£æ±ºããªããã°ãªããŸããïŒ
- æ¯æãåãæ¶ãç§å¯éµã䜿çšããŠã³ãããã¡ã³ã tx ãééããã
- HTLC ã®ã¿ã€ã ã¢ãŠããéããåŸã«ã³ãããã¡ã³ã tx ãééããã
- ãªã¢ãŒãããŒããå ¬éããå ŽåãHTLC-success tx ãééããã
- åãæ¶ãç§å¯éµã䜿çšããŠããªã¢ãŒãããŒãã® HTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ ã解決ããªããã°ãªããŸããã
- åãæ¶ãç§å¯éµã䜿çšããŠããªã¢ãŒãããŒãã® HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ ã解決ããªããã°ãªããŸããã
- æ¢ã«ç¥ãããŠããªãå Žåããã©ã³ã¶ã¯ã·ã§ã³å ¥åã®èšŒäººããæ¯æããã¬ã€ã¡ãŒãžãæœåºããã¹ãã§ãã
option_anchors
ãé©çšãããå ŽåïŒ- åäžã®ãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããŠãã¹ãŠã®åºåã解決ããŠãããã§ãã
- æéãã
security_delay
ãããã¯ã«éããåã«ç¢ºèªãè¡ãããªãå ŽåïŒ- åãæ¶ãããåºåãããããã®ç¬ç«ããããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã§è§£æ±ºããã¹ãã§ããè€æ°ã®åãæ¶ãããåºåãäžåºŠã«è«æ±ãã以åã®ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã¯ããã©ã³ã¶ã¯ã·ã§ã³ãã³ãã³ã°æ»æã«ãã£ãŠç¢ºèªã劚ããããå¯èœæ§ããããŸãã
- ãã以å€ã®å ŽåïŒ
- åäžã®ãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããŠãã¹ãŠã®åºåã解決ããŠãããã§ãã
- HTLC ãã©ã³ã¶ã¯ã·ã§ã³ã«ãã£ãŠç¡å¹åããããã©ã³ã¶ã¯ã·ã§ã³ãåŠçããªããã°ãªããŸããã
ãã¹ãŠã®åºåã解決ããåäžã®ãã©ã³ã¶ã¯ã·ã§ã³ã¯ãåããŒãã£ãŒããã 483 HTLC ã®å¶éïŒBOLT #2 ãåç §ïŒã«ãããæšæºãµã€ãºã®å¶éå ã«åãŸããŸãã
泚æ: option_anchors
ãé©çšãããå Žåãäžæ£è¡çºãè¡ãããŒã㯠SIGHASH_SINGLE ã®å¯éæ§ãå©çšããŠããã® HTLC-timeout/HTLC-success åºåã®æ¯åºãåºå®ã§ããŸãããã®ããããã¹ãŠã®åãæ¶ãããåºåã«å¯ŸããŠåäžã®ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã䜿çšããããšã¯å®å
šã§ã¯ãããŸãããããã¯ãããŒã«ã«ããŒãã® to_local
åºå ã®çžå¯Ÿããã¯ã¿ã€ã ãæºäºãããŸã§äŒæã劚ããããäžæ£è¡çºãè¡ã£ãããŒãã£ãŒããã®åºåã«å¯Ÿããããã«ãã£ãéããå¯èœæ§ãããããã§ãããã ãããã®ç¶æ³ã¯ãåºå®ãã©ã³ã¶ã¯ã·ã§ã³ã確èªãããå Žåã«ã第äºã¬ãã«ã®åãæ¶ãããåºåã«å¯Ÿããæ£åœãªçœ°ã劚ãããã®ã§ã¯ãããŸããã
security_delay
ã¯ãåãæ¶ãããåºåã®çµ¶å¯Ÿæéã«å¯Ÿããåºå®ãã€ã³ãã§ããã眰ãäžããããŒããåãæ¶ãããåºåã«å¯ŸããŠåäžæ¯åºãã©ã³ã¶ã¯ã·ã§ã³ããããŒããã£ã¹ããããã®ç¢ºèªãå®äºãããŸã§ç©æ¥µçã«ææ°æãåŒãäžããå¿
èŠããããŸããsecurity_delay
ã®æ£ç¢ºãªå€ã¯ããŒãããªã·ãŒã«å§ããããŠããŸããã18 ãããã¯ïŒåä¿¡ HTLC ã®ç· åã«é¡äŒŒïŒãæšå¥šããŸãã
ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã«ã¯ 3 ã€ã®ç°ãªãã¹ã¯ãªããããããããããã®èšŒè·¡ééã¯ä»¥äžã®éãã§ãïŒééèšç®ã®è©³çŽ°ã¯ ä»é² A ã«ãããŸãïŒïŒ
to_local_penalty_witness: 160 bytes
offered_htlc_penalty_witness: 243 bytes
accepted_htlc_penalty_witness: 249 bytes
ããã«ã㣠txinput èªäœã¯ 41 ãã€ããå ããéé㯠164 ãã€ãã§ããããã«ãããåå ¥åã®ééã¯æ¬¡ã®ããã«ãªããŸãïŒ
to_local_penalty_input_weight: 324 bytes
offered_htlc_penalty_input_weight: 407 bytes
accepted_htlc_penalty_input_weight: 413 bytes
ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã®æ®ãã¯ã4+1+1+8+1+34+4=53 ãã€ãã®é蚌跡ããŒã¿ãå ããŸããããã¯ã2 ãã€ãã®èšŒè·¡ããããŒã«å ããŠãæ¯æãå ã®èšŒè·¡ã¹ã¯ãªããããã·ã¥ïŒæ倧ã®æšæºåºåã¹ã¯ãªããïŒãæã€ãšä»®å®ããŸãã
ãããã®åºåãæ¯åºããããšã«å ããŠãããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã¯ãªãã·ã§ã³ã§ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã® to_remote
åºåãæ¯åºããããšãã§ããŸãïŒäŸïŒææ°æãšããŠæ¯æãããç·é¡ãæžããããïŒããããè¡ãã«ã¯ãP2WPKH 蚌跡ãšè¿œå ã® txinput ãå«ããå¿
èŠããããè¿œå 㧠108 + 164 = 272 ãã€ããå¿
èŠã§ãã
ææªã®ã·ããªãªã§ã¯ãããŒãã¯åä¿¡ HTLC ã®ã¿ãä¿æããHTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ãå ¬éããããããŒããã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ããæ¯åºããããšãäœåãªããããŸãã
æšæºã®æ倧ééã 400000 ãã€ãã®å Žåãåäžã®ãã©ã³ã¶ã¯ã·ã§ã³ã§ã¹ã€ãŒãã§ãã HTLC ã®æ倧æ°ã¯æ¬¡ã®ãšããã§ãïŒ
max_num_htlcs = (400000 - 324 - 272 - (4 * 53) - 2) / 413 = 966
ãããã£ãŠã483 ã®åæ¹å HTLCïŒto_local
ãš to_remote
åºåãå«ãïŒãåäžã®ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã§è§£æ±ºã§ããŸãã泚æïŒto_remote
åºåãã¹ã€ãŒããããªãå Žåã§ããçµæãšããŠåŸããã max_num_htlcs
㯠967 ã§ããã483 HTLC ã®åãäžæ¹åå¶éããããããŸãã
option_anchors
ãã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã«é©çšãããªãå ŽåãHTLC-timeout ããã³ HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ã¯å®å
šãªãã©ã³ã¶ã¯ã·ã§ã³ã§ãããïŒããŸãããã°ïŒïŒåççãªææ°æãæã¡ãçŽæ¥äœ¿çšããå¿
èŠããããŸãã
ãã以å€ã®å ŽåãSIGHASH_SINGLE|SIGHASH_ANYONECANPAY
ããã¢ããåãåã£ã HTLC 眲åã«äœ¿çšããªããã°ãªããŸãããããã«ãããHTLC ãã©ã³ã¶ã¯ã·ã§ã³ãä»ã®ãã©ã³ã¶ã¯ã·ã§ã³ãšçµã¿åãããããšãã§ããŸããããŒã«ã«çœ²å㯠SIGHASH_ALL
ã䜿çšããªããã°ãªããŸãããããã§ãªããšã誰ã§ãè¿œå ã®å
¥åãšåºåããã©ã³ã¶ã¯ã·ã§ã³ã«æ·»ä»ã§ããŠããŸããŸãã
option_anchors
ãé©çšãããå ŽåãHTLC-timeout ããã³ HTLC-success ãã©ã³ã¶ã¯ã·ã§ã³ã¯ãå
¥åãšåºåãåãå€ãæã€ããã«çœ²åãããŸããããã¯ææ°æããŒãã§ãããåççãªææ°æã«éããããã«ä»ã®å
¥åãšçµã¿åãããªããã°ãªããŸããã
ã³ãããã¡ã³ããã©ã³ã¶ã¯ã·ã§ã³ã®ããã« HTLC-success ãŸã㯠HTLC-timeout ãã©ã³ã¶ã¯ã·ã§ã³ããããŒããã£ã¹ãããããŒãïŒ
option_anchors
ãé©çšãããå ŽåïŒ- ãããã¯ã«è¿ éã«å«ãŸããããã«ååãªææ°æãæäŸããå ¥åãšçµã¿åãããªããã°ãªããŸããã
- ä»ã®ãã©ã³ã¶ã¯ã·ã§ã³ãšçµã¿åãããŠãããŸããŸããã
ããŒãïŒ
- è³é調éãã©ã³ã¶ã¯ã·ã§ã³åºåãæ¶è²»ãããã©ã³ã¶ã¯ã·ã§ã³ãçºèŠããå Žåãäžèšã®ã«ããŽãªïŒçžäºã¯ããŒãºãåç¬ã¯ããŒãºããŸãã¯åãæ¶ããããã©ã³ã¶ã¯ã·ã§ã³ã¯ããŒãºïŒã«è©²åœããªãå ŽåïŒ
- æœåšçã«å€±ãããè³éã«ã€ããŠãŠãŒã¶ã«èŠåããªããã°ãªããŸããã
- 泚æïŒãã®ãããªäžæ£ãã©ã³ã¶ã¯ã·ã§ã³ã®ååšã¯ããã®ç§å¯éµãæŒæŽ©ãããã®çµæãšããŠè³éã倱ãããå¯èœæ§ãããããšã瀺åããŠããŸãã
- æœåšçã«å€±ãããè³éã«ã€ããŠãŠãŒã¶ã«èŠåããªããã°ãªããŸããã
- åã«æãäœæ¥éã®å€ããã§ãŒã³ã®å
容ããã©ã³ã¶ã¯ã·ã§ã³ã®ããã«ç£èŠããŠãããŸããŸããã
- 泚æïŒãªã³ãã§ãŒã³ HTLC ã¯ååã«ãŸãã§ããã¹ãã§ãããé床ãéèŠèŠããå¿ èŠã¯ãããŸããã
- ïŒæå¹ãªïŒãããŒããã£ã¹ããã©ã³ã¶ã¯ã·ã§ã³ïŒããããã¡ã¢ãªããŒã«ïŒãç£èŠããŠãããŸããŸããã
- 泚æïŒã¡ã¢ãªããŒã«ãã©ã³ã¶ã¯ã·ã§ã³ãç£èŠããããšã§ãHTLC ã®åŒãåºãã®é 延ãäœããªãã¯ãã§ãã
BOLT #3 ã§èª¬æãããŠããããã«ããã®ãã©ã³ã¶ã¯ã·ã§ã³ã®èšŒææžã¯ä»¥äžã®éãã§ãïŒ
<sig> 1 { OP_IF <revocationpubkey> OP_ELSE to_self_delay OP_CSV OP_DROP <local_delayedpubkey> OP_ENDIF OP_CHECKSIG }
to_local
ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã®èšŒææžã®æåŸ
ãŠã§ã€ãã¯æ¬¡ã®ããã«èšç®ãããŸãïŒ
to_local_script: 83 bytes
- OP_IF: 1 byte
- OP_DATA: 1 byte (revocationpubkey length)
- revocationpubkey: 33 bytes
- OP_ELSE: 1 byte
- OP_DATA: 1 byte (delay length)
- delay: 8 bytes
- OP_CHECKSEQUENCEVERIFY: 1 byte
- OP_DROP: 1 byte
- OP_DATA: 1 byte (local_delayedpubkey length)
- local_delayedpubkey: 33 bytes
- OP_ENDIF: 1 byte
- OP_CHECKSIG: 1 byte
to_local_penalty_witness: 160 bytes
- number_of_witness_elements: 1 byte
- revocation_sig_length: 1 byte
- revocation_sig: 73 bytes
- one_length: 1 byte
- witness_script_length: 1 byte
- witness_script (to_local_script)
offered_htlc
ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã®èšŒææžã®æåŸ
ãŠã§ã€ãã¯æ¬¡ã®ããã«èšç®ãããŸãïŒããã€ãã®èšç®ã¯ãã§ã« BOLT #3 ã§è¡ãããŠããŸãïŒïŒ
offered_htlc_script: 133 bytes
offered_htlc_penalty_witness: 243 bytes
- number_of_witness_elements: 1 byte
- revocation_sig_length: 1 byte
- revocation_sig: 73 bytes
- revocation_key_length: 1 byte
- revocation_key: 33 bytes
- witness_script_length: 1 byte
- witness_script (offered_htlc_script)
accepted_htlc
ããã«ãã£ãã©ã³ã¶ã¯ã·ã§ã³ã®èšŒææžã®æåŸ
ãŠã§ã€ãã¯æ¬¡ã®ããã«èšç®ãããŸãïŒããã€ãã®èšç®ã¯ãã§ã« BOLT #3 ã§è¡ãããŠããŸãïŒïŒ
accepted_htlc_script: 139 bytes
accepted_htlc_penalty_witness: 249 ãã€ã
- number_of_witness_elements: 1 ãã€ã
- revocation_sig_length: 1 ãã€ã
- revocation_sig: 73 ãã€ã
- revocationpubkey_length: 1 ãã€ã
- revocationpubkey: 33 ãã€ã
- witness_script_length: 1 ãã€ã
- witness_script (accepted_htlc_script)
[FIXME:]
ãã®äœå㯠Creative Commons Attribution 4.0 International License ã®äžã§ã©ã€ã»ã³ã¹ãããŠããŸãã