ãã®ããã¥ã¡ã³ãã§ã¯ãèµ·ç¹ããŒã ãã æçµããŒã ãŸã§ã®æ¯æããã«ãŒãã£ã³ã°ããããã«äœ¿çšããããªããªã³ã«ãŒãã£ã³ã°ãã±ããã®æ§ç¯ã«ã€ããŠèª¬æããŸãããã±ããã¯ãããã ãšåŒã°ããè€æ°ã®äžéããŒããçµç±ããŠã«ãŒãã£ã³ã°ãããŸãã
ã«ãŒãã£ã³ã°ã¹ããŒã㯠Sphinx æ§é ã«åºã¥ããŠããããããããšã®ãã€ããŒããè¿œå ãããŠããŸãã
ã¡ãã»ãŒãžã転éããäžéããŒãã¯ããã±ããã®æŽåæ§ãæ€èšŒãããã±ãããã©ã®ããŒãã«è»¢éãã¹ãããç¥ãããšãã§ããŸãããããã圌ãã¯ååŸã®ããŒã以å€ã«ãã±ããã®ã«ãŒãã«å«ãŸããä»ã®ããŒããç¥ãããšã¯ã§ããŸããããŸããã«ãŒãã®é·ããèªåã®äœçœ®ãç¥ãããšãã§ããŸããããã±ããã¯åãããã§é£èªåããããããã¯ãŒã¯ã¬ãã«ã®æ»æè ãåãã«ãŒãã«å±ãããã±ãããé¢é£ä»ããããšãã§ããªãããã«ããŸãïŒã€ãŸããåãã«ãŒãã«å±ãããã±ããã¯çžé¢ããæ å ±ãå ±æããŸããïŒããã ãããã©ãã£ãã¯åæãéããŠæ»æè ããã±ãããé¢é£ä»ããå¯èœæ§ã¯æé€ãããŸããã
ã«ãŒãã¯èµ·ç¹ããŒãã«ãã£ãŠæ§ç¯ãããèµ·ç¹ããŒãã¯åäžéããŒããšæçµããŒãã®å ¬ééµãç¥ã£ãŠããŸããåããŒãã®å ¬ééµãç¥ãããšã§ãèµ·ç¹ããŒãã¯åäžéããŒãããã³æçµããŒãã®ããã«å ±æç§å¯ïŒECDH ã䜿çšïŒãäœæã§ããŸãããã®å ±æç§å¯ã¯ããã€ãã® ç䌌ã©ã³ãã ã¹ããªãŒã ïŒãã±ãããé£èªåããããã«äœ¿çšïŒãšããã€ããŒããæå·åã HMAC ãèšç®ããããã«äœ¿çšãããè€æ°ã® ã㌠ãçæããããã«äœ¿çšãããŸããHMAC ã¯åãããã§ãã±ããã®æŽåæ§ã確ä¿ããããã«äœ¿çšãããŸãã
ã«ãŒãã«æ²¿ã£ãåãããã¯ãéä¿¡è ã®èº«å ãé ãããã«èµ·ç¹ããŒãã®äžæçãªéµã®ã¿ãèŠãŸãããã®äžæçãªéµã¯ã次ã«è»¢éããåã«åäžéãããã«ãã£ãŠãã©ã€ã³ããããã«ãŒãã«æ²¿ã£ããªããªã³ããªã³ã¯ãããªãããã«ããŸãã
ãã®ä»æ§ã§ã¯ããã±ãããã©ãŒããããšã«ãŒãã£ã³ã°ã¡ã«ããºã ã® ããŒãžã§ã³ 0 ã«ã€ããŠèª¬æããŸãã
ããŒãã¯ïŒ
- å®è£
ããŠããããŒãžã§ã³ããé«ãããŒãžã§ã³ã®ãã±ãããåãåã£ãå ŽåïŒ
- èµ·ç¹ããŒãã«ã«ãŒãã®å€±æãå ±åããªããã°ãªããŸããã
- ãã±ãããç Žæ£ããªããã°ãªããŸããã
- èŠçŽ
- éµçæ
- ç䌌ã©ã³ãã ãã€ãã¹ããªãŒã
- ãã±ããæ§é
- ã«ãŒããã©ã€ã³ãã£ã³ã°
- æ¯æãã®åãå ¥ããšè»¢é
- å ±æç§å¯
- ãšãã§ã¡ã©ã«ãªããªã³ããŒã®ãã©ã€ã³ãã£ã³ã°
- ãã±ããæ§ç¯
- ãªããªã³åŸ©å·
- ãã£ã©ãŒçæ
- ãšã©ãŒã®è¿åŽ
max_htlc_cltv
ã®éžæ- ãªããªã³ã¡ãã»ãŒãž
- ãã¹ããã¯ã¿ãŒ
- åèæç®
- èè
ãã®ããã¥ã¡ã³ãå šäœã§éµå®ãããããã€ãã®èŠçŽããããŸãïŒ
- HMACïŒãã±ããã®æŽåæ§æ€èšŒã¯ãFIPS 198 Standard/RFC 2104 ã§å®çŸ©ãããŠããããã«ãKeyed-Hash Message Authentication Code ã«åºã¥ããŠããã
SHA256
ããã·ã¥ã¢ã«ãŽãªãºã ã䜿çšããŸãã - æ¥åæ²ç·ïŒæ¥åæ²ç·ãå«ããã¹ãŠã®èšç®ã«ã¯ã
secp256k1
ã§æå®ãããŠãããããã³ã€ã³æ²ç·ã䜿çšããŸãã - ç䌌ã©ã³ãã ã¹ããªãŒã ïŒç䌌ã©ã³ãã ãã€ãã¹ããªãŒã ãçæããããã«
ChaCha20
ã䜿çšããŸãããã®çæã«ã¯ãåºå®ããã 96 ãããã®ãã«ãã³ã¹ (0x000000000000000000000000
) ãšãå ±æç§å¯ããå°åºãããéµãããã³ã¡ãã»ãŒãžãšããŠã®ææã®åºåãµã€ãºã®0x00
ãã€ãã¹ããªãŒã ã䜿çšããŸãã - çšèª origin node ãš final node ã¯ãããããåæãã±ããéä¿¡è ãšæçµãã±ããåä¿¡è ãæããŸãã
- çšèª hop ãš node ã¯ææäºæçã«äœ¿çšãããŸãããhop ã¯éåžžãã«ãŒãã®äžéããŒããæãããšã³ãããŒãã§ã¯ãããŸããã origin node --> hop --> ... --> hop --> final node
- çšèª processing node ã¯ãçŸåšè»¢éããããã±ãããåŠçããŠããã«ãŒãäžã®ç¹å®ã®ããŒããæããŸãã
- çšèª peers ã¯ããªãŒããŒã¬ã€ãããã¯ãŒã¯å ã§çŽæ¥ã®é£æ¥è ã§ãããããã®ã¿ãæããŸããå ·äœçã«ã¯ãsending peers ã¯ãã±ããã receiving peers ã«è»¢éããŸãã
- ã«ãŒãå
ã®åãããã«ã¯å¯å€é·ã®
hop_payload
ããããŸãã- å¯å€é·ã®
hop_payload
ã¯ããã¬ãã£ãã¯ã¹ãšæ«å°Ÿã® HMAC ãé€ãããã€ãæ°ããšã³ã³ãŒãããbigsize
ã§ãã¬ãã£ãã¯ã¹ãä»ããããŠããŸãã
- å¯å€é·ã®
å ±æç§å¯ããããã€ãã®æå·åããã³æ€èšŒçšã®éµãå°åºãããŸãïŒ
- rhoïŒåãããã®æ å ±ãé£èªåããããã«äœ¿çšãããç䌌乱æ°ãã€ãã¹ããªãŒã ãçæããéã®éµãšããŠäœ¿çšãããŸã
- muïŒHMAC çææã«äœ¿çšãããŸã
- umïŒãšã©ãŒå ±åæã«äœ¿çšãããŸã
- padïŒéå§ããã¯ã¹ããããã±ããã®ã©ã³ãã ãã£ã©ãŒãã€ããçæããããã«äœ¿çšãããŸã
éµçæé¢æ°ã¯ãéµã¿ã€ã (rho=0x72686F
, mu=0x6d75
, um=0x756d
, ãŸã㯠pad=0x706164
) ãš 32 ãã€ãã®ç§å¯ãå
¥åãšããŠåãåãã32 ãã€ãã®éµãè¿ããŸãã
éµã¯ãé©åãªéµã¿ã€ã (ããªãã¡ rho, mu, um, ãŸã㯠pad) ã HMAC éµãšããŠäœ¿çšãã32 ãã€ãã®å
±æç§å¯ãã¡ãã»ãŒãžãšã㊠HMAC (ããã·ã¥ã¢ã«ãŽãªãºã ãšã㊠SHA256
ã䜿çš) ãèšç®ããããšã«ãã£ãŠçæãããŸããçµæãšããŠåŸããã HMAC ãéµãšããŠè¿ãããŸãã
éµã¿ã€ãã«ã¯ C ã¹ã¿ã€ã«ã® 0x00
çµç«¯ãã€ããå«ãŸããŠããªãããšã«æ³šæããŠãã ãããäŸãã°ãrho éµã¿ã€ãã®é·ã㯠3 ãã€ãã§ããã4 ãã€ãã§ã¯ãããŸããã
ç䌌乱æ°ãã€ãã¹ããªãŒã ã¯ãçµè·¯ã®åãããã§ãã±ãããé£èªåããããã«äœ¿çšãããŸããããã«ãããåãããã¯æ¬¡ã®ãããã®ã¢ãã¬ã¹ãš HMAC ã®ã¿ã埩å
ã§ããŸããç䌌乱æ°ãã€ãã¹ããªãŒã ã¯ãå
±æç§å¯ããå°åºãããéµãš 96 ãããã®ãŒããã³ã¹ (0x000000000000000000000000
) ã§åæåãããå¿
èŠãªé·ãã® 0x00
ãã€ãã¹ããªãŒã ãæå·å ( ChaCha20
ã䜿çš) ããããšã«ãã£ãŠçæãããŸãã
åºå®ãã³ã¹ã®äœ¿çšã¯å®å šã§ãããªããªããéµã¯åå©çšãããªãããã§ãã
ãã±ããã¯æ¬¡ã® 4 ã€ã®ã»ã¯ã·ã§ã³ã§æ§æãããŸãïŒ
version
ãã€ã- å
±æç§å¯çæäžã«äœ¿çšããã 33 ãã€ãã®å§çž®ããã
secp256k1
public_key
- è€æ°ã®å¯å€é·
hop_payload
ãã€ããŒããããªã 1300 ãã€ãã®hop_payloads
- ãã±ããã®æŽåæ§ãæ€èšŒããããã«äœ¿çšããã 32 ãã€ãã®
hmac
ãã±ããã®ãããã¯ãŒã¯ãã©ãŒãããã¯ãåã ã®ã»ã¯ã·ã§ã³ã 1 ã€ã®é£ç¶ãããã€ãã¹ããªãŒã ã«ã·ãªã¢ã©ã€ãºãããã±ããåä¿¡è ã«è»¢éããããšã«ãã£ãŠæ§æãããŸãããã±ããã®ãµã€ãºãåºå®ãããŠãããããæ¥ç¶ãä»ããŠè»¢éãããéã«ãã®é·ãããã¬ãã£ãã¯ã¹ãšããŠä»ããå¿ èŠã¯ãããŸããã
ãã±ããã®å šäœçãªæ§é ã¯æ¬¡ã®ãšããã§ãïŒ
- type:
onion_packet
- data:
- [
byte
:version
] - [
point
:public_key
] - [
1300*byte
:hop_payloads
] - [
32*byte
:hmac
]
- [
ãã®ä»æ§æžã§ã¯ (version 0)ãversion
㯠0x00
ã®å®æ°å€ãæã¡ãŸãã
hop_payloads
ãã£ãŒã«ãã¯ãé£èªåãããã«ãŒãã£ã³ã°æ
å ±ãšé¢é£ãã HMAC ãä¿æããæ§é ã§ãã
ãã㯠1300 ãã€ãã®é·ããããã以äžã®æ§é ãæã¡ãŸãïŒ
- type:
hop_payloads
- data:
- [
bigsize
:length
] - [
length*byte
:payload
] - [
32*byte
:hmac
] - ...
filler
- [
ããã§ãlength
ãpayload
ãããã³ hmac
ã¯åãããããšã«ç¹°ãè¿ãããŸãã
ãŸããfiller
㯠Filler Generation ã§è©³è¿°ãããŠããããã«ãé£èªåããã決å®è«çã«çæãããããã£ã³ã°ã§æ§æãããŸãã
ããã«ãhop_payloads
ã¯åãããã§æ®µéçã«é£èªåãããŸãã
payload
ãã£ãŒã«ãã䜿çšããŠãçºä¿¡ããŒãã¯åãããã§è»¢éããã HTLC ã®ãã¹ãšæ§é ãæå®ã§ããŸãã
payload
ã¯ãã±ããå
šäœã® HMAC ã§ä¿è·ãããŠããããããã®æ
å ±ã¯ HTLC éä¿¡è
(çºä¿¡ããŒã) ãšãã¹å
ã®åããããšã®ãã¢ããšã®é¢ä¿ã§å®å
šã«èªèšŒãããŸãã
ãã®ãšã³ãããŒãšã³ãã®èªèšŒã䜿çšããŠãåããã㯠HTLC ãã©ã¡ãŒã¿ã payload
ã®æå®ãããå€ãšç
§åããéä¿¡ãã¢ãäžæ£ã«äœæããã HTLC ã転éããŠããªãããšã確èªã§ããŸãã
payload
TLV å€ã¯ 2 ãã€ãæªæºã«ãªãããšã¯ãªããããlength
å€ã® 0 ãš 1 ã¯äºçŽãããŠããŸãã (0
ã¯ãã¯ããµããŒããããŠããªãã¬ã¬ã·ãŒãã©ãŒãããã瀺ãã1
ã¯å°æ¥ã®äœ¿çšã®ããã«äºçŽãããŠããŸã)ã
ãã㯠BOLT #1 ã§å®çŸ©ããã Type-Length-Value ãã©ãŒãããã«åŸã£ãŠãã©ãŒããããããŠããŸãã
tlv_stream
:payload
- types:
- type: 2 (
amt_to_forward
) - data:
- [
tu64
:amt_to_forward
]
- [
- type: 4 (
outgoing_cltv_value
) - data:
- [
tu32
:outgoing_cltv_value
]
- [
- type: 6 (
short_channel_id
) - data:
- [
short_channel_id
:short_channel_id
]
- [
- type: 8 (
payment_data
) - data:
- [
32*byte
:payment_secret
] - [
tu64
:total_msat
]
- [
- type: 10 (
encrypted_recipient_data
) - data:
- [
...*byte
:encrypted_recipient_data
]
- [
- type: 12 (
current_path_key
) - data:
- [
point
:path_key
]
- [
- type: 16 (
payment_metadata
) - data:
- [
...*byte
:payment_metadata
]
- [
- type: 18 (
total_amount_msat
) - data:
- [
tu64
:total_msat
]
- [
- type: 2 (
short_channel_id
ã¯ãã¡ãã»ãŒãžãã«ãŒãã£ã³ã°ããããã«äœ¿çšãããéä¿¡ãã£ãã«ã® ID ã§ããåä¿¡ãã¢ã¯ãã®ãã£ãã«ã®å察åŽãæäœããå¿
èŠããããŸãã
amt_to_forward
ã¯ãã«ãŒãã£ã³ã°æ
å ±å
ã§æå®ããã次ã®åä¿¡ãã¢ããŸãã¯æçµç®çå°ã«è»¢éããéé¡ãããªãµãã·åäœã§ç€ºããŸãã
æçµããŒãã§ãªãå Žåãããã¯åä¿¡ãã¢ã®ããã«èšç®ãããèµ·ç¹ããŒãã® ææ°æ ãå«ã¿ãŸããããã¯åä¿¡ãã¢ã®åºåãããææ°æã¹ããŒãã«åŸã£ãŠèšç®ãããŸãïŒBOLT #7 ã§èª¬æãããŠããŸãïŒã
outgoing_cltv_value
ã¯ããã±ãããé㶠éä¿¡ HTLC ãæã€ã¹ã CLTV å€ã§ãããã®ãã£ãŒã«ãã®å«æã«ããããããã¯èµ·ç¹ããŒãã«ãã£ãŠæå®ãããæ
å ±ãšè»¢éããã HTLC ã®ãã©ã¡ãŒã¿ã®äž¡æ¹ãèªèšŒããèµ·ç¹ããŒããçŸåšã® cltv_expiry_delta
å€ã䜿çšããŠããããšã確èªã§ããŸãã
å€ãäžèŽããªãå Žåãããã¯è»¢éããŒããæå³ããã HTLC å€ãæ¹ããããããèµ·ç¹ããŒããå€ã cltv_expiry_delta
å€ãæã£ãŠããããšã瀺ããŸãã
èŠä»¶ã¯ãæçµããŒãã§ãããã©ããã«ããããããäºæããªã outgoing_cltv_value
ã«å¿çããéã®äžè²«æ§ã確ä¿ããã«ãŒãå
ã®äœçœ®ãæŒãããªãããã«ããŸãã
encrypted_recipient_data
ã®äœæè
ïŒéåžžã¯æ¯æãã®åå人ïŒïŒ
- ãã©ã€ã³ãã«ãŒãå
ã®åããŒãïŒèªèº«ãå«ãïŒã«å¯ŸããŠ
encrypted_data_tlv
ãäœæããªããã°ãªããŸããã - åéæçµããŒãã«å¯ŸããŠ
encrypted_data_tlv.payment_relay
ãå«ããªããã°ãªããŸããã - åéæçµããŒãã«å¯ŸããŠ
encrypted_data_tlv.short_channel_id
ãŸãã¯encrypted_data_tlv.next_node_id
ã®ããããäžã€ãæ£ç¢ºã«å«ããªããã°ãªããŸããã - åéæçµããŒãã«å¯ŸããŠ
encrypted_data_tlv.payment_constraints
ãèšå®ããªããã°ãªãããæçµããŒãã«å¯ŸããŠèšå®ããŠãããŸããŸããïŒmax_cltv_expiry
ããã«ãŒãã䜿çšãããããšãèš±å¯ãããæ倧ãããã¯é«ã«èšå®ããŸããããã¯ãæçµããŒããéžæããmax_cltv_expiry
é«ããå§ãŸããæçµããŒãã®min_final_cltv_expiry_delta
ãè¿œå ããåãããã§encrypted_data_tlv.payment_relay.cltv_expiry_delta
ãè¿œå ããŸããhtlc_minimum_msat
ããããŒããèš±å¯ããæ倧ã®æå° HTLC å€ã«èšå®ããŸãã
encrypted_data_tlv.allowed_features
ãèšå®ããå ŽåïŒ- 空ã®é åã«èšå®ããªããã°ãªããŸããã
- ã«ãŒãã®åèšææ°æãš CLTV ãã«ã¿ã次ã®ããã«èšç®ããéä¿¡è
ã«äŒããªããã°ãªããŸããïŒ
total_fee_base_msat(n+1) = (fee_base_msat(n+1) * 1000000 + total_fee_base_msat(n) * (1000000 + fee_proportional_millionths(n+1)) + 1000000 - 1) / 1000000
total_fee_proportional_millionths(n+1) = ((total_fee_proportional_millionths(n) + fee_proportional_millionths(n+1)) * 1000000 + total_fee_proportional_millionths(n) * fee_proportional_millionths(n+1) + 1000000 - 1) / 1000000
total_cltv_delta = cltv_delta(0) + cltv_delta(1) + ... + cltv_delta(n) + min_final_cltv_expiry_delta
- Route Blinding ã§å¿
èŠãšãããããã«
encrypted_data_tlv
ããencrypted_recipient_data
ãäœæããªããã°ãªããŸããã
TLV payload
ã®äœæè
:
- ãã©ã€ã³ãã«ãŒãå
ã®åããŒãã«å¯ŸããŠ:
- åå人ãæäŸãã
encrypted_recipient_data
ãå«ããå¿ èŠããããŸãã - ãã©ã€ã³ãã«ãŒãã®æåã®ããŒãã«å¯ŸããŠ:
- åå人ãæäŸãã
path_key
ãcurrent_path_key
ã«å«ããå¿ èŠããããŸãã
- åå人ãæäŸãã
- æçµããŒãã®å Žå:
amt_to_forward
ãoutgoing_cltv_value
ãtotal_amount_msat
ãå«ããå¿ èŠããããŸããoutgoing_cltv_value
ã«èšå®ããå€:- çŸåšã®ãããã¯é«ããåºæºå€ãšããŠäœ¿çšããå¿ èŠããããŸãã
- ãã©ã€ãã·ãŒãåäžãããããã« ã©ã³ãã ãªãã»ãã ãè¿œå ãããå Žå:
- åºæºå€ã«ãªãã»ãããè¿œå ããããšãæšå¥šããŸãã
- ä»ã® tlv ãã£ãŒã«ããå«ããŠã¯ãããŸããã
- åå人ãæäŸãã
- ãã©ã€ã³ãã«ãŒãå€ã®åããŒãã«å¯ŸããŠ:
amt_to_forward
ãšoutgoing_cltv_value
ãå«ããå¿ èŠããããŸãã- éæçµããŒãã«å¯ŸããŠ:
short_channel_id
ãå«ããå¿ èŠããããŸããpayment_data
ãå«ããŠã¯ãããŸããã
- æçµããŒãã«å¯ŸããŠ:
short_channel_id
ãå«ããŠã¯ãããŸããã- åå人ã
payment_secret
ãæäŸããå Žå:payment_data
ãå«ããå¿ èŠããããŸãã- æäŸããã
payment_secret
ãèšå®ããå¿ èŠããããŸãã - éä¿¡ããç·é¡ã
total_msat
ã«èšå®ããå¿ èŠããããŸãã
- åå人ã
payment_metadata
ãæäŸããå Žå:- å HTLC ã«
payment_metadata
ãå«ããå¿ èŠããããŸãã - åºå®ãªããªã³ãµã€ãºã«ãã£ãŠæ瀺ãããå¶éãé€ãã
payment_metadata
ã®ãµã€ãºã«å¶éãé©çšããŠã¯ãããŸããã
- å HTLC ã«
èªã¿æ:
encrypted_recipient_data
ãååšããå Žå:- å
¥åããã
update_add_htlc
ã«path_key
ãèšå®ãããŠããå Žå:current_path_key
ãååšããå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã- ãã®
path_key
ã埩å·ã®ããã®path_key
ãšããŠäœ¿çšããå¿ èŠããããŸãã
- ãã以å€ã®å Žå:
current_path_key
ãååšããªãå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã- ãã®
current_path_key
ã埩å·ã®ããã®path_key
ãšããŠäœ¿çšããå¿ èŠããããŸãã - ãšã©ãŒãè¿ãåã«ã©ã³ãã ãªé 延ãè¿œå ããããšãæšå¥šããŸãã
- Route Blinding ã§èª¬æãããŠããããã«ã
path_key
ã䜿çšããŠencrypted_recipient_data
ã埩å·ãããªãå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã payment_constraints
ãååšããå Žå:- 以äžã®å Žåã¯ãšã©ãŒãè¿ãå¿
èŠããããŸã:
- æå¹æéã
encrypted_recipient_data.payment_constraints.max_cltv_expiry
ãè¶ ããŠããã - éé¡ã
encrypted_recipient_data.payment_constraints.htlc_minimum_msat
ãäžåã£ãŠããã
- æå¹æéã
- 以äžã®å Žåã¯ãšã©ãŒãè¿ãå¿
èŠããããŸã:
allowed_features
ãæ¬ ããŠããå Žå:- ååšãã空ã®é åãå«ãã§ãããã®ããã«ã¡ãã»ãŒãžãåŠçããå¿ èŠããããŸãã
- 以äžã®å Žåã¯ãšã©ãŒãè¿ãå¿
èŠããããŸã:
encrypted_recipient_data.allowed_features.features
ã«æªç¥ã®æ©èœããããå«ãŸããŠããïŒå¥æ°ã§ãã£ãŠãïŒãencrypted_recipient_data
ã«short_channel_id
ãšnext_node_id
ã®äž¡æ¹ãå«ãŸããŠããã- æ¯æãã
encrypted_recipient_data.allowed_features.features
ã«å«ãŸããŠããªãæ©èœã䜿çšããŠããã
- æçµããŒãã§ãªãå Žå:
encrypted_recipient_data
ãšcurrent_path_key
以å€ã® tlv ãã£ãŒã«ããå«ããã€ããŒããããå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸããencrypted_recipient_data
ã«short_channel_id
ãŸãã¯next_node_id
ãå«ãŸããŠããªãå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸããencrypted_recipient_data
ã«payment_relay
ãå«ãŸããŠããªãå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸããencrypted_recipient_data.payment_relay
ã®å€ã䜿çšããŠamt_to_forward
ãšoutgoing_cltv_value
ã以äžã®ããã«èšç®ããå¿ èŠããããŸã:amt_to_forward = ((amount_msat - fee_base_msat) * 1000000 + 1000000 + fee_proportional_millionths - 1) / (1000000 + fee_proportional_millionths)
outgoing_cltv_value = cltv_expiry - payment_relay.cltv_expiry_delta
- æçµããŒãã®å Žå:
encrypted_recipient_data
ãcurrent_path_key
ãamt_to_forward
ãoutgoing_cltv_value
ãtotal_amount_msat
以å€ã® tlv ãã£ãŒã«ããå«ããã€ããŒããããå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸããamt_to_forward
ãoutgoing_cltv_value
ãtotal_amount_msat
ãååšããªãå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã- æ¯æãã«æåŸ
ãããéé¡ãäžåã
amt_to_forward
ã®å Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã - å
¥åããã
cltv_expiry
ãoutgoing_cltv_value
ããå°ããå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã - å
¥åããã
cltv_expiry
ãcurrent_block_height
+min_final_cltv_expiry_delta
ããå°ããå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã
- å
¥åããã
- ãã以å€ã®å ŽåïŒãã©ã€ã³ãã«ãŒãã®äžéšã§ã¯ãªãïŒ:
- å
¥åããã
update_add_htlc
ã«path_key
ãèšå®ãããŠããå ŽåããŸãã¯current_path_key
ãååšããå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã amt_to_forward
ãŸãã¯outgoing_cltv_value
ãååšããªãå Žåã¯ãšã©ãŒãè¿ãå¿ èŠããããŸãã- æçµããŒãã§ãªãå Žå:
- 以äžã®å Žåã¯ãšã©ãŒãè¿ãå¿
èŠããããŸã:
short_channel_id
ãååšããªãã- ãã£ãã«
short_channel_id
ã«ãã£ãŠç€ºããããã¢ã« HTLC ã転éã§ããªãã - å
¥åããã
amount_msat
-fee
<amt_to_forward
ïŒfee
㯠BOLT #7 ã§èª¬æãããŠããããã«åºåãããææ°æïŒã cltv_expiry
-cltv_expiry_delta
<outgoing_cltv_value
- 以äžã®å Žåã¯ãšã©ãŒãè¿ãå¿
èŠããããŸã:
- å
¥åããã
- æçµããŒãã®å Žå:
total_msat
ãååšããªãå Žåã¯ãamt_to_forward
ãšçãããã®ãšããŠæ±ãå¿ èŠããããŸãã- 以äžã®å Žåã¯ãšã©ãŒãè¿ãå¿
èŠããããŸã:
- å
¥åããã
amount_msat
<amt_to_forward
ã - å
¥åããã
cltv_expiry
<outgoing_cltv_value
ã - å
¥åããã
cltv_expiry
<current_block_height
+min_final_cltv_expiry_delta
ã
- å
¥åããã
è¿œå ã®èŠä»¶ã¯ããã«ãããŒãæ¯æãã«ã€ããŠã¯ ãã¡ãããã©ã€ã³ãæ¯æãã«ã€ããŠã¯ ãã¡ã ã«èšèŒãããŠããŸãã
HTLC ã¯ããã倧ããªããã«ãããŒããæ¯æãã®äžéšã§ããå ŽåããããŸãããã®ãããªãåºæ¬ãçãªã¢ãããã¯ãã«ããã¹æ¯æãã¯ããã¹ãŠã®çµè·¯ã§åã payment_hash
ã䜿çšããŸãã
amt_to_forward
ã¯ãã® HTLC ã®ã¿ã®éé¡ã§ããããšã«æ³šæããŠãã ãããtotal_msat
ãã£ãŒã«ãã«ã¯ãã倧ããªå€ãå«ãŸããŠãããæçµçãªéä¿¡è
ãæ®ãã®æ¯æããåŸç¶ã® HTLC ã§éãããšãçŽæããŠããŸããåããã¬ã€ã¡ãŒãžãæã€ãããã®æªæ±º HTLC ããHTLC ã»ããããšåŒã³ãŸãã
total_msat
ãéä¿¡ããããã«äœ¿çšã§ãã 2 ã€ã®ç°ãªã tlv ãã£ãŒã«ããããããšã«æ³šæããŠãã ãããæåŸã® total_amount_msat
ã¯ãpayment_secret
ãæå³ããªããªããã©ã€ã³ããã¹ã§å°å
¥ãããŸããã
payment_metadata
ã¯ãç¡å¹ãªæ¯æã詳现ãã§ããã ãæ©ãæ€åºã§ããããã«ããã¹ãŠã®æ¯æãéšåã«å«ããå¿
èŠããããŸãã
ã©ã€ã¿ãŒã¯ïŒ
- ã€ã³ãã€ã¹ã
basic_mpp
æ©èœãæäŸããå ŽåïŒ- ã€ã³ãã€ã¹ãæ¯æãããã«è€æ°ã® HTLC ãéä¿¡ããŠãããŸããŸããã
- ã»ããå
ã®ãã¹ãŠã® HTLC ã«åã
payment_hash
ã䜿çšããªããã°ãªããŸããã - ãã¹ãŠã®æ¯æããã»ãŒåæã«éä¿¡ããããšãæšå¥šããŸãã
- å HTLC ã«å¯ŸããŠåå人ãžã®å€æ§ãªçµè·¯ã䜿çšããããã«åªããããšãæšå¥šããŸãã
- 倱æãã HTLC ãåè©Šè¡ããã³/ãŸãã¯ååå²ããããšãæšå¥šããŸãã
- ã€ã³ãã€ã¹ã
amount
ãæå®ããŠããå ŽåïŒtotal_msat
ãå°ãªããšããã®amount
ã«èšå®ããamount
ã® 2 å以äžã«ããªããã°ãªããŸããã
- ããã§ãªãå ŽåïŒ
- æ¯æãããéé¡ã«
total_msat
ãèšå®ããªããã°ãªããŸããã
- æ¯æãããéé¡ã«
- åå人ã«å°çãã HTLC ã»ããã®åèš
amt_to_forward
ãtotal_msat
以äžã§ããããšãä¿èšŒããªããã°ãªããŸããã - HTLC ã»ããã®åèš
amt_to_forward
ããã§ã«total_msat
以äžã§ããå Žåãå¥ã® HTLC ãéä¿¡ããŠã¯ãªããŸããã payment_secret
ãå«ããªããã°ãªããŸããã
- ããã§ãªãå ŽåïŒ
total_msat
ãamt_to_forward
ãšçããèšå®ããªããã°ãªããŸããã
æçµããŒãã¯ïŒ
- 倱æã¡ãã»ãŒãž ã®èŠä»¶ã«åŸã£ãŠ HTLC ã倱æãããªããã°ãªããŸããã
- 泚ïŒããã«æå®ãããŠãããæ¯æãããéé¡ãã¯
total_msat
ãã£ãŒã«ãã§ãã
- 泚ïŒããã«æå®ãããŠãããæ¯æãããéé¡ãã¯
basic_mpp
ããµããŒãããŠããªãå ŽåïŒtotal_msat
ãamt_to_forward
ãšæ£ç¢ºã«çãããªãå ŽåãHTLC ã倱æãããªããã°ãªããŸããã
- ããã§ãªãã
basic_mpp
ããµããŒãããŠããå ŽåïŒ- ãã®
payment_hash
ã«å¯Ÿå¿ãã HTLC ã»ããã«è¿œå ããªããã°ãªããŸããã - ã»ããå
ã®ãã¹ãŠã® HTLC ã§
total_msat
ãåãã§ãªãå ŽåãHTLC ã»ããå šäœã倱æãããããšãæšå¥šããŸãã - ãã® HTLC ã»ããã®åèš
amt_to_forward
ãtotal_msat
以äžã§ããå ŽåïŒ- HTLC ã»ããå ã®ãã¹ãŠã® HTLC ãå±¥è¡ããããšãæšå¥šããŸãã
- ããã§ãªãããã® HTLC ã»ããã®åèš
amt_to_forward
ãtotal_msat
æªæºã§ããå ŽåïŒ- HTLC ã»ããå ã®ãããªã HTLC ãå±¥è¡ããŠã¯ãªããŸããã
- åççãªã¿ã€ã ã¢ãŠãåŸã« HTLC ã»ããå
ã®ãã¹ãŠã® HTLC ã倱æãããªããã°ãªããŸããã
- åæ HTLC ããå°ãªããšã 60 ç§åŸ ã€ããšãæšå¥šããŸãã
- 倱æã¡ãã»ãŒãžã«ã¯
mpp_timeout
ã䜿çšããããšãæšå¥šããŸãã
- ã»ããå
ã®ãã¹ãŠã® HTLC ã«
payment_secret
ãèŠæ±ããªããã°ãªããŸããã
- HTLC ã»ããå
ã®ããããã® HTLC ãå±¥è¡ããå ŽåïŒ
- HTLC ã»ããå šäœãå±¥è¡ããªããã°ãªããŸããã
- ãã®
basic_mpp
ãååšããå Žåãä»ã®éšåçãªæ¯æããçµåããã®ãèš±å¯ããããã«é
延ãçºçããŸããåèšéé¡ã¯ãåäžã®æ¯æããšåæ§ã«ãåžæããæ¯æãã«ååã§ãªããã°ãªããŸããããããããµãŒãã¹æåŠãé¿ããããã«ãããã¯åççã«å¶éãããå¿
èŠããããŸãã
è«æ±æžãå¿ ãããéé¡ãæå®ããªãããšããŸãæ¯æè ãæçµéé¡ã«ãã€ãºãå ããããšãã§ãããããåèšéé¡ã¯æ瀺çã«éä¿¡ãããªããã°ãªããŸããããã®èŠä»¶ã¯ãéé¡ãåå²ããéã«ãã€ãºãå ããããšãç°¡åã«ããããããŸãéä¿¡è ãæ¬åœã«ç¬ç«ããŠããã·ããªãªïŒäŸãã°ãå人ãè«æ±æžãåå²ããå ŽåïŒãèæ ®ããŠãããããããã«è¶ ããããšãèš±å¯ããŠããŸãã
ããŒããåžæããéé¡ä»¥äžãæ¯æãå¿
èŠãããå ŽåãããããïŒåžæããçµè·¯ã®ãã£ãã«ã® htlc_minimum_msat
å€ã®ããïŒãããŒãã¯æå®ãã total_msat
ããå€ãæ¯æãããšãèš±å¯ãããŠããŸããããã§ãªããã°ãç¹å®ã®çµè·¯ã«æ²¿ã£ãŠæ¯æããåè©Šè¡ããéã«ãããŒããéžæã§ããçµè·¯ãå¶çŽãããŠããŸããŸãããã ããåã
ã® HTLC ã¯ãæ¯æã£ãåèšãš total_msat
ã®å·®ããå°ãªããŠã¯ãªããŸããã
åæãããåèšãè¶ ããã»ãããéä¿¡ãããå Žåã« HTLC ãéä¿¡ããå¶éã¯ããã¹ãŠã®éšåçãªæ¯æããå°çããåã«ãã¬ã€ããŒãžããªãªãŒã¹ãããã®ãé²ããŸããããã§ãªããã°ãäžéããŒããæªæãã®éšåçãªæ¯æããå³åº§ã«è«æ±ããããšãã§ããŠããŸããŸãã
å®è£ ã¯ãéé¡ã®åºæºãæºãã HTLC ã»ãããå±¥è¡ããªãããšãéžæããããšãã§ããŸãïŒäŸãã°ãä»ã®å€±æãè«æ±æžã®ã¿ã€ã ã¢ãŠããªã©ïŒããããããããããã®äžéšã®ã¿ãå±¥è¡ããå ŽåãäžéããŒãã¯æ®ããåã«è«æ±ããããšãã§ããŠããŸããŸãã
-
ãµãã¿ã€ã:
blinded_path
-
ããŒã¿:
- [
sciddir_or_pubkey
:first_node_id
] - [
point
:first_path_key
] - [
byte
:num_hops
] - [
num_hops*blinded_path_hop
:path
]
- [
-
ãµãã¿ã€ã:
blinded_path_hop
-
ããŒã¿:
- [
point
:blinded_node_id
] - [
u16
:enclen
] - [
enclen*byte
:encrypted_recipient_data
]
- [
ãã©ã€ã³ããããçµè·¯ã¯ä»¥äžã§æ§æãããŸãïŒ
- åæå°å
¥ãã€ã³ãïŒ
first_node_id
ïŒ - æåã®ããŒã ID ãšç§å¯ãå
±æããããã®åæããŒïŒ
first_path_key
ïŒ - 調æŽãããããŒã ID ã®äžé£ïŒ
path.blinded_node_id
ïŒ - 次ã®ããããäŒããããã«ããŒãã«æå·åããããã€ããªãããã®äžé£ïŒ
path.encrypted_recipient_data
ïŒ
äŸãã°ããã€ãã¯ã¢ãªã¹ã«ãããªãã¯ããŒãã®ããã次ã«ãã£ãã«ãçµç±ããŠèªåã«å°éããŠã»ãããšèããŠããŸãã圌ã¯ããããã£ãã«ããããŠæçµçã«èªåèªèº«ã®ããã®å
¬ééµã®ãã§ãŒã³ïŒ"path_keys"ïŒãäœæãããããããšç§å¯ãå
±æã§ããããã«ããŸãããããã®éµã¯åçŽãªãã§ãŒã³ã§ãããããåããŒãã¯æ瀺çã«æ瀺ãããªããŠã次㮠path_key
ãå°åºã§ããŸãã
ãããã®å
±æç§å¯ããããã€ãã¯3ã€ã® encrypted_data_tlv
ãäœæããæå·åããŸãïŒ
- encrypted_data_bobïŒããããã£ãã«ã«è»¢éããããã«æ瀺ãããã
- encrypted_data_carolïŒãã£ãã«ãèªåã«è»¢éããããã«æ瀺ãããã
- encrypted_data_daveïŒçµè·¯ã䜿çšãããããšã瀺ãã圌ãæãã¡ã¿ããŒã¿ãå«ããã
ããŒãIDãé ãããã«ã圌ã¯å ±æç§å¯ãã3ã€ã®ãã©ã€ã³ãã£ã³ã°ãã¡ã¯ã¿ãŒãå°åºããããããã'ããã£ãã«ããã£ãã«'ããã€ãããã€ã' ã«å€ããŸãã
ãããã¢ãªã¹ã«æž¡ã blinded_path
ã§ãã
first_node_id
ïŒããfirst_path_key
ïŒããã®ããã®æåã®ãã¹ããŒpath
ïŒ [ãã', encrypted_data_bob], [ãã£ãã«', encrypted_data_carol], [ãã€ã', encrypted_data_dave]
ã¢ãªã¹ãããã«å°éããããã®ãªããªã³ãæ§ç¯ããæ¹æ³ã¯2ã€ãããŸãïŒåœŒã¯ãããã圌女ã®çŽæ¥ã®ãã¢ã§ã¯ãªãããïŒããããã¯ä»¥äžã®èŠä»¶ã§èª¬æãããŠããŸãã
ããããããã®åŸã®çµè·¯ã¯åžžã«åãã§ãïŒåœŒã¯å°åºãã path_key
ãšãªããªã³ããã£ãã«ã«éããŸãã圌女㯠path_key
ã䜿çšããŠãªããªã³ã®èª¿æŽãå°åºãïŒã¢ãªã¹ã¯ãã£ãã«' ã®ããã«æå·åããã®ã§ãã£ãã«ã®ããã§ã¯ãªãïŒãããã埩å·åããããã« encrypted_data_tlv
ã埩å·åããããã®éµãå°åºããŠãã€ãã«è»¢éããããã«æ瀺ããŸãïŒãããããã€ããæå®ããè¿œå ã®å¶éãå«ãŸããŸãïŒã
ãã©ã€ã³ããã¹ã®äœæè ïŒã€ãŸãåä¿¡è ïŒã¯ãéä¿¡è ããªããªã³ãäœæããäžéããŒããæ瀺ãèªãããã«äœ¿çšããããã«ãããäœæããŠããããšã«æ³šæããŠãã ããããããã£ãŠãããã«ã¯2ã€ã®ãªãŒããŒã»ã¯ã·ã§ã³ããããŸãã
blinded_path
ã®äœæè
ïŒ
- èªèº«ãžã®æå¹ãªçµè·¯ (
$N_r$ ) ãäœæããªããã°ãªããŸãããããªãã¡ã$N_0 \rightarrow N_1 \rightarrow ... \rightarrow N_r$ ã -
first_node_id
ã$N_0$ ã«èšå®ããªããã°ãªããŸããã - 次ã®ã¢ã«ãŽãªãºã ã䜿çšããŠãã«ãŒãå
ã®åããŒãã®ããã«äžé£ã® ECDH å
±æç§å¯ãäœæããªããã°ãªããŸããïŒ
-
$e_0 \leftarrow \{0;1\}^{256}$ ($e_0$ 㯠CSPRNG ãéããŠååŸããããšãæšå¥šãããŸã) $E_0 = e_0 \cdot G$ - ã«ãŒãå
ã®åããŒãã«å¯ŸããŠïŒ
-
$N_i = k_i * G$ ãnode_id
ãšããŸãïŒ$k_i$ ã¯$N_i$ ã®ç§å¯éµã§ãïŒ -
$ss_i = SHA256(e_i * N_i) = SHA256(k_i * E_i)$ ïŒ$N_r$ ãš$N_i$ ã®ã¿ãç¥ã ECDH å ±æç§å¯ïŒ -
$rho_i = HMAC256(\text{"rho"}, ss_i)$ ïŒ$N_r$ ã$N_i$ ã®ããã«encrypted_recipient_data
ãæå·åããããã«äœ¿çšããéµïŒ -
$e_{i+1} = SHA256(E_i || ss_i) * e_i$ ïŒäžæçãªç§å¯ãã¹ããŒã$N_r$ ã®ã¿ãç¥ãïŒ -
$E_{i+1} = SHA256(E_i || ss_i) * E_i$ ïŒpath_key
ã泚æïŒ$N_i$ ã¯$e_i$ ãç¥ã£ãŠã¯ãªããŸããïŒ
-
-
-
first_path_key
ã$E_0$ ã«èšå®ããªããã°ãªããŸããã - 次ã®ã¢ã«ãŽãªãºã ã䜿çšããŠãåããŒãã®ããã«äžé£ã®ãã©ã€ã³ãããŒãID
$B_i$ ãäœæããªããã°ãªããŸããïŒ-
$B_i = HMAC256(\text{"blinded\_node\_id"}, ss_i) * N_i$ ïŒ$N_i$ ã®ããã®ãã©ã€ã³ãnode_id
ãç§å¯éµã¯$N_i$ ã®ã¿ãç¥ãïŒ -
path
å ã®åblinded_path_hop
ã®blinded_node_id
ã$B_i$ ã«èšå®ããªããã°ãªããŸããã
-
-
$E_{i+1}$ ãç°ãªãå€ã«çœ®ãæããããšãã§ããŸãããããããããå Žåã¯ïŒ-
encrypted_data_tlv[i].next_path_key_override
ã$E_{i+1}$ ã«èšå®ããªããã°ãªããŸããã
-
- çµè·¯ãæ£ããã³ã³ããã¹ãã§äœ¿çšãããèªåã«ãã£ãŠäœæãããããšã確èªããããã«ã
encrypted_data_tlv[r].path_id
ã«ãã©ã€ããŒãããŒã¿ãä¿åããããšãã§ããŸãã - ãã¹ãŠã®
encrypted_data_tlv[i]
ãåãé·ãã«ãªãããã«ããã£ã³ã°ããŒã¿ãè¿œå ããããšãæšå¥šãããŸãã - ChaCha20-Poly1305 ã䜿çšããŠå¯Ÿå¿ãã
$rho_i$ éµãšå šãŒãã®ãã³ã¹ã§åencrypted_data_tlv[i]
ãæå·åããencrypted_recipient_data[i]
ãçæããªããã°ãªããŸããã - çµè·¯ã®é·ããé ãããã«ãçµè·¯ã®æåŸã«è¿œå ã®ããããŒãããããè¿œå ããããšãã§ããŸãïŒåä¿¡æã«ç¡èŠãããŸãïŒã
blinded_path
ã®èªã¿æã¯æ¬¡ã®ããšãè¡ãå¿
èŠããããŸãïŒ
- èªèº«ã®ãªããªã³ãã€ããŒãã
first_node_id
ã«å°éããããã«å é ã«è¿œå ããªããã°ãªããŸããã path
å ã®åãªããªã³ãã€ããŒãã«å¯Ÿå¿ããencrypted_recipient_data
ãå«ããªããã°ãªããŸãããpath
ã®æåã®ãšã³ããªã«ã€ããŠïŒ- æ¯æããéä¿¡ããå ŽåïŒ
first_node_id
ã«å¯ŸããŠéãã©ã€ã³ããªããªã³ãã€ã¡ã³ããäœæããfirst_path_key
ãcurrent_path_key
ãšããŠå«ããã¹ãã§ãã
- ãã以å€ã®å ŽåïŒ
- æåã®ãã©ã€ã³ããã¹ãªããªã³ãæåã®
blinded_node_id
ã«æå·åããªããã°ãªããŸããã - åã®ãªããªã³ãã€ããŒãã§
next_path_key_override
ãfirst_path_key
ã«èšå®ããªããã°ãªããŸããã
- æåã®ãã©ã€ã³ããã¹ãªããªã³ãæåã®
- æ¯æããéä¿¡ããå ŽåïŒ
path
ã®ååŸç¶ã®ãšã³ããªã«ã€ããŠïŒ- 察å¿ãã
blinded_node_id
ã«ãªããªã³ãæå·åããªããã°ãªããŸããã
- 察å¿ãã
encrypted_recipient_data
ã®èªã¿æã¯æ¬¡ã®ããšãè¡ãå¿
èŠããããŸãïŒ
- 次ãèšç®ããªããã°ãªããŸããïŒ
-
$ss_i = SHA256(k_i * E_i)$ (æšæº ECDH) $b_i = HMAC256(\text{"blinded\_node\_id"}, ss_i) * k_i$ $rho_i = HMAC256(\text{"rho"}, ss_i)$
-
-
$rho_i$ ãããŒãšã㊠ChaCha20-Poly1305 ã䜿çšãããã¹ãŠãŒãã®ãã³ã¹ããŒã§encrypted_recipient_data
ãã£ãŒã«ãã埩å·ããªããã°ãªããŸããã -
encrypted_recipient_data
ãã£ãŒã«ããæ¬ èœããŠããå Žåãencrypted_data_tlv
ã«åŸ©å·ã§ããªãå ŽåããŸãã¯æªç¥ã®å¶æ°ãã£ãŒã«ããå«ãå ŽåïŒ- ãšã©ãŒãè¿ããªããã°ãªããŸããã
-
encrypted_data_tlv
ã«next_path_key_override
ãå«ãŸããŠããå ŽåïŒ- 次ã®
path_key
ãšããŠäœ¿çšããªããã°ãªããŸããã
- 次ã®
- ãã以å€ã®å ŽåïŒ
- 次ã®
path_key
ãšããŠ$E_{i+1} = SHA256(E_i || ss_i) * E_i$ ã䜿çšããªããã°ãªããŸããã
- 次ã®
- ãªããªã³ã転éãã次ã®ããŒããžã®ã©ã€ããã³ã°ã¡ãã»ãŒãžã«æ¬¡ã®
path_key
ãå«ããªããã°ãªããŸããã - æçµåå人ã§ããå ŽåïŒ
-
path_id
ããã®ç®çã®ããã«äœæããããã©ã€ã³ãã«ãŒããšäžèŽããªãå Žåãã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
-
ã«ãŒããã©ã€ã³ãã£ã³ã°ã¯åå人ã®å¿åæ§ãæäŸãã軜éãªæè¡ã§ããããã¯ã©ã³ãããŒã«ãŒãã£ã³ã°ãããæè»ã§ãã«ãŒãå ã®ããŒãã®å ¬ééµãã©ã³ãã ãªå ¬ééµã«çœ®ãæããã ãã§ãéä¿¡è ãåãããã®ãªããªã³ã«ã©ã®ããŒã¿ãå ¥ããããéžæã§ããããã«ããŸãããã©ã€ã³ãã«ãŒãã¯äžéšã®ã±ãŒã¹ïŒäŸïŒãªããªã³ã¡ãã»ãŒãžïŒã§åå©çšå¯èœã§ããããŸãã
ãã©ã€ã³ãã«ãŒãå
ã®åããŒãã¯ããªããªã³ãš encrypted_recipient_data
ãã€ããŒãã埩å·ããããã«
ç°ãªãããŒãã«ãã£ãŠçæããã2ã€ã®ãã©ã€ã³ãã«ãŒããé£çµããå Žåãæåã®ã«ãŒãã®æåŸã®ããŒãã¯ã2çªç®ã®ã«ãŒãã®æåã® path_key
ãç¥ãå¿
èŠããããŸãããã®æ
å ±ãäŒããããã« next_path_key_override
ãã£ãŒã«ãã䜿çšããªããã°ãªããŸãããçè«çã«ã¯ããã®æ¹æ³ã¯æ¯æãïŒãªããªã³ã¡ãã»ãŒãžã ãã§ãªãïŒã«ã䜿çšã§ãããããããŸããããfirst_node_id
ã«å°éããããã«ã¢ã³ãã©ã€ã³ããã¹ã䜿çšãããã㧠current_path_key
ã䜿çšããããšããå§ãããŸããããã«ãããããŒãã¯èªåãå°å
¥ãã€ã³ããšããŠäœ¿çšãããŠããããšãèªèã§ããŸããããã®ãã€ã³ãã«å°éããããã«ãã©ã€ã³ããã¹ã®ãµããŒããå¿
èŠãšãããã¢ã³ãã©ã€ã³ãéšåã®æ¯æãã«å¯ŸããŠæå³ã®ãããšã©ãŒãæäŸããŸãã
æçµåå人ã¯ããã©ã€ã³ãã«ãŒããæ£ããã³ã³ããã¹ãïŒäŸãã°ç¹å®ã®æ¯æãïŒã§äœ¿çšãããèªåã«ãã£ãŠäœæããããã®ã§ããããšã確èªããªããã°ãªããŸãããããã§ãªããšãæªæã®ããéä¿¡è
ããå®éã®åå人ã§ããå¯èœæ§ã®ãããã¹ãŠã®ããŒãã«ç°ãªããã©ã€ã³ãã«ãŒããäœæããã¡ãã»ãŒãžãåãå
¥ãããŸã§è©Šè¡ããå¯èœæ§ããããŸããåå人ã¯ãpayment_hash
ïŒãä¿åãããªããªã³ãåãåã£ããšãã«ããããäžèŽããããšã確èªããããšã§ããããé²ãããšãã§ããŸãããããªããã°ãè¿œå ã®ã¹ãã¬ãŒãžã³ã¹ããé¿ããããã«ãpath_id
ãã£ãŒã«ãã«ãã©ã€ããŒããªã³ã³ããã¹ãæ
å ±ïŒäŸãã° payment_preimage
ïŒãå
¥ãããªããªã³ãåãåã£ããšãã«ããã確èªããããšãã§ããŸãããã®å Žåãéä¿¡è
ãã¢ã¯ã»ã¹ã§ããªããã©ã€ããŒãæ
å ±ã䜿çšããããšãéèŠã§ãã
å°å ¥ãã€ã³ãããã©ã€ã³ãã«ãŒãããã®å€±æãåãåããã³ã«ããšã©ãŒã転éããåã«ã©ã³ãã ãªé 延ãè¿œå ããã¹ãã§ãã倱æã¯ãããŒãã³ã°è©Šè¡ã§ããå¯èœæ§ãé«ããã¡ãã»ãŒãžã®ã¿ã€ãã³ã°ãæ»æè ã«æçµåå人ãŸã§ã®è·é¢ãæšæž¬ããããããããŸããã
padding
ãã£ãŒã«ãã¯ããã¹ãŠã® encrypted_recipient_data
ãåãé·ãã«ãªãããã«ããããã«äœ¿çšã§ããŸããããã¯ããã©ã€ã³ãã«ãŒãã®æåŸã«ãããŒããããè¿œå ããŠãéä¿¡è
ãã©ã®ããŒããæçµåå人ã§ããããç¹å®ããã®ãé²ãã®ã«ç¹ã«æçšã§ãã
æ¯æãã«ã«ãŒããã©ã€ã³ãã£ã³ã°ã䜿çšãããå Žåãåå人ã¯éä¿¡è
ãèšå®ããã®ã§ã¯ãªãããã©ã€ã³ãããŒããæ¯æãã«é©çšãã¹ãææ°æãšæå¹æéãæå®ããŸããåå人ã¯ãŸããæªæã®ããããŒãããã©ã€ã³ãããŒãã®ã¢ã€ãã³ãã£ãã£ãã¢ã³ãã©ã€ã³ããããããŒãã³ã°æ»æãé²ãããã«ããã®ã«ãŒããééã§ããæ¯æãã«è¿œå ã®å¶çŽãå ããŸããpayment_constraints.max_cltv_expiry
ãèšå®ããŠããã©ã€ã³ãã«ãŒãã®å¯¿åœãå¶éããäžéããŒããææ°æãæŽæ°ããŠæ¯æããæåŠãããªã¹ã¯ãæžããã¹ãã§ãïŒããã«ããã«ãŒãå
ã®ããŒããã¢ã³ãã©ã€ã³ãããããšãã§ãããããããŸããïŒã
encrypted_recipient_data
ã¯ãç¹å®ã®ãã©ã€ã³ãããŒãã®ããã«æå·åããã TLV ã¹ããªãŒã ã§ããã以äžã® TLV ãã£ãŒã«ããå«ãããšããããŸãã
tlv_stream
:encrypted_data_tlv
- ã¿ã€ã:
- ã¿ã€ã: 1 (
padding
) - ããŒã¿:
- [
...*byte
:padding
]
- [
- ã¿ã€ã: 2 (
short_channel_id
) - ããŒã¿:
- [
short_channel_id
:short_channel_id
]
- [
- ã¿ã€ã: 4 (
next_node_id
) - ããŒã¿:
- [
point
:node_id
]
- [
- ã¿ã€ã: 6 (
path_id
) - ããŒã¿:
- [
...*byte
:data
]
- [
- ã¿ã€ã: 8 (
next_path_key_override
) - ããŒã¿:
- [
point
:path_key
]
- [
- ã¿ã€ã: 10 (
payment_relay
) - ããŒã¿:
- [
u16
:cltv_expiry_delta
] - [
u32
:fee_proportional_millionths
] - [
tu32
:fee_base_msat
]
- [
- ã¿ã€ã: 12 (
payment_constraints
) - ããŒã¿:
- [
u32
:max_cltv_expiry
] - [
tu64
:htlc_minimum_msat
]
- [
- ã¿ã€ã: 14 (
allowed_features
) - ããŒã¿:
- [
...*byte
:features
]
- [
- ã¿ã€ã: 1 (
æå·åãããåä¿¡è ããŒã¿ã¯ãæçµåä¿¡è ãéä¿¡è ã«æž¡ãããã«äœæãããããŒããã¡ãã»ãŒãžãã©ã®ããã«åŠçãããã®æ瀺ãå«ã¿ãŸãïŒéä¿¡è èªèº«ãäœæããããšãã§ããŸãïŒè»¢éããããŒãã¯ãããå€å¥ã§ããŸããïŒãããã¯ãæ¯æããªããªã³ãšãªããªã³ã¡ãã»ãŒãžãªããªã³ã®äž¡æ¹ã§äœ¿çšãããŸãã詳现㯠Route Blinding ãåç §ããŠãã ããã
ããŒãããã€ããŒãããã³ãŒãããåŸãããŒã«ã«ã§æ¯æããåãå ¥ãããããã€ããŒãã§æ¬¡ã®ããããšããŠç€ºããããã¢ã«è»¢éããŸãã
ããŒãã¯ãshort_channel_id
ã§æå®ããããã®ãšã¯ç°ãªãéä¿¡ãã£ãã«ãéã㊠HTLC ã転éããŠãããŸããŸããããã ããåä¿¡è
ã short_channel_id
ã«ãã£ãŠæå³ãããã®ãšåãããŒãå
¬ééµãæã£ãŠããå¿
èŠããããŸãããããã£ãŠãshort_channel_id
ãããŒã A ãš B ãæ¥ç¶ããŠããå ŽåãHTLC 㯠A ãš B ãæ¥ç¶ããä»»æã®ãã£ãã«ãéããŠè»¢éã§ããŸããããã«åŸããªãå Žåãåä¿¡è
ã¯ãªããªã³ãã±ããå
ã®æ¬¡ã®ãããã埩å·ã§ããªããªããŸãã
2 ã€ã®ãã¢ãè€æ°ã®ãã£ãã«ãæã£ãŠããå Žåãäžæµã®ããŒãã¯ããã±ãããã©ã®ãã£ãã«ãéããŠéä¿¡ãããŠãã次ã®ããããã€ããŒãã埩å·ã§ããŸãã
ããŒããéå³å¯ãªãã©ã¯ãŒãã£ã³ã°ãå®è£ ããŠããå Žåãç¹å®ã®ãã¢ãšã®ãã£ãã«åž¯åå¹ ããªã¢ã«ã¿ã€ã ã§è©äŸ¡ããããŒã«ã«ã«æé©ãªãã£ãã«ã䜿çšããããšãã§ããŸãã
äŸãã°ãA ãš B ãæ¥ç¶ãã short_channel_id
ã§æå®ããããã£ãã«ããã©ã¯ãŒãã£ã³ã°æã«ååãªåž¯åå¹
ãæããªãå ŽåãA ã¯ååãªåž¯åå¹
ãæã€å¥ã®ãã£ãã«ã䜿çšããããšãã§ããŸããããã«ãããshort_channel_id
ãéãã垯åå¹
ã®å¶çŽã§ HTLC ã倱æããéä¿¡è
ã A ãš B éã®ãã£ãã«ã ããç°ãªãåãã«ãŒããè©Šã¿ãããšãé²ããæ¯æãã®é
延ãæžå°ãããããšãã§ããŸãã
éå³å¯ãªãã©ã¯ãŒãã£ã³ã°ã«ãããããŒãã¯åä¿¡ããŒãã«æ¥ç¶ãããã©ã€ããŒããã£ãã«ãå©çšããããšãã§ããããšããã®ãã£ãã«ãå ¬éãã£ãã«ã°ã©ãã§ç¥ãããŠããªããŠãå©çšå¯èœã§ãã
éå³å¯ãªãã©ã¯ãŒãã£ã³ã°ã䜿çšããå®è£ ã¯ãåããã¢ãšã®ãã¹ãŠã®ãã£ãã«ã«åãæéã¹ã±ãžã¥ãŒã«ãé©çšããããšãæ€èšãã¹ãã§ããéä¿¡è ã¯ãå šäœã®ã³ã¹ããæãäœããªããã£ãã«ãéžæããå¯èœæ§ãé«ãããã§ããç°ãªãããªã·ãŒãæã€ãšããã©ã¯ãŒãã£ã³ã°ããŒããéä¿¡è ã«ãšã£ãŠæé©ãªæéã¹ã±ãžã¥ãŒã«ã«åºã¥ããŠæéãåãå ¥ããããšã«ãªããåããã¢ãšã®ãã¹ãŠã®ãã£ãã«ã§éçŽããã垯åå¹ ãæäŸããŠããã«ãããããããæéåå ¥ãæåŸ ããéžè±ããå¯èœæ§ããããŸãã
ãããã¯ãå®è£ ã¯éå³å¯ãªãã©ã¯ãŒãã£ã³ã°ãåæ§ã®ããªã·ãŒãæã€ãã£ãã«ã«ã®ã¿é©çšãã代æ¿ãã£ãã«ã䜿çšããããšã§æåŸ ãããæéåå ¥ãéžè±ããªãããã«ããããšãã§ããŸãã
ã«ãŒããæ§ç¯ããéããªãªãžã³ããŒãã¯æçµããŒãã«å¯ŸããŠä»¥äžã®å€ãæã€ãã€ããŒãã䜿çšããªããã°ãªããŸãã (MUST)ïŒ
payment_secret
: åå人ã«ãã£ãŠæå®ãããæ¯æãã·ãŒã¯ã¬ããã«èšå® (äŸ: BOLT #11 æ¯æãè«æ±æžã®payment_secret
)outgoing_cltv_value
: åå人ã«ãã£ãŠæå®ãããæçµæéã«èšå® (äŸ: BOLT #11 æ¯æãè«æ±æžã®min_final_cltv_expiry_delta
)amt_to_forward
: åå人ã«ãã£ãŠæå®ãããæçµéé¡ã«èšå® (äŸ: BOLT #11 æ¯æãè«æ±æžã®amount
)
ããã«ãããæçµããŒãã¯ãããã®å€ã確èªããå¿ èŠã«å¿ããŠãšã©ãŒãè¿ãããšãã§ããŸãããåæã«ãæåŸãã 2 çªç®ã®ããŒãã«ãããããŒãã³ã°æ»æã®å¯èœæ§ãæé€ããŸããããããæ»æã¯ãç°ãªãéé¡ãæé㧠HTLC ãåéä¿¡ããããšã§ãåä¿¡ãã¢ãæåŸã®ããŒãã§ãããã©ãããçºèŠããããšããå¯èœæ§ããããŸããæçµããŒãã¯åãåã£ã HTLC ãããã®ãªããªã³ãã€ããŒããæœåºãããã®å€ã HTLC ã®å€ãšæ¯èŒããŸãã詳现ã«ã€ããŠã¯ã以äžã® ãšã©ãŒã®è¿åŽ ã»ã¯ã·ã§ã³ãåç §ããŠãã ããã
äžèšã®çç±ããªããã°ãæçµããŒãã¯æ¯æãã転éããå¿ èŠããªããããåã«ãã€ããŒããç Žæ£ããããšãã§ããŸãã
çºä¿¡ããŒãã¯ãéä¿¡è
ã®ãšãã§ã¡ã©ã«ããŒãšãããã®ããŒã ID ããŒã®éã§æ¥åæ²ç·ãã£ãã£ãŒã»ãã«ãã³ (Elliptic-curve Diffie-Hellman) ã䜿çšããŠãã«ãŒãäžã®åããããšå
±æç§å¯ã確ç«ããŸããçµæãšããŠåŸãããæ²ç·ãã€ã³ãã¯å§çž®åœ¢åŒã«ã·ãªã¢ã©ã€ãºãããSHA256
ã䜿çšããŠããã·ã¥åãããŸãããã®ããã·ã¥åºåã 32 ãã€ãã®å
±æç§å¯ãšããŠäœ¿çšãããŸãã
æ¥åæ²ç·ãã£ãã£ãŒã»ãã«ãã³ (ECDH) ã¯ãEC ãã©ã€ããŒãããŒãš EC ãããªãã¯ããŒã«å¯Ÿããæäœã§ãæ²ç·ãã€ã³ããåºåããŸãããã®ãããã³ã«ã§ã¯ãlibsecp256k1
ã«å®è£
ããã ECDH ããªã¢ã³ãã䜿çšãããsecp256k1
æ¥åæ²ç·äžã§å®çŸ©ãããŠããŸãããã±ããæ§ç¯äžãéä¿¡è
ã¯ãšãã§ã¡ã©ã«ãã©ã€ããŒãããŒãšãããã®ãããªãã¯ããŒã ECDH ã®å
¥åãšããŠäœ¿çšããŸããäžæ¹ããã±ãã転éäžããããã¯ãšãã§ã¡ã©ã«ãããªãã¯ããŒãšèªèº«ã®ããŒã ID ãã©ã€ããŒãããŒã䜿çšããŸããECDH ã®ç¹æ§ã«ãããäž¡è
ã¯åãå€ãå°åºããŸãã
ã«ãŒãäžã®è€æ°ã®ããããç®ã«ãããšãã§ã¡ã©ã«ãããªãã¯ããŒã«ãã£ãŠãªã³ã¯ãããªãããã«ããããã«ãããŒã¯åãããã§ãã©ã€ã³ãåãããŸãããã©ã€ã³ãåã¯æ±ºå®è«çãªæ¹æ³ã§è¡ãããéä¿¡è ããã±ããæ§ç¯äžã«å¯Ÿå¿ãããã©ã€ã³ãåããããã©ã€ããŒãããŒãèšç®ã§ããããã«ããŸãã
EC ãããªãã¯ããŒã®ãã©ã€ã³ãåã¯ããããªãã¯ããŒãè¡šã EC ãã€ã³ããš 32 ãã€ãã®ãã©ã€ã³ãåãã¡ã¯ã¿ãŒãšã®åäžã®ã¹ã«ã©ãŒä¹ç®ã§ããã¹ã«ã©ãŒä¹ç®ã®å¯ææ§ã«ããããã©ã€ã³ãåããããã©ã€ããŒãããŒã¯ãå ¥åã®å¯Ÿå¿ãããã©ã€ããŒãããŒãšåããã©ã€ã³ãåãã¡ã¯ã¿ãŒã®ä¹ç®ç©ã§ãã
ãã©ã€ã³ãåãã¡ã¯ã¿ãŒèªäœã¯ããšãã§ã¡ã©ã«ãããªãã¯ããŒãš 32 ãã€ãã®å
±æç§å¯ã®é¢æ°ãšããŠèšç®ãããŸããå
·äœçã«ã¯ãå§çž®åœ¢åŒã§ã·ãªã¢ã©ã€ãºããããããªãã¯ããŒãšå
±æç§å¯ãé£çµãããã®ã® SHA256
ããã·ã¥å€ã§ãã
次ã®äŸã§ã¯ãéä¿¡ããŒã (çºä¿¡ããŒã) n_0
ããã±ããã åä¿¡ããŒã (æçµããŒã) n_r
ã«ã«ãŒãã£ã³ã°ããããšä»®å®ããŸãããŸããéä¿¡è
ã¯ã«ãŒã {n_0, n_1, ..., n_{r-1}, n_r}
ãèšç®ããŸãããã㧠n_0
ã¯éä¿¡è
èªèº«ã§ãããn_r
ã¯æçµåä¿¡è
ã§ãããã¹ãŠã®ããŒã n_i
ãš n_{i+1}
ã¯ãªãŒããŒã¬ã€ãããã¯ãŒã¯ã«ãŒãå
ã§ãã¢ã§ãªããã°ãªããŸãã (MUST)ãéä¿¡è
㯠n_1
ãã n_r
ãŸã§ã®ãããªãã¯ããŒãåéããã©ã³ãã 㪠32 ãã€ãã® sessionkey
ãçæããŸãããªãã·ã§ã³ã§ãéä¿¡è
㯠é¢é£ããŒã¿ ãæž¡ãããšãã§ããŸããããã¯ããã±ãããã³ãããããããã±ããèªäœã«ã¯å«ãŸããªãããŒã¿ã§ããé¢é£ããŒã¿ã¯ HMAC ã«å«ãŸããåãããã§ã®æŽåæ§æ€èšŒæã«æäŸãããé¢é£ããŒã¿ãšäžèŽããªããã°ãªããŸããã
ãªããªã³ãæ§ç¯ããããã«ãéä¿¡è
ã¯æåã®ããã ek_1
ã®ãšãã§ã¡ã©ã«ç§å¯éµã sessionkey
ã«åæåããããã secp256k1
åºç¹ã§ä¹ç®ããããšã§å¯Ÿå¿ãããšãã§ã¡ã©ã«å
¬ééµ epk_1
ãå°åºããŸããã«ãŒãã«æ²¿ã£ã k
åã®ãããããšã«ãéä¿¡è
ã¯æ¬¡ã®ããã«ããŠå
±æç§å¯ ss_k
ãšæ¬¡ã®ãããã®ãšãã§ã¡ã©ã«éµ ek_{k+1}
ãå埩çã«èšç®ããŸãã
- éä¿¡è
ã¯ãããã®å
¬ééµãšãšãã§ã¡ã©ã«ç§å¯éµã䜿ã£ãŠ ECDH ãå®è¡ããæ²ç·ãã€ã³ããååŸããŸããããã
SHA256
ã§ããã·ã¥ããŠå ±æç§å¯ss_k
ãçæããŸãã - ãã©ã€ã³ãã£ã³ã°ãã¡ã¯ã¿ã¯ããšãã§ã¡ã©ã«å
¬ééµ
epk_k
ãšå ±æç§å¯ss_k
ãé£çµãããã®ãSHA256
ã§ããã·ã¥ãããã®ã§ãã - 次ã®ãããã®ãšãã§ã¡ã©ã«ç§å¯éµ
ek_{k+1}
ã¯ãçŸåšã®ãšãã§ã¡ã©ã«ç§å¯éµek_k
ã«ãã©ã€ã³ãã£ã³ã°ãã¡ã¯ã¿ãä¹ç®ããŠèšç®ããŸãã - 次ã®ãããã®ãšãã§ã¡ã©ã«å
¬ééµ
epk_{k+1}
ã¯ããšãã§ã¡ã©ã«ç§å¯éµek_{k+1}
ãåºç¹ã§ä¹ç®ããŠå°åºããŸãã
éä¿¡è
ãäžèšã®å¿
èŠãªæ
å ±ããã¹ãŠååŸãããããã±ãããæ§ç¯ã§ããŸããr
åã®ããããçµç±ãããã±ãããæ§ç¯ããã«ã¯ãr
åã® 32 ãã€ãã®ãšãã§ã¡ã©ã«å
¬ééµãr
åã® 32 ãã€ãã®å
±æç§å¯ãr
åã® 32 ãã€ãã®ãã©ã€ã³ãã£ã³ã°ãã¡ã¯ã¿ãããã³ r
åã®å¯å€é· hop_payload
ãã€ããŒããå¿
èŠã§ãããã®æ§ç¯ã¯ãåäžã® 1366 ãã€ãã®ãã±ãããšæåã®åä¿¡ãã¢ã®ã¢ãã¬ã¹ãè¿ããŸãã
ãã±ããã®æ§ç¯ã¯ã«ãŒãã®éé ã§è¡ãããŸããã€ãŸããæåŸã®ãããã®æäœãæåã«é©çšãããŸãã
ãã±ãã㯠CSPRNG (ChaCha20) ãã掟çãã 1300 ãã€ãã® ã©ã³ãã ãã€ãã§åæåãããŸããäžèšã§åç
§ãããŠãã pad ããŒã¯ãChaCha20 ã¹ããªãŒã ããè¿œå ã®ã©ã³ãã ãã€ããæœåºããããã«äœ¿çšãããããã CSPRNG ãšããŠå©çšããŸããpaddingKey
ãååŸããããšãChaCha20 ã¯ãã¹ãŠãŒãã®ãã³ã¹ã§äœ¿çšããã1300 ãã€ãã®ã©ã³ãã ãã€ããçæããŸãããããã®ã©ã³ãã ãã€ãã¯ãäœæãããããã¯ã¹ãããã®éå§ç¶æ
ãšããŠäœ¿çšãããŸãã
ãã£ã©ãŒã¯å ±æç§å¯ã䜿çšããŠçæãããŸãïŒãã£ã©ãŒçæãåç §ïŒã
ã«ãŒãã®åãããã«å¯ŸããŠãéé ã§éä¿¡è ã¯æ¬¡ã®æäœãé©çšããŸãã
- _rho_ããŒãš_mu_ããŒã¯ããããã®å ±æç§å¯ã䜿çšããŠçæãããŸãã
shift_size
ã¯ãhop_payload
ã®é·ãã«ããã®é·ãã®ããã°ãµã€ãºãšã³ã³ãŒãã£ã³ã°ãšãã® HMAC ã®é·ããå ãããã®ãšããŠå®çŸ©ãããŸãããããã£ãŠããã€ããŒãã®é·ããl
ã®å Žåãshift_size
ã¯l < 253
ã®å Žå1 + l + 32
ãšãªããããã§ãªãå Žåã¯3 + l + 32
ãšãªããŸããhop_payload
ãã£ãŒã«ãã¯shift_size
ãã€ãåå³ã«ã·ããããã1300 ãã€ãã®ãµã€ãºãè¶ ããæåŸã®shift_size
ãã€ãã¯ç Žæ£ãããŸãã- ããã°ãµã€ãºã§ã·ãªã¢ã©ã€ãºãããé·ããã·ãªã¢ã©ã€ãºããã
hop_payload
ãšhmac
ã¯ã次ã®shift_size
ãã€ãã«ã³ããŒãããŸãã - _rho_ããŒã¯ã1300 ãã€ãã®ç䌌ã©ã³ãã ãã€ãã¹ããªãŒã ãçæããããã«äœ¿çšãããããã
XOR
ãšå ±ã«hop_payloads
ãã£ãŒã«ãã«é©çšãããŸãã - ãããæåŸã®ããããã€ãŸãæåã®ã€ãã¬ãŒã·ã§ã³ã§ããå Žåã
hop_payloads
ãã£ãŒã«ãã®æ«å°Ÿã¯ã«ãŒãã£ã³ã°æ å ±filler
ã§äžæžããããŸãã - 次㮠HMAC ã¯ãé£çµããã
hop_payloads
ãšé¢é£ããŒã¿ã«å¯Ÿã㊠(HMACããŒãšã㊠_mu_ããŒã䜿çšããŠ) èšç®ãããŸãã
çµæãšããŠåŸãããæçµç㪠HMAC å€ã¯ãã«ãŒãå ã®æåã®åä¿¡ãã¢ã«ãã£ãŠäœ¿çšããã HMAC ã§ãã
ãã±ããçæã¯ãversion
ãã€ããæåã®ãããã®ããã®ãšãã§ã¡ã©ã«å
¬ééµãæåã®ãããã®ããã® HMACãããã³é£èªåããã hop_payloads
ãå«ãã·ãªã¢ã©ã€ãºããããã±ãããè¿ããŸãã
以äžã® Go ã³ãŒãã¯ããã±ããæ§ç¯ã®äŸãšããŠã®å®è£ ã§ãïŒ
func NewOnionPacket(paymentPath []*btcec.PublicKey, sessionKey *btcec.PrivateKey,
hopsData []HopData, assocData []byte) (*OnionPacket, error) {
numHops := len(paymentPath)
hopSharedSecrets := make([][sha256.Size]byte, numHops)
// Initialize ephemeral key for the first hop to the session key.
var ephemeralKey big.Int
ephemeralKey.Set(sessionKey.D)
for i := 0; i < numHops; i++ {
// Perform ECDH and hash the result.
ecdhResult := scalarMult(paymentPath[i], ephemeralKey)
hopSharedSecrets[i] = sha256.Sum256(ecdhResult.SerializeCompressed())
// Derive ephemeral public key from private key.
ephemeralPrivKey := btcec.PrivKeyFromBytes(btcec.S256(), ephemeralKey.Bytes())
ephemeralPubKey := ephemeralPrivKey.PubKey()
// Compute blinding factor.
sha := sha256.New()
sha.Write(ephemeralPubKey.SerializeCompressed())
sha.Write(hopSharedSecrets[i])
var blindingFactor big.Int
blindingFactor.SetBytes(sha.Sum(nil))
// Blind ephemeral key for next hop.
ephemeralKey.Mul(&ephemeralKey, &blindingFactor)
ephemeralKey.Mod(&ephemeralKey, btcec.S256().Params().N)
}
// Generate the padding, called "filler strings" in the paper.
filler := generateHeaderPadding("rho", numHops, hopDataSize, hopSharedSecrets)
// Allocate and initialize fields to zero-filled slices
var mixHeader [routingInfoSize]byte
var nextHmac [hmacSize]byte
// Our starting packet needs to be filled out with random bytes, we
// generate some deterministically using the session private key.
paddingKey := generateKey("pad", sessionKey.Serialize()
paddingBytes := generateCipherStream(paddingKey, routingInfoSize)
copy(mixHeader[:], paddingBytes)
// Compute the routing information for each hop along with a
// MAC of the routing information using the shared key for that hop.
for i := numHops - 1; i >= 0; i-- {
rhoKey := generateKey("rho", hopSharedSecrets[i])
muKey := generateKey("mu", hopSharedSecrets[i])
hopsData[i].HMAC = nextHmac
// Shift and obfuscate routing information
streamBytes := generateCipherStream(rhoKey, numStreamBytes)
rightShift(mixHeader[:], hopDataSize)
buf := &bytes.Buffer{}
hopsData[i].Encode(buf)
copy(mixHeader[:], buf.Bytes())
xor(mixHeader[:], mixHeader[:], streamBytes[:routingInfoSize])
// These need to be overwritten, so every node generates a correct padding
if i == numHops-1 {
copy(mixHeader[len(mixHeader)-len(filler):], filler)
}
packet := append(mixHeader[:], assocData...)
nextHmac = calcMac(muKey, packet)
}
packet := &OnionPacket{
Version: 0x00,
EphemeralKey: sessionKey.PubKey(),
RoutingInfo: mixHeader,
HeaderMAC: nextHmac,
}
return packet, nil
}
䜿çšãã onion_packet
ã«ã¯äºçš®é¡ãããŸãïŒ
- æ¯æãã®ããã®
update_add_htlc
å ã®onion_routing_packet
ã§ãpayload
TLV ãå«ã¿ãŸãïŒAdding an HTLC ãåç §ïŒ - ã¡ãã»ãŒãžã®ããã®
onion_message
å ã®onion_message_packet
ã§ãonionmsg_tlv
TLV ãå«ã¿ãŸãïŒOnion Messages ãåç §ïŒ
ãããã®ã»ã¯ã·ã§ã³ã§ã¯ã䜿çšãã associated_data
ãpath_key
ïŒããããã°ïŒãæœåºããããã€ããŒãã®åœ¢åŒãšåŠçïŒæ¬¡ã®ãã¢ã決å®ããæ¹æ³ãå«ãïŒãããã³ãšã©ãŒã®åŠçæ¹æ³ãæå®ããŸããåŠçèªäœã¯åäžã§ãã
èªè ïŒ
-
version
ã 0 ã§ãªãå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
public_key
ãæå¹ãªå ¬ééµã§ãªãå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
- ãªããªã³ãæ¯æãçšã®å ŽåïŒ
-
hmac
ã以åã«åä¿¡ãããŠããå ŽåïŒ- ãã¬ã€ã¡ãŒãžãæ¢ç¥ã§ããå ŽåïŒ
- ãã¬ã€ã¡ãŒãžã䜿çšã㊠HTLC ãå³åº§ã«åéããŠãããŸããŸããã
- ããã§ãªãå ŽåïŒ
- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
- ãã¬ã€ã¡ãŒãžãæ¢ç¥ã§ããå ŽåïŒ
-
-
path_key
ãæå®ãããŠããå ŽåïŒ-
blinding_ss
ã ECDH(path_key
,node_privkey
) ãšããŠèšç®ããŸãã - 次ã®ãããããè¡ããŸãïŒ
-
$HMAC256(\text{"blinded\_node\_id"}, blinding\_ss)$ ã§public_key
ãä¹ç®ããŠèª¿æŽããŸãã
-
- ãŸãã¯ïŒåçã«ïŒïŒ
-
$HMAC256(\text{"blinded\_node\_id"}, blinding\_ss)$ ã§ä»¥äžã®èªèº«ã®node_privkey
ãä¹ç®ããŠèª¿æŽããŸãã
-
-
- å
±æç§å¯
ss
ã ECDH(public_key
,node_privkey
) ãšããŠå°åºããŸãïŒShared Secret ãåç §ïŒã -
mu
ã$HMAC256(\text{"mu"}, ss)$ ãšããŠå°åºããŸãïŒKey Generation ãåç §ïŒã - HMAC ã
$HMAC256(mu, hop\_payloads || associated\_data)$ ãšããŠå°åºããŸãã - èšç®ããã HMAC ãš
hmac
ãå®æ°æéã§æ¯èŒããªããã°ãªããŸããã - èšç®ããã HMAC ãš
hmac
ãç°ãªãå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
rho
ã$HMAC256(\text{"rho"}, ss)$ ãšããŠå°åºããŸãïŒKey Generation ãåç §ïŒã -
rho
ã䜿çšããŠhop_payloads
ã® 2 åã®é·ãã®bytestream
ãå°åºããŸãïŒPseudo Random Byte Stream ãåç §ïŒã -
unwrapped_payloads
ãhop_payloads
ãšbytestream
ã® XOR ã«èšå®ããŸãã -
unwrapped_payloads
ã®å é ããbigsize
ãpayload_length
ãšããŠåé€ããŸãããããäžæ£ãªå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
payload_length
ã 2 æªæºã®å ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
unwrapped_payloads
ã«payload_length
ãã€ãæªæºãæ®ã£ãŠããå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
unwrapped_payloads
ã®å é ããpayload_length
ãã€ããåé€ããçŸåšã®payload
ãšããŸãã -
unwrapped_payloads
ã« 32 ãã€ãæªæºãæ®ã£ãŠããå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
unwrapped_payloads
ã®å é ãã 32 ãã€ããnext_hmac
ãšããŠåé€ããŸãã -
unwrapped_payloads
ãhop_payloads
ããå°ããå ŽåïŒ- ãã±ããã®åŠçãäžæ¢ãã倱æããªããã°ãªããŸããã
-
next_hmac
ãå šãŠãŒãã§ãªãå ŽåïŒæçµããŒãã§ãªãå ŽåïŒïŒ-
blinding_tweak
ã$SHA256(public\_key || ss)$ ãšããŠå°åºããŸãïŒBlinding Ephemeral Onion Keys ãåç §ïŒã - 次ã®ãã¢ã«ãªããªã³ã転éããã¹ãã§ãïŒ
-
version
ã 0 ã«èšå®ããŸãã -
public_key
ãblinding_tweak
ã§ä¹ç®ããåä¿¡public_key
ã«èšå®ããŸãã -
hop_payloads
ãunwrapped_payloads
ã«èšå®ããåä¿¡hop_payloads
ã®ãµã€ãºã«åãè©°ããŸãã -
hmac
ãnext_hmac
ã«èšå®ããŸãã
-
- 転éã§ããªãå ŽåïŒ
- 倱æããªããã°ãªããŸããã
-
- ãã以å€ã®å ŽåïŒå
šãŠãŒãã®
next_hmac
ïŒïŒ- ããã¯ãªããªã³ã®æçµç®çå°ã§ãã
ãã©ã€ã³ããã¹ã䜿çšãããå Žåãéä¿¡è
ã¯å®éã«ã¯ãã®ãªããªã³ãç§ãã¡ã® node_id
ã®ããã«æå·åããã®ã§ã¯ãªãã調æŽãããããŒãžã§ã³ã®ããã«æå·åããŠããŸããç§ãã¡ã¯ããªããªã³ãšäžç·ã«æäŸããã path_key
ãã䜿çšããã調æŽãå°ãåºãããšãã§ããŸããããããããªããªã³ã埩å·åããããã«åãæ¹æ³ã§ããŒãã®ç§å¯éµã調æŽããããæ°åŠçã«åçã§ãããªããªã³ã®ãšãã§ã¡ã©ã«ããŒã調æŽããŸãã
ãã±ãããåãåããšãåŠçããŒãã¯ã«ãŒãæ å ±ãšåãããã®ãã€ããŒãããèªåå®ã®æ å ±ãæœåºããŸãã æœåºã¯ããã£ãŒã«ããããªãã¹ã¯ãšãŒãããå·Šã·ããããããšã§è¡ããŸãã ããã«ãããåãããã§ãã£ãŒã«ããçããªããæ»æè ãã«ãŒãã®é·ããæšæž¬ã§ããããã«ãªããŸãããã®ããããã£ãŒã«ãã¯è»¢éåã«äºåã«ããã£ã³ã°ãããŸãã ããã£ã³ã°ã¯ HMAC ã®äžéšã§ããããããªãªãžã³ããŒãã¯åããããçæãããã®ãšåäžã®ããã£ã³ã°ãäºåã«çæããŠãåãããã® HMAC ãæ£ããèšç®ããå¿ èŠããããŸãã éžæãããã«ãŒãã 1300 ãã€ãããçãå Žåããã£ã©ãŒã¯ãã£ãŒã«ãã®é·ããããã£ã³ã°ããããã«ã䜿çšãããŸãã
hop_payloads
ãããªãã¹ã¯ãšãŒãããåã«ãåŠçããŒãã¯ããã 1300 ãã€ãã® 0x00
ã§ããã£ã³ã°ããåèšé·ã 2*1300
ã«ãªãããã«ããŸãã
次ã«ãåãé·ãã®ç䌌ã©ã³ãã ãã€ãã¹ããªãŒã ãçæããããã XOR
㧠hop_payloads
ã«é©çšããŸãã
ããã«ãããèªåå®ã®æ
å ±ãããªãã¹ã¯ãšãŒãããããšåæã«ãæ«å°Ÿã«è¿œå ããã 0x00
ãã€ãããªãã¹ã¯ãšãŒããããŸãã
æ£ãã HMAC ãèšç®ããããã«ããªãªãžã³ããŒãã¯åãããã® hop_payloads
ãäºåã«çæããåãããã«ãã£ãŠè¿œå ãããã€ã³ã¯ãªã¡ã³ã¿ã«ã«ãªãã¹ã¯ãšãŒããããããã£ã³ã°ãå«ããå¿
èŠããããŸãããã®ã€ã³ã¯ãªã¡ã³ã¿ã«ã«ãªãã¹ã¯ãšãŒããããããã£ã³ã°ã¯ filler
ãšåŒã°ããŸãã
以äžã®äŸã®ã³ãŒãã¯ãGo ã§ãã£ã©ãŒãã©ã®ããã«çæããããã瀺ããŠããŸãïŒ
func generateFiller(key string, numHops int, hopSize int, sharedSecrets [][sharedSecretSize]byte) []byte {
fillerSize := uint((numMaxHops + 1) * hopSize)
filler := make([]byte, fillerSize)
// The last hop does not obfuscate, it's not forwarding anymore.
for i := 0; i < numHops-1; i++ {
// Left-shift the field
copy(filler[:], filler[hopSize:])
// Zero-fill the last hop
copy(filler[len(filler)-hopSize:], bytes.Repeat([]byte{0x00}, hopSize))
// Generate pseudo-random byte stream
streamKey := generateKey(key, sharedSecrets[i])
streamBytes := generateCipherStream(streamKey, fillerSize)
// Obfuscate
xor(filler, filler, streamBytes)
}
// Cut filler down to the correct length (numHops+1)*hopSize
// bytes will be prepended by the packet generation.
return filler[(numMaxHops-numHops+2)*hopSize:]
}
ãã®äŸã®å®è£
ã¯ãã¢ã³ã¹ãã¬ãŒã·ã§ã³ç®çã®ã¿ã§ããããšã«æ³šæããŠãã ãããfiller
ã¯ãã£ãšå¹ççã«çæããããšãã§ããŸãã
æåŸã®ãããã¯ãã±ãããããã«è»¢éããªããããfiller
ããªãã¹ã¯ãšãŒãããå¿
èŠã¯ãªããHMAC ãæœåºããå¿
èŠããããŸããã
ãªããªã³ã«ãŒãã£ã³ã°ãããã³ã«ã«ã¯ãæå·åããããšã©ãŒã¡ãã»ãŒãžãèµ·ç¹ããŒãã«è¿ãããã®ç°¡åãªã¡ã«ããºã ãå«ãŸããŠããŸããè¿ããããšã©ãŒã¡ãã»ãŒãžã¯ãæçµããŒããå«ãä»»æã®ãããã«ãã£ãŠå ±åããã倱æã§ããå¯èœæ§ããããŸãã転éãã±ããã®ãã©ãŒãããã¯ãèµ·ç¹ä»¥å€ã®ãããããã®çæã«å¿ èŠãªæ å ±ã«ã¢ã¯ã»ã¹ã§ããªããããè¿åŽçµè·¯ã«ã¯äœ¿çšã§ããŸããããããã®ãšã©ãŒã¡ãã»ãŒãžã¯ããããã®å€±æã®å¯èœæ§ãããããããªã³ãã§ãŒã³ã«é 眮ãããªããããä¿¡é Œæ§ããªãããšã«æ³šæããŠãã ããã
äžéãããã¯ã転éçµè·¯ããã®å ±æç§å¯ãä¿åãããããåå©çšããŠåãããã§å¯Ÿå¿ããè¿åŽãã±ãããé£èªåããŸããããã«ãåããŒãã¯ã«ãŒãå ã®èªèº«ã®éä¿¡ãã¢ã«é¢ããããŒã¿ãããŒã«ã«ã«ä¿åããæçµçãªè¿åŽãã±ãããã©ãã«è¿éããããç¥ã£ãŠããŸãããšã©ãŒã¡ãã»ãŒãžãçæããããŒãïŒãšã©ãŒãèµ·ãããããŒãïŒã¯ã次ã®ãã£ãŒã«ãã§æ§æãããè¿åŽãã±ãããäœæããŸãã
- ããŒã¿ïŒ
- [
32*byte
:hmac
] - [
u16
:failure_len
] - [
failure_len*byte
:failuremsg
] - [
u16
:pad_len
] - [
pad_len*byte
:pad
]
- [
ããã§ãhmac
ã¯ãã±ããã®æ®ããèªèšŒãã HMAC ã§ãããäžèšã®ããã»ã¹ã䜿çšããŠçæãããããŒã§ãããŒã¿ã€ã㯠um
ã§ããfailuremsg
ã¯ä»¥äžã§å®çŸ©ãããpad
ã¯é·ããé ãããã«äœ¿çšãããäœåãªãã€ãã§ãã
ãšã©ãŒãèµ·ãããããŒãã¯æ¬¡ã«ãããŒã¿ã€ã ammag
ã䜿çšããŠæ°ããããŒãçæããŸãããã®ããŒã¯ããã±ããã« XOR
ãé©çšããããã«äœ¿çšãããç䌌ã©ã³ãã ã¹ããªãŒã ãçæããããã«äœ¿çšãããŸãã
é£èªåã®ã¹ãããã¯ãè¿åŽçµè·¯ã«æ²¿ã£ãåãããã«ãã£ãŠç¹°ãè¿ãããŸããè¿åŽãã±ãããåãåããšãåãããã¯ãã® ammag
ãçæããç䌌ã©ã³ãã ãã€ãã¹ããªãŒã ãçæããè¿åŽãã±ããã«çµæãé©çšããŠããè¿éããŸãã
èµ·ç¹ããŒãã¯ã察å¿ãã転éãã±ããã®çºä¿¡è
ã§ãããããè¿åŽã¡ãã»ãŒãžã®æçµçãªåä¿¡è
ã§ããããšãæ€åºã§ããŸããèµ·ç¹ããŒããèªåãéå§ãã転éã«äžèŽãããšã©ãŒã¡ãã»ãŒãžãåãåã£ãå ŽåïŒã€ãŸãããšã©ãŒããã以äžè¿éã§ããªãå ŽåïŒãã«ãŒãå
ã®åãããã® ammag
ãš um
ããŒãçæããŸãããã®åŸãåãããã® ammag
ããŒã䜿çšããŠãšã©ãŒã¡ãã»ãŒãžãå埩çã«åŸ©å·ããåãããã® um
ããŒã䜿çšã㊠HMAC ãèšç®ããŸããèµ·ç¹ããŒãã¯ãèšç®ããã HMAC ãš hmac
ãã£ãŒã«ããäžèŽãããããšã§ããšã©ãŒã¡ãã»ãŒãžã®éä¿¡è
ãæ€åºã§ããŸãã
転éãã±ãããšæ»ããã±ããã®é¢é£ä»ãã¯ããã®ãªããªã³ã«ãŒãã£ã³ã°ãããã³ã«ã®å€éšã§åŠçãããŸããäŸãã°ãæ¯æããã£ãã«ã® HTLC ãšé¢é£ä»ããããšã§è¡ããŸãã
path_key
ã䜿çšãã HTLC ã®ãšã©ãŒãã³ããªã³ã°ã¯ç¹ã«åä»ã§ããå®è£
ïŒãŸãã¯ããŒãžã§ã³ïŒã®éããããã©ã€ã³ããã¹ã®èŠçŽ ãå¿åå解é€ããããã«å©çšãããå¯èœæ§ãããããã§ãããã®ããããã¹ãŠã®ãšã©ãŒã invalid_onion_blinding
ã«å€æããå°å
¥ç¹ã§éåžžã®ãªããªã³ãšã©ãŒã«å€æããããšã«æ±ºå®ããŸããã
ãšã©ãŒãèµ·ãããããŒãïŒ
failure_len
ãšpad_len
ã®åèšãå°ãªããšã 256 ã«ãªãããã«pad
ãèšå®ããªããã°ãªããŸãããfailure_len
ãšpad_len
ã®åèšã 256 ã«ãªãããã«pad
ãèšå®ããããšãæšå¥šãããŸããããã«éžè±ãããšãå€ãããŒããæ»ãã¡ãã»ãŒãžã解æã§ããªããªãå¯èœæ§ããããŸãã
èµ·ç¹ããŒãïŒ
- æ»ãã¡ãã»ãŒãžã埩å·ããããïŒ
- ã¡ãã»ãŒãžã®ã³ããŒãä¿åããããšãæšå¥šãããŸãã
- ã«ãŒãã 27 åç¹°ãè¿ããããŸã§ïŒtlv ãã€ããŒãã¿ã€ãã®æ倧ã«ãŒãé·ïŒã埩å·ãç¶ããããšãæšå¥šãããŸãã
- ã«ãŒãé·ãé ãããã«å®æ°
ammag
ãšum
ããŒã䜿çšããããšãæšå¥šãããŸãã
èµ·ç¹ããŒã ã®èŠä»¶ã¯ãæ¯æãéä¿¡è ãé ãã®ã«åœ¹ç«ã¡ãŸãããšã©ãŒãèŠã€ãã£ãåŸã«ãããŒåŸ©å·ãµã€ã¯ã«ã 27 åç¶ããããšã§ããšã©ãŒãèµ·ãããããŒãã¯ãéä¿¡è ãåãã«ãŒããè€æ°åè©Šã¿ãå Žåã«ã¿ã€ãã³ã°åæãè¡ã£ãŠããèªèº«ã®ã«ãŒãå ã§ã®çžå¯Ÿäœçœ®ãç¥ãããšãã§ããŸããã
failuremsg
ã«ã«ãã»ã«åããããšã©ãŒã¡ãã»ãŒãžã¯ãéåžžã®ã¡ãã»ãŒãžãšåäžã®ãã©ãŒããããæã¡ãŸãã2 ãã€ãã®ã¿ã€ã failure_code
ã«ç¶ããŠããã®ã¿ã€ãã«é©çšãããããŒã¿ãç¶ããŸããã¡ãã»ãŒãžããŒã¿ã®åŸã«ã¯ããªãã·ã§ã³ã® TLV ã¹ããªãŒã ãç¶ããŸãã
以äžã¯ãçŸåšãµããŒããããŠãã failure_code
å€ã®ãªã¹ããšãããã«ç¶ã䜿çšã±ãŒã¹ã®èŠä»¶ã§ãã
failure_code
ã¯ä»ã®ã¡ãã»ãŒãžã¿ã€ããšåãã¿ã€ãã§ã¯ãªãããšã«æ³šæããŠãã ãããä»ã® BOLT ã§å®çŸ©ãããŠããããã«ããããã¯ãã©ã³ã¹ããŒãå±€ã§çŽæ¥éä¿¡ãããã®ã§ã¯ãªããæ»ããã±ããå
ã«ã©ãããããŠéä¿¡ãããŸãããã®ãããfailure_code
ã®æ°å€ã¯ãä»ã®ã¡ãã»ãŒãžã¿ã€ãã«å²ãåœãŠãããå€ãåå©çšããŠããè¡çªãåŒãèµ·ããå±éºã¯ãããŸããã
failure_code
ã®äžäœãã€ãã¯ãã©ã°ã®ã»ãããšããŠèªã¿åãããšãã§ããŸãïŒ
- 0x8000 (BADONION)ïŒéä¿¡ãã¢ã«ãã£ãŠæå·åããã解æäžèœãªãªããªã³
- 0x4000 (PERM)ïŒæä¹ çãªé害ïŒããã§ãªããã°äžæçïŒ
- 0x2000 (NODE)ïŒããŒãé害ïŒããã§ãªããã°ãã£ãã«ïŒ
- 0x1000 (UPDATE)ïŒãã£ãã«è»¢éãã©ã¡ãŒã¿ãéåããã
以äžã® failure_code
ãå®çŸ©ãããŠããŸãïŒ
- type: NODE|2 (
temporary_node_failure
)
åŠçããŒãã®äžè¬çãªäžæçé害ã
- type: PERM|NODE|2 (
permanent_node_failure
)
åŠçããŒãã®äžè¬çãªæä¹ çé害ã
- type: PERM|NODE|3 (
required_node_feature_missing
)
åŠçããŒãã«ã¯ããã®ãªããªã³ã«å«ãŸããŠããªãå¿ èŠãªæ©èœããããŸãã
- type: BADONION|PERM|4 (
invalid_onion_version
) - data:
- [
sha256
:sha256_of_onion
]
- [
version
ãã€ããåŠçããŒãã«ãã£ãŠç解ãããŸããã§ããã
- type: BADONION|PERM|5 (
invalid_onion_hmac
) - data:
- [
sha256
:sha256_of_onion
]
- [
ãªããªã³ã® HMAC ãåŠçããŒãã«å°éãããšãã«æ£ãããããŸããã§ããã
- type: BADONION|PERM|6 (
invalid_onion_key
) - data:
- [
sha256
:sha256_of_onion
]
- [
äžæçãªããŒãåŠçããŒãã«ãã£ãŠè§£æäžèœã§ããã
- type: UPDATE|7 (
temporary_channel_failure
) - data:
- [
u16
:len
] - [
len*byte
:channel_update
]
- [
åŠçããŒãããã®ãã£ãã«ããã® HTLC ãåŠçã§ããŸããã§ããããåŸã§ãããŸãã¯ä»ã®ãã®ãåŠçã§ããå¯èœæ§ããããŸãã
- type: PERM|8 (
permanent_channel_failure
)
åŠçããŒãããã®ãã£ãã«ã¯ãHTLC ãåŠçã§ããŸããã
- type: PERM|9 (
required_channel_feature_missing
)
åŠçããŒãããã®ãã£ãã«ã«ã¯ããªããªã³ã«ååšããªãæ©èœãå¿ èŠã§ãã
- type: PERM|10 (
unknown_next_peer
)
ãªããªã³ãæå®ãã short_channel_id
ããåŠçããŒãããã®ã©ã®ãªãŒãã£ã³ã°ãšãäžèŽããŸããã
- type: UPDATE|11 (
amount_below_minimum
) - data:
- [
u64
:htlc_msat
] - [
u16
:len
] - [
len*byte
:channel_update
]
- [
HTLC ã®éé¡ããåŠçããŒãããã®ãã£ãã«ã® htlc_minimum_msat
ãäžåã£ãŠããŸããã
- type: UPDATE|12 (
fee_insufficient
) - data:
- [
u64
:htlc_msat
] - [
u16
:len
] - [
len*byte
:channel_update
]
- [
ææ°æã®éé¡ããåŠçããŒãããã®ãã£ãã«ã§èŠæ±ãããéé¡ãäžåã£ãŠããŸããã
- type: UPDATE|13 (
incorrect_cltv_expiry
) - data:
- [
u32
:cltv_expiry
] - [
u16
:len
] - [
len*byte
:channel_update
]
- [
cltv_expiry
ããåŠçããŒãããã®ãã£ãã«ã§èŠæ±ããã cltv_expiry_delta
ã«æºæ ããŠããŸããã以äžã®èŠä»¶ãæºãããŠããŸããïŒ
cltv_expiry - cltv_expiry_delta >= outgoing_cltv_value
- type: UPDATE|14 (
expiry_too_soon
) - data:
- [
u16
:len
] - [
len*byte
:channel_update
]
- [
CLTV ã®æéãçŸåšã®ãããã¯é«ã«è¿ãããŠãåŠçããŒãã«ããå®å šãªåŠçãã§ããŸããã
- type: PERM|15 (
incorrect_or_unknown_payment_details
) - data:
- [
u64
:htlc_msat
] - [
u32
:height
]
- [
payment_hash
ãæçµããŒãã«ãšã£ãŠæªç¥ã§ãããpayment_secret
ã payment_hash
ãšäžèŽããªãããã® payment_hash
ã«å¯Ÿããéé¡ãäœããããhtlc ã® CLTV æéãçŸåšã®ãããã¯é«ã«è¿ãããŠå®å
šã«åŠçã§ããªãããŸã㯠payment_metadata
ãå¿
èŠãªå Žåã«ååšããªãããªã©ã®çç±ããããŸãã
htlc_msat
ãã©ã¡ãŒã¿ã¯åé·ã§ãããåŸæ¹äºææ§ã®ããã«æ®ãããŠããŸããhtlc_msat
ã®å€ã¯ãæçµãããã®ãªããªã³ãã€ããŒãã§æå®ãããå€ä»¥äžã§ããå¿
èŠããããŸãããããã£ãŠãéä¿¡è
ã«ãšã£ãŠå®è³ªçãªæ
å ±äŸ¡å€ã¯ãããŸããïŒãã ããåã®ããŒããäºæ³ããäœãææ°æãåã£ãããšã瀺ããããããŸããïŒãåã®ãããã htlc ã«å¯ŸããŠäœãããéé¡ãŸãã¯æéãéä¿¡ããå Žåã¯ãfinal_incorrect_cltv_expiry
ããã³ final_incorrect_htlc_amount
ãéããŠåŠçãããŸãã
height
ãã©ã¡ãŒã¿ã¯ãhtlc ãåä¿¡ããæç¹ã§ã®æçµããŒãã«ãã£ãŠæãããç¥ãããŠãããããã¯é«ã«èšå®ãããŸããããã䜿çšããŠãéä¿¡è
ã¯èª€ã£ãæçµ CLTV æéã§æ¯æããéä¿¡ããå Žåãšãäžéããããæ¯æããé
延ãããããã«åä¿¡è
ã®è«æ±æž CLTV ãã«ã¿èŠä»¶ãæºããããªããªã£ãå Žåãåºå¥ã§ããŸãã
泚æïŒå
ã
PERM|16 (incorrect_payment_amount
) ãš 17 (final_expiry_too_soon
) ã¯ãæªç¥ã®æ¯æãããã·ã¥ããäžæ£ãª htlc ãã©ã¡ãŒã¿ãåºå¥ããããã«äœ¿çšãããŠããŸãããæ®å¿µãªããããã®å¿çãéä¿¡ãããšãHTLC ã転éããããã«åä¿¡ããããŒãããåãããã·ã¥ã§ããäœãå€ãŸãã¯æéã®æ¯æããæœåšçãªå®å
ã«éä¿¡ããå¿çã確èªããããšã§æçµç®çå°ãæšæž¬ãããããŒãã³ã°æ»æãèš±å¯ããŠããŸããŸããå®è£
ã§ã¯ãfinal_expiry_too_soon
(17) ã®ä»¥åã®éæ°žç¶çãªã±ãŒã¹ããçŸåš incorrect_or_unknown_payment_details
(PERM|15) ã§è¡šãããä»ã®æ°žç¶çãªå€±æãšåºå¥ãããã泚æãå¿
èŠã§ãã
- type: 18 (
final_incorrect_cltv_expiry
) - data:
- [
u32
:cltv_expiry
]
- [
HTLC ã® CLTV æå¹æéããªããªã³å ã®å€ãããå°ããã§ãã
- type: 19 (
final_incorrect_htlc_amount
) - data:
- [
u64
:incoming_htlc_amt
]
- [
HTLC ã®éé¡ããªããªã³å ã®å€ãããå°ããã§ãã
- type: UPDATE|20 (
channel_disabled
) - data:
- [
u16
:disabled_flags
] - [
u16
:len
] - [
len*byte
:channel_update
]
- [
åŠçããŒãããã®ãã£ãã«ãç¡å¹ã«ãªã£ãŠããŸããdisabled_flags
ã®ãã©ã°ã¯çŸåšå®çŸ©ãããŠããªããããåžžã«ãŒããã€ããäºã€ã§ãã
- type: 21 (
expiry_too_far
)
HTLC ã® CLTV æå¹æéãæªæ¥ã«èšå®ãããããŠããŸãã
- type: PERM|22 (
invalid_onion_payload
) - data:
- [
bigsize
:type
] - [
u16
:offset
]
- [
埩å·ããããªããªã³ã®åããããã€ããŒããåŠçããŒãã«ãã£ãŠç解ãããªãããäžå®å
šã§ãããšã©ãŒããã€ããŒãå
ã®ç¹å®ã® tlv ã¿ã€ãã«çµã蟌ããå Žåããšã©ãŒãèµ·ãããããŒãã¯ãã® type
ãšãã€ã offset
ã埩å·ããããã€ãã¹ããªãŒã ã«å«ããããšããããŸãã
- type: 23 (
mpp_timeout
)
ãã«ãããŒãæ¯æãã®å šé¡ãåççãªæéå ã«åãåãããŸããã§ããã
- type: BADONION|PERM|24 (
invalid_onion_blinding
) - data:
- [
sha256
:sha256_of_onion
]
- [
ãã©ã€ã³ããã¹å ã§ãšã©ãŒãçºçããŸããã
ãšã©ãŒãèµ·ãããããŒãã¯ïŒ
path_key
ãåä¿¡ããupdate_add_htlc
ã«èšå®ãããŠããå ŽåïŒinvalid_onion_blinding
ãšã©ãŒãè¿ããªããã°ãªããŸããã
current_path_key
ããªããªã³ãã€ããŒãã«èšå®ãããŠããŠããããæçµããŒãã§ãªãå ŽåïŒinvalid_onion_blinding
ãšã©ãŒãè¿ããªããã°ãªããŸããã
- ãã以å€ã®å ŽåïŒ
- ãšã©ãŒã¡ãã»ãŒãžãäœæããéã«äžèšã®ãšã©ãŒã³ãŒãã®ãããããéžæããªããã°ãªããŸããã
- ãã®ç¹å®ã®ãšã©ãŒã¿ã€ãã«é©ããããŒã¿ãå«ããªããã°ãªããŸããã
- è€æ°ã®ãšã©ãŒãããå ŽåïŒ
- äžèšã®ãªã¹ãããæåã«ééãããšã©ãŒãéžæããã¹ãã§ãã
ãšã©ãŒãèµ·ãããããŒãã¯æ¬¡ã®ããšãããŠãããã§ãïŒ
- ãªããªã³å
ã®åããããã€ããŒããç¡å¹ïŒäŸïŒæå¹ãª tlv ã¹ããªãŒã ã§ãªãïŒããå¿
èŠãªæ
å ±ãæ¬ ããŠããå ŽåïŒäŸïŒéé¡ãæå®ãããŠããªãïŒïŒ
invalid_onion_payload
ãšã©ãŒãè¿ãããšãã§ããŸãã
- ããŒãå
šäœã«å¯ŸããŠãã®ä»ã®æªæå®ã®äžæçãªãšã©ãŒãçºçããå ŽåïŒ
temporary_node_failure
ãšã©ãŒãè¿ãããšãã§ããŸãã
- ããŒãå
šäœã«å¯ŸããŠãã®ä»ã®æªæå®ã®æä¹
çãªãšã©ãŒãçºçããå ŽåïŒ
permanent_node_failure
ãšã©ãŒãè¿ãããšãã§ããŸãã
- ããŒãã
node_announcement
ã®features
ã§åºåããŠããèŠä»¶ããªããªã³ã«å«ãŸããŠããªãå ŽåïŒrequired_node_feature_missing
ãšã©ãŒãè¿ãããšãã§ããŸãã
次ã®ãããªå Žåã転éããŒã ã¯å¿ é ã§ä»¥äžãè¡ããªããã°ãªããŸããïŒ
update_add_htlc
ã®åä¿¡æã«path_key
ãèšå®ãããŠããå ŽåïŒinvalid_onion_blinding
ãšã©ãŒãè¿ããŸãã
- ãªããªã³ãã€ããŒãã«
current_path_key
ãèšå®ãããŠããŠããããæçµããŒãã§ãªãå ŽåïŒinvalid_onion_blinding
ãšã©ãŒãè¿ããŸãã
- ãã以å€ã®å ŽåïŒ
- ãšã©ãŒã¡ãã»ãŒãžãäœæããéã«äžèšã®ãšã©ãŒã³ãŒãã®ãããããéžæããŸãã
転éããŒã ã¯ä»»æã§è¡ãããšãã§ããŸãããæçµããŒã ã¯è¡ã£ãŠã¯ãããŸããïŒ
- ãªããªã³ã®
version
ãã€ããäžæãªå ŽåïŒinvalid_onion_version
ãšã©ãŒãè¿ããŸãã
- ãªããªã³ HMAC ãäžæ£ãªå ŽåïŒ
invalid_onion_hmac
ãšã©ãŒãè¿ããŸãã
- ãªããªã³å
ã®äžæéµã解æäžèœãªå ŽåïŒ
invalid_onion_key
ãšã©ãŒãè¿ããŸãã
- åä¿¡ãã¢ãžã®è»¢éäžã«ãç¹å®ãããŠããªãäžæçãªãšã©ãŒãéä¿¡ãã£ãã«ã§çºçããå ŽåïŒäŸïŒãã£ãã«å®¹éã«éãããé²è¡äžã® HTLC ãå€ããããªã©ïŒïŒ
temporary_channel_failure
ãšã©ãŒãè¿ããŸãã
- åä¿¡ãã¢ãžã®è»¢éäžã«ãç¹å®ãããŠããªãæä¹
çãªãšã©ãŒãçºçããå ŽåïŒäŸïŒãã£ãã«ãæè¿éããããïŒïŒ
permanent_channel_failure
ãšã©ãŒãè¿ããŸãã
- éä¿¡ãã£ãã«ã®
channel_announcement
ã®features
ã§åºåãããŠããèŠä»¶ããªããªã³ã«å«ãŸããŠããªãå ŽåïŒrequired_channel_feature_missing
ãšã©ãŒãè¿ããŸãã
- ãªããªã³ã§æå®ãããåä¿¡ãã¢ãäžæãªå ŽåïŒ
unknown_next_peer
ãšã©ãŒãè¿ããŸãã
- HTLC ã®éé¡ãçŸåšæå®ãããŠããæå°éé¡ãäžåã£ãŠããå ŽåïŒ
- éä¿¡ HTLC ã®éé¡ãšéä¿¡ãã£ãã«ã®çŸåšã®èšå®ãå ±åããŸãã
amount_below_minimum
ãšã©ãŒãè¿ããŸãã
- HTLC ãååãªææ°æãæ¯æã£ãŠããªãå ŽåïŒ
- åä¿¡ HTLC ã®éé¡ãšéä¿¡ãã£ãã«ã®çŸåšã®èšå®ãå ±åããŸãã
fee_insufficient
ãšã©ãŒãè¿ããŸãã
- åä¿¡
cltv_expiry
ããoutgoing_cltv_value
ãåŒããå€ãéä¿¡ãã£ãã«ã®cltv_expiry_delta
ãäžåã£ãŠããå ŽåïŒ- éä¿¡ HTLC ã®
cltv_expiry
ãšéä¿¡ãã£ãã«ã®çŸåšã®èšå®ãå ±åããŸãã incorrect_cltv_expiry
ãšã©ãŒãè¿ããŸãã
- éä¿¡ HTLC ã®
cltv_expiry
ãçŸåšã«å¯ŸããŠäžåçã«è¿ãå ŽåïŒ- éä¿¡ãã£ãã«ã®çŸåšã®èšå®ãå ±åããŸãã
expiry_too_soon
ãšã©ãŒãè¿ããŸãã
cltv_expiry
ãå°æ¥ã®max_htlc_cltv
ãè¶ ããŠããå ŽåïŒexpiry_too_far
ãšã©ãŒãè¿ããŸãã
- ãã£ãã«ãç¡å¹åãããŠããå ŽåïŒ
- éä¿¡ãã£ãã«ã®çŸåšã®èšå®ãå ±åããŸãã
channel_disabled
ãšã©ãŒãè¿ããŸãã
äžéãããã¯è¡ã£ãŠã¯ãªããŸããããæçµããŒãã¯ä»¥äžãè¡ããŸãïŒ
- æ¯æãããã·ã¥ããã§ã«æ¯æãããŠããå ŽåïŒ
- æ¯æãããã·ã¥ãæªç¥ãšããŠæ±ã£ãŠãããŸããŸããã
- HTLC ã®åãå ¥ãã«æåããŠãããŸããŸããã
payment_secret
ããã®payment_hash
ã«å¯ŸããŠæåŸ ãããå€ãšäžèŽããªãå ŽåããŸãã¯payment_secret
ãå¿ èŠã§ååšããªãå ŽåïŒ- HTLC ã倱æãããªããã°ãªããŸããã
incorrect_or_unknown_payment_details
ãšã©ãŒãè¿ããªããã°ãªããŸããã
- æ¯æãããéé¡ãæåŸ
ãããéé¡ããå°ãªãå ŽåïŒ
- HTLC ã倱æãããªããã°ãªããŸããã
incorrect_or_unknown_payment_details
ãšã©ãŒãè¿ããªããã°ãªããŸããã
- æ¯æãããã·ã¥ãæªç¥ã®å ŽåïŒ
- HTLC ã倱æãããªããã°ãªããŸããã
incorrect_or_unknown_payment_details
ãšã©ãŒãè¿ããªããã°ãªããŸããã
- æ¯æãããéé¡ãæåŸ
ãããéé¡ã® 2 å以äžã®å ŽåïŒ
- HTLC ã倱æãããã¹ãã§ãã
incorrect_or_unknown_payment_details
ãšã©ãŒãè¿ãã¹ãã§ãã- 泚èšïŒããã¯ãèµ·ç¹ããŒããæ å ±æŒæŽ©ãæžããããã«éé¡ãå€æŽãã€ã€ãå¶çºçãªå€§å¹ ãªéæããé²ãããšãå¯èœã«ããŸãã
cltv_expiry
å€ãçŸåšã«å¯ŸããŠäžåçã«è¿ãå ŽåïŒ- HTLC ã倱æãããªããã°ãªããŸããã
incorrect_or_unknown_payment_details
ãšã©ãŒãè¿ããªããã°ãªããŸããã
- æçµããŒãã® HTLC ããã®
cltv_expiry
ãoutgoing_cltv_value
ããäœãå ŽåïŒfinal_incorrect_cltv_expiry
ãšã©ãŒãè¿ããªããã°ãªããŸããã
- æçµããŒãã® HTLC ããã®
amount_msat
ãamt_to_forward
ããäœãå ŽåïŒfinal_incorrect_htlc_amount
ãšã©ãŒãè¿ããªããã°ãªããŸããã
channel_update
ãè¿ãå ŽåïŒshort_channel_id
ãåä¿¡ãªããªã³ã§äœ¿çšãããshort_channel_id
ã«èšå®ããªããã°ãªããŸããã
è€æ°ã® short_channel_id ãšã€ãªã¢ã¹ãããå Žåãchannel_update
ã® short_channel_id
ã¯ãå
ã®éä¿¡è
ãæåŸ
ããŠãããã®ãæãã¹ãã§ããããã¯æ··ä¹±ãé¿ããä»ã®ãšã€ãªã¢ã¹ïŒãŸãã¯ãã£ãã« UTXO ã®å®éã®äœçœ®ïŒã«é¢ããæ
å ±æŒæŽ©ãé¿ããããã§ãã
channel_update
ãã£ãŒã«ãã¯ãfailure_code
ã« UPDATE
ãã©ã°ãå«ãŸããã¡ãã»ãŒãžã§å¿
é ã§ãããããããããŒãããªããªã³ã«å«ãŸããæŽæ°ããŽã·ããããŒã¿ã«é©çšããããšã¯å€§ããªãã£ã³ã¬ãŒããªã³ãã£ã³ã°ã®è匱æ§ã§ãããããchannel_update
ãã£ãŒã«ãã¯ãã¯ãå¿
é ã§ã¯ãªããããŒãã¯ãããå«ããªãæ¹åã«ç§»è¡ããããšãæåŸ
ãããŠããŸããchannel_update
ãæäŸããªãããŒãã¯ãchannel_update
ã® len
ãã£ãŒã«ãããŒãã«èšå®ããããšãæåŸ
ãããŠããŸãã
äžéšã®ããŒãã¯ãåãæ¯æãã®åè©Šè¡ã®ããã« channel_update
ããŸã 䜿çšãããããããŸããã
ãªãªãžã³ããŒãïŒ
failuremsg
ã®äœåãªãã€ããç¡èŠããªããã°ãªããŸããã- æçµããŒã ããšã©ãŒãè¿ããŠããå ŽåïŒ
- PERM ããããèšå®ãããŠããå ŽåïŒ
- æ¯æãã倱æãããã¹ãã§ãã
- ãã以å€ã®å ŽåïŒ
- ãšã©ãŒã³ãŒããç解ãããæå¹ã§ããå ŽåïŒ
- æ¯æããåè©Šè¡ããŠãããŸããŸãããç¹ã«ã
final_expiry_too_soon
ã¯ãéä¿¡åŸã«ãããã¯ã®é«ããå€ãã£ãå Žåã«çºçããå¯èœæ§ãããããã®å Žåtemporary_node_failure
ã¯æ°ç§ä»¥å ã«è§£æ±ºããããšããããŸãã
- æ¯æããåè©Šè¡ããŠãããŸããŸãããç¹ã«ã
- ãšã©ãŒã³ãŒããç解ãããæå¹ã§ããå ŽåïŒ
- PERM ããããèšå®ãããŠããå ŽåïŒ
- ãã以å€ã®å Žåãäžéãããããšã©ãŒãè¿ããŠããå ŽåïŒ
- NODE ããããèšå®ãããŠããå ŽåïŒ
- ãšã©ãŒãèµ·ãããããŒãã«æ¥ç¶ãããŠãããã¹ãŠã®ãã£ãã«ãèæ ®ããå€ãã¹ãã§ãã
- PERM ããããèšå®ãããŠããªãå ŽåïŒ
- ãã¢ããæ°ãã
channel_update
ãåãåããšãã£ãã«ã埩å ããã¹ãã§ãã
- ãã¢ããæ°ãã
- ãã以å€ã®å ŽåïŒ
- UPDATE ãèšå®ãããŠããã
channel_update
ãæå¹ã§ãæ¯æããéä¿¡ããããã«äœ¿çšããchannel_update
ãããæ°ããå ŽåïŒ- 倱æããæ¯æããåè©Šè¡ããããã®ã«ãŒããèšç®ããéã«
channel_update
ãèæ ®ããŠãããŸããŸããã
- 倱æããæ¯æããåè©Šè¡ããããã®ã«ãŒããèšç®ããéã«
- ä»ã®ã³ã³ããã¹ãã§ç¬¬äžè
ã«
channel_update
ãå ¬éããŠã¯ãªããŸãããããã«ã¯ãããŒã«ã«ãããã¯ãŒã¯ã°ã©ãã«channel_update
ãé©çšãããããã¢ã«ãŽã·ãããšããŠchannel_update
ãéä¿¡ãããããããšãå«ãŸããŸãã
- UPDATE ãèšå®ãããŠããã
- ãã®åŸãã«ãŒãã£ã³ã°ãšæ¯æãã®éä¿¡ãåè©Šè¡ããã¹ãã§ãã
- NODE ããããèšå®ãããŠããå ŽåïŒ
- ãããã°ç®çã§ããŸããŸãªãšã©ãŒã¿ã€ãã«æå®ãããããŒã¿ã䜿çšããŠãããŸããŸããã
ãªããªã³ã¡ãã»ãŒãžã¯ããã¢ãæ¢åã®æ¥ç¶ã䜿çšããŠè«æ±æžãåãåãããããšãå¯èœã«ããŸãïŒBOLT 12 ãåç §ïŒããŽã·ããã¡ãã»ãŒãžã®ããã«ãç¹å®ã®ããŒã«ã«ãã£ãã«ã«é¢é£ä»ããããŠããŸãããHTLC ã®ããã«ããšã³ãããŒãšã³ãã®æå·åã®ããã« ãªããªã³ã¡ãã»ãŒãž ãããã³ã«ã䜿çšããŸãã
ãªããªã³ã¡ãã»ãŒãžã¯ãHTLC onion_packet
ãšåã圢åŒã䜿çšããŸãããå°ãæè»ãªãã©ãŒãããã§ãïŒ1300 ãã€ãã®ãã€ããŒãã®ä»£ããã«ããã€ããŒãã®é·ãã¯å
šäœã®é·ãïŒããããŒãšæ«å°Ÿã®ãã€ããé€ãïŒã«ãã£ãŠæ瀺ãããŸããonionmsg_payloads
èªäœã¯ hop_payloads
ãã©ãŒããããšåãã§ããããã¬ã¬ã·ãŒãé·ãã¯ãããŸããïŒ0 ã® length
ã¯ç©ºã® onionmsg_payload
ãæå³ããŸãã
ãªããªã³ã¡ãã»ãŒãžã¯ä¿¡é Œæ§ãäœãã§ããç¹ã«ãåŠçãå®äŸ¡ã§ã転éã«ã¹ãã¬ãŒãžãå¿ èŠãšããªãããã«èšèšãããŠããŸãããã®çµæãäžéããŒããããšã©ãŒãè¿ãããããšã¯ãããŸããã
äžè²«æ§ãä¿ã€ããã«ããã¹ãŠã®ãªããªã³ã¡ãã»ãŒãžã¯ Route Blinding ã䜿çšããŸãã
-
ã¿ã€ã: 513 (
onion_message
) (option_onion_messages
) -
ããŒã¿:
- [
point
:path_key
] - [
u16
:len
] - [
len*byte
:onion_message_packet
]
- [
-
ã¿ã€ã:
onion_message_packet
-
ããŒã¿:
- [
byte
:version
] - [
point
:public_key
] - [
...*byte
:onionmsg_payloads
] - [
32*byte
:hmac
]
- [
-
ã¿ã€ã:
onionmsg_payloads
-
ããŒã¿:
- [
bigsize
:length
] - [
length*u8
:onionmsg_tlv
] - [
32*byte
:hmac
] - ...
filler
- [
onionmsg_tlv
èªäœã¯ TLV ã§ããäžéããŒã㯠encrypted_recipient_data
ãæåŸ
ããããããªããªã³ã¡ãã»ãŒãžãšå
±ã«æž¡ããã path_key
ã䜿çšã㊠encrypted_data_tlv
ã«åŸ©å·åããŸãã
ãã£ãŒã«ãçªå· 64 以äžã¯æçµãããã®ãã€ããŒãçšã«äºçŽãããŠããŸããããããã¯éæçµãããã«ãã£ãŠæ瀺çã«æåŠãããããšã¯ãããŸããïŒãã¡ãããå¶æ°ã§ãªãéãïŒã
tlv_stream
:onionmsg_tlv
- ã¿ã€ã:
- ã¿ã€ã: 2 (
reply_path
) - ããŒã¿:
- [
blinded_path
:path
]
- [
- ã¿ã€ã: 4 (
encrypted_recipient_data
) - ããŒã¿:
- [
...*byte
:encrypted_recipient_data
]
- [
- ã¿ã€ã: 64 (
invoice_request
) - ããŒã¿:
- [
tlv_invoice_request
:invreq
]
- [
- ã¿ã€ã: 66 (
invoice
) - ããŒã¿:
- [
tlv_invoice
:inv
]
- [
- ã¿ã€ã: 68 (
invoice_error
) - ããŒã¿:
- [
tlv_invoice_error
:inverr
]
- [
- ã¿ã€ã: 2 (
encrypted_recipient_data
ã®äœæè
ïŒéåžžããªããªã³ã®åä¿¡è
ïŒã¯ïŒ
- Route Blinding ã§èŠæ±ãããããã«ã
encrypted_data_tlv
ããencrypted_recipient_data
ãäœæããªããã°ãªããŸããã - ãããªã
encrypted_data_tlv
ã«ãpayment_relay
ãŸãã¯payment_constraints
ãå«ããŠã¯ãªããŸããã - åéæçµããŒãã«å¯ŸããŠã
encrypted_data_tlv
ã«next_node_id
ãŸãã¯short_channel_id
ã®ãããããå«ããªããã°ãªããŸããã - Route Blinding ã§èŠæ±ãããããã«ã
encrypted_data_tlv
ããencrypted_recipient_data
ãäœæããªããã°ãªããŸããã
å·çè ïŒ
onion_message_packet
ã®version
ã 0 ã«èšå®ããªããã°ãªããŸããã- Sphinx ã䜿çšããŠãäžèšã®è©³çŽ°ã«åŸã£ãŠ
onion_message_packet
ã®onionmsg_payloads
ãæ§ç¯ããªããã°ãªããŸããã - Sphinx ã®æ§ç¯ã«ãããŠ
associated_data
ã䜿çšããŠã¯ãªããŸããã onion_message_packet
ã®len
ã 1366 ãŸã㯠32834 ã«èšå®ããããšãæšå¥šãããŸãã- å¿çãæåŸ ããŠããããåççãªæéå ã«åãåããªãå Žåã¯ãå¥ã®çµè·¯ã§åè©Šè¡ããããšãæšå¥šãããŸãã
- éæçµããŒãã®
onionmsg_tlv
ã«ã€ããŠïŒencrypted_recipient_data
以å€ã®ãã£ãŒã«ããèšå®ããŠã¯ãªããŸããã
- æçµããŒãã®
onionmsg_tlv
ã«ã€ããŠïŒ- æçµããŒããè¿ä¿¡ãèš±å¯ãããŠããå ŽåïŒ
reply_path
ã®path_key
ãfirst_node_id
ã®åæãã¹ããŒã«èšå®ããªããã°ãªããŸãããreply_path
ã®first_node_id
ãè¿ä¿¡ãã¹ã®æåã®ããŒãã®éãã©ã€ã³ãåãããããŒã ID ã«èšå®ããªããã°ãªããŸããã- å
reply_path
ã®path
ã«ã€ããŠïŒblinded_node_id
ãããªããªã³ããããæå·åããããã®ãã©ã€ã³ãåãããããŒã ID ã«èšå®ããªããã°ãªããŸãããencrypted_recipient_data
ããåä¿¡è ã䜿çšããéã«onionmsg_tlv
ã®èŠä»¶ãæºããæå¹ãªæå·åãããencrypted_data_tlv
ã¹ããªãŒã ã«èšå®ããªããã°ãªããŸããã- ãã®
reply_path
ã®äœ¿çšãèªèã§ããããã«ãç§å¯ãå«ãããã«path_id
ã䜿çšããŠãããŸããŸããã
- ãã以å€ã®å ŽåïŒ
reply_path
ãèšå®ããŠã¯ãªããŸããã
- æçµããŒããè¿ä¿¡ãèš±å¯ãããŠããå ŽåïŒ
èªè ïŒ
- 確ç«ããããã£ãã«ããªããã¢ããã®ãªããªã³ã¡ãã»ãŒãžãåãå ¥ããããšãæšå¥šãããŸãã
- ã¡ãã»ãŒãžãããããããããšã§ã¬ãŒãå¶éãè¡ã£ãŠãããŸããŸããã
- 空ã®
associated_data
ãšpath_key
ã䜿çšããŠonion_message_packet
ã埩å·ããonionmsg_tlv
ãæœåºããªããã°ãªããŸããã詳现㯠Onion Decryption ãåç §ããŠãã ããã - 埩å·ã«å€±æããå Žåãçµæãæå¹ãª
onionmsg_tlv
ã§ãªãå ŽåããŸãã¯æªç¥ã®å¶æ°ã¿ã€ããå«ãå ŽåïŒ- ã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
encrypted_data_tlv
ãallowed_features
ãå«ãå ŽåïŒ- 以äžã®å Žåãã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããïŒ
encrypted_data_tlv.allowed_features.features
ã«æªç¥ã®æ©èœããããå«ãŸããŠããå ŽåïŒãããå¥æ°ã§ãã£ãŠãïŒã- ã¡ãã»ãŒãžã
encrypted_data_tlv.allowed_features.features
ã«å«ãŸããŠããªãæ©èœã䜿çšããŠããå Žåã
- 以äžã®å Žåãã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããïŒ
- ãªããªã³æå·åã«ãããšæçµããŒãã§ãªãå ŽåïŒ
onionmsg_tlv
ãencrypted_recipient_data
以å€ã® tlv ãã£ãŒã«ããå«ãå ŽåïŒ- ã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
encrypted_data_tlv
ãpath_id
ãå«ãå ŽåïŒ- ã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
- ãã以å€ã®å ŽåïŒ
next_node_id
ãååšããå ŽåïŒ- 次ã®ã㢠ã¯ãã®ããŒã ID ãæã€ãã¢ã§ãã
- ãã以å€ã®å Žåã
short_channel_id
ãååšããçºè¡šããã short_channel_id ãŸãã¯ãã£ãã«ã®ããŒã«ã«ãšã€ãªã¢ã¹ã«å¯Ÿå¿ããå ŽåïŒ- 次ã®ã㢠ã¯ãã®ãã£ãã«ã®å察åŽã«ãããã¢ã§ãã
- ãã以å€ã®å ŽåïŒ
- ã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
- 次ã®ã㢠ã«
onion_message
ã䜿çšããŠã¡ãã»ãŒãžã転éããããšãæšå¥šãããŸãã - ã¡ãã»ãŒãžã転éããå ŽåïŒ
- 転éããã
onion_message
ã®path_key
ã Route Blinding ã§èšç®ããã次ã®path_key
ã«èšå®ããªããã°ãªããŸããã
- 転éããã
- ãã以å€ã®å ŽåïŒæçµããŒãã§ããå ŽåïŒïŒ
path_id
ãèšå®ãããŠãããèªè ã以åã«reply_path
ã§å ¬éãããã¹ã«å¯Ÿå¿ããå ŽåïŒ- ãªããªã³ã¡ãã»ãŒãžããã®ä»¥åã®ãªããªã³ãžã®è¿ä¿¡ã§ãªãå ŽåïŒ
- ãªããªã³ã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
- ãªããªã³ã¡ãã»ãŒãžããã®ä»¥åã®ãªããªã³ãžã®è¿ä¿¡ã§ãªãå ŽåïŒ
- ãã以å€ã®å ŽåïŒæªç¥ãŸãã¯æªèšå®ã®
path_id
ïŒïŒ- ãªããªã³ã¡ãã»ãŒãžã
path_id
ãå«ããªããªã³ã¡ãã»ãŒãžãžã®è¿ä¿¡ã§ããå ŽåïŒ- åæã®ãªããªã³ã¡ãã»ãŒãžãéä¿¡ããªãã£ããã®ããã«æ£ç¢ºã«å¿çïŒãŸãã¯å¿çããªãïŒããªããã°ãªããŸããã
- ãªããªã³ã¡ãã»ãŒãžã
onionmsg_tlv
ãè€æ°ã®ãã€ããŒããã£ãŒã«ããå«ãå ŽåïŒ- ã¡ãã»ãŒãžãç¡èŠããªããã°ãªããŸããã
- è¿ä¿¡ãéãããå ŽåïŒ
reply_path
ã䜿çšããŠãªããªã³ã¡ãã»ãŒãžãäœæããªããã°ãªããŸãããfirst_node_id
ã«ãã£ãŠç€ºãããããŒãã«onion_message
ãä»ããŠè¿ä¿¡ãéä¿¡ããªããã°ãªããŸãããreply_path
ã®path_key
ã䜿çšããŠreply_path
ã®path
ã«æ²¿ã£ãŠéä¿¡ããŸãã
è¿ä¿¡ã¯ãæå®ãããæ£ç¢ºãª reply_path ã䜿çšããŠã®ã¿åãå ¥ããããã«æ³šæãå¿ èŠã§ããããããªããšããããŒãã³ã°ãå¯èœã«ãªããŸããããã¯äž¡æ¹åã§ç¢ºèªããããšãæå³ããŸããéè¿ä¿¡ã¯ reply_path ã䜿çšãããè¿ä¿¡ã¯åžžã« reply_path ã䜿çšããŸãã
onionmsg_tlv
ãã£ãŒã«ããå«ãã¡ãã»ãŒãžãå³å¯ã«å¿
èŠãšããªãå Žåã«ç Žæ£ããèŠä»¶ã¯ãçŸåšããã³å°æ¥ã®å®è£
éã®äžè²«æ§ãä¿èšŒããŸããå¥æ°ãã£ãŒã«ãã§ãã£ãŠãåé¡ã«ãªãå¯èœæ§ããããŸãããªããªããããããç解ããããŒãã«ãã£ãŠè§£æããïŒãããã£ãŠæåŠãããå¯èœæ§ããããŸãïŒãç解ããªãããŒãã«ãã£ãŠç¡èŠãããããã§ãã
ãã¹ãŠã®ãªããªã³ã¡ãã»ãŒãžã¯ãã©ã€ã³ãåãããŠããŸããããã®ãªãŒããŒãããã¯åžžã«å¿ èŠãšããããã§ã¯ãããŸããïŒããã§ã¯ 33 ãã€ãããªããªã³å ã®å encrypted_data_tlv ã«å¯Ÿãã 16 ãã€ãã® MACïŒããã®ãã©ã€ã³ãåã«ãããããŒãã¯ãã®å 容ãç¥ããã«ä»è ã«ãã£ãŠæäŸããããã¹ã䜿çšã§ããŸãããããæ®éçã«äœ¿çšããããšã§ãå®è£ ãå°ãç°¡çŽ åããããªããªã³ã¡ãã»ãŒãžãåºå¥ããããšãé£ãããªããŸãã
len
ã«ãããHTLC ãªããªã³ã«èš±å¯ãããæšæºã® 1300 ãã€ãããã倧ããªã¡ãã»ãŒãžãéä¿¡ã§ããŸãããå¿åæ§ã»ãããæžå°ããããããããã¯æ§ããã«äœ¿çšããã¹ãã§ãããããã£ãŠãHTLC ãªããªã³ã®ããã«èŠãããããã倧ããå Žåã¯åºå®ãµã€ãºã§ããããšãæšå¥šãããŸãã
ãªããªã³ã¡ãã»ãŒãžã¯æ瀺çã«ãã£ãã«ãå¿ èŠãšããŸããããã¹ãã åæžã®ããã«ããŒãã¯ãã®ãããªãã¢ãã¬ãŒãå¶éããããšãéžæãããããããŸãããç¹ã«è»¢éãäŸé Œãããã¡ãã»ãŒãžã«ã€ããŠã¯ã
ãã® max_htlc_cltv
å€ã¯ãLightning å®è£
ã«ãã£ãŠå±éãããæŽå²çãªå€ã«åºã¥ã㊠2016 ãããã¯ãšããŠå®çŸ©ãããŠããŸãã
ãã¹ããã¯ã¿ãŒã¯æ¬¡ã®ãã©ã¡ãŒã¿ã䜿çšããŸãïŒ
pubkey[0] = 0x02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619
pubkey[1] = 0x0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c
pubkey[2] = 0x027f31ebc5462c1fdce1b737ecff52d37d75dea43ce11c74d25aa297165faa2007
pubkey[3] = 0x032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991
pubkey[4] = 0x02edabbd16b41c8371b92ef2f04c1185b4f03b6dcd52ba9b78d9d7c89c8f221145
nhops = 5
sessionkey = 0x4141414141414141414141414141414141414141414141414141414141414141
ç³ãèš³ãããŸããããæäŸãããå 容ã¯éåžžã«é·ãã翻蚳ããã«ã¯å¶éãè¶ ããŠããŸããç¹å®ã®éšåãéžãã§å床éä¿¡ããŠããã ããã°ããã®éšåã翻蚳ããããŸãã
[ FIXME: ]
ãã®äœå㯠Creative Commons Attribution 4.0 International License ã®äžã§ã©ã€ã»ã³ã¹ãããŠããŸãã