<oembed><type>rich</type><version>1.0</version><author_name>npub19helcfnqgk2jrwzjex2aflq6jwfc8zd9uzzkwlgwhve7lykv23mq5zkvn4</author_name><author_url>https://nostr.ae/npub19helcfnqgk2jrwzjex2aflq6jwfc8zd9uzzkwlgwhve7lykv23mq5zkvn4</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2019-02-07&#xA;📝 Original message:&#xA;Hi y&#39;all,&#xA;&#xA;Recently we&#39;ve started to do more design work related to the Sphinx packet&#xA;(EOB format, rendezvous protocol). This prompted me to re-visit the original&#xA;Sphinx paper to refresh my memory w.r.t some of the finer details of the&#xA;protocol.  While I was re-reading the paper, I realized that we may be able&#xA;to use use SURBs (single-use-reply-blocks) to implement a &#34;payment ACK&#34; for&#xA;each sent HTLC.&#xA;&#xA;(it&#39;s worth mentioning that switching to HORNET down the line would solve&#xA;this problem as well since the receiver already gets a multi-use backwards&#xA;route that they can use to send information back to the receiver)&#xA;&#xA;Right now HTLC routing is mainly a game of &#34;send and hope it arrives&#34;, as&#xA;you have no clear indication of the _arrival_ of an HTLC at the destination.&#xA;Instead, you only receive a protocol level message if the HTLC failed for&#xA;w/e reason, or if it was successfully redeemed.  As part of BOLT 1.1, it was&#xA;agreed upon that we should implement some sort of &#34;payment ACK&#34; feature. A&#xA;payment ACK scheme is strongly desired as it:&#xA;&#xA;  * Allows the sender to actually know when a payment has reached the&#xA;    receiver which is useful for many higher level protocols. Atm, the&#xA;    sender is unable to distinguish an HTLC being &#34;black holed&#34; from one&#xA;    that&#39;s actually reached the sender, and they&#39;re just holding on to it.&#xA;  * AMP implementations would be aided by being able to receive feedback on&#xA;    successfully routed splits. If we&#39;re able to have the receiver ACK each&#xA;    partial payment, then implementations can more aggressively split&#xA;    payments as they&#39;re able to gain assurance that the first 2 BTC of 5&#xA;    total have actually reached the sender, and weren&#39;t black holed.&#xA;  * Enforcing and relying on ACKs may also thwart silly games receivers&#xA;    might play, claiming that the HTLC &#34;didn&#39;t actually arrive&#34;.&#xA;&#xA;Some also call this feature a &#34;soft error&#34; as a possible implementation&#xA;might to re-use the existing onion error protocol we&#39;ve deployed today.  For&#xA;reference, in order to send back errors back long the route in a way that&#xA;doesn&#39;t reveal the sender of the HTLC to the receiver (or any of the&#xA;intermediate nodes) we re-use the shared secret each hop has derived, and&#xA;onion wrap a MAC&#39;d error to the sender. Each hop can&#39;t actually check that&#xA;they&#39;ve received a well formed error, but the sender is able to attribute an&#xA;error to a node in the route based on which shared secret they&#39;re able to&#xA;check the MAC with.&#xA;&#xA;The original Sphinx packet format has a way for the receiver to send a&#xA;message back to the sender. This was originally envisioned to allow the&#xA;receiver to send a replay email/message back to the sender without knowing&#xA;who they were, and also in a manner that was bit-wise indistinguishable from&#xA;a regular forwarded packet. This is called a SURB or &#34;single use reply&#xA;block&#34;. A SURB is composed of: a pre-crafted sphinx packet for the&#xA;&#34;backwards route&#34; (which can be distinct from the forwards route), the first&#xA;hop of the backwards route, and finally a symmetric key to use when&#xA;encrypting the reply.&#xA;&#xA;When we more or less settled on using Sphinx, we started to remove things&#xA;that we didn&#39;t have a clear use for at the time. Two things that were&#xA;removed were the original end-to-end payload, and also the SURB. Removing&#xA;the payload made the packet size smaller, and it didn&#39;t seem realistic to&#xA;give _each_ hop a SURB to send reply back.&#xA;&#xA;In order to implement payment ACKs, we can have the sender craft a SURB (for&#xA;the ACK), and mark the receipt of the SURB as the payment ACK itself.&#xA;Creating and processing a SURB is identical to the regular HTLC packets we&#xA;use today. As a result, the code impact to the code sphinx packet logic is&#xA;minimal. We&#39;d then also re-introduce the e2e payload so we can carry the&#xA;SURB in the forward direction (HLTC add). The backwards packet would also&#xA;have a payload of random bytes with the same size as a regular packet to&#xA;make them look identical on the wire.&#xA;&#xA;This payload can further be put to use in order to implement streaming or&#xA;subscription payments in a way. Since we must add a payload for in order to&#xA;send/reply look the same, we can also piggy back some useful additional&#xA;data. Each time a payment is sent, the receiver can use the extra payload to&#xA;stack on details such as:&#xA;  * A new invoice to pay for the metered service being paid for.&#xA;  * An invoice along with a deadline for when this must be paid, lest the&#xA;    subscription service expire.&#xA;  * Details of lightning-native API&#xA;  * etc, etc&#xA;&#xA;IMO, this approach is better than a potential client-server payment&#xA;negotiation protocol as it doesn&#39;t require any additional servers along side&#xA;the node, also maintains sender anonymity, and doesn&#39;t rely on any sort of&#xA;PKI.&#xA;&#xA;&gt;From the prospective of packet-analysis, errors today are identifiable due&#xA;to the packet size (though we do pad them out to avoid being able to&#xA;distinguish some errors from others on the wide). SURBs on the other hand,&#xA;have the same profile as regular HTLC adds since they use the same Sphinx&#xA;packet format.  Unlike the wrapped onion errors, intermediate nodes are also&#xA;able to validate the integrity of the payment ACK as they&#39;ll check the&#xA;per-hop&#xA;MAC as normal. Additionally, the replies naturally create cover traffic as&#xA;they look like regular payments.&#xA;&#xA;One down side is that this would essentially double the size of HTLC&#xA;messages on the network today, as they need to also carry SURB.  Most&#xA;candidates for possible rendezvous schemes to deploy would also increase the&#xA;packet size if up to 20 hops it be allowed in both directions.  We also&#xA;(from my PoV), don&#39;t really have a feel on how much of an issue the 1.2KB&#xA;HTLC packet size is today in the network.&#xA;&#xA;By re-introducing SURBs, we have an opportunity to cleanly solve the payment&#xA;ACK issue, re-use a component of our favorite thing in Lightning, enable&#xA;protocol-level streaming/subscription payments and also make replies&#xA;indistinguishable-ish from regular payments.&#xA;&#xA;Thoughts?&#xA;&#xA;-- Laolu&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20190207/77cde3d7/attachment.html&gt;</html></oembed>