<oembed><type>rich</type><version>1.0</version><author_name>npub1wtx5qvewc7pd6znlvwktq03mdld05mv3h5dkzfwd3dc30gdmsptsugtuyn</author_name><author_url>https://nostr.ae/npub1wtx5qvewc7pd6znlvwktq03mdld05mv3h5dkzfwd3dc30gdmsptsugtuyn</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-02-24&#xA;📝 Original message:&#xA;Hi Bastien,&#xA;&#xA;seems you were a bit quicker than I was with my writeup of my&#xA;proposal. I came up with a scheme that allows us to drop a large part of&#xA;the partial onion, so that it can indeed fit into an outer onion, and&#xA;the rendez-vous node RV can re-construct the original packet from the&#xA;included data [1].&#xA;&#xA;The construction comes down to initializing the part of the routing info&#xA;string that is not going to be used, in such a way that the incremental&#xA;unwrappings at the nodes in the partial onion cancels out. Like you&#xA;mentioned in your mail it comes down extending the filler generation to&#xA;also cover the unused part and then applying all the encryption streams&#xA;xored to the unused space. By doing this we get the middle part of the&#xA;onion consisting of only 0x00 bytes.&#xA;&#xA;I then decided to apply an additional ChaCha20 stream to this prefill,&#xA;such that the onion will not consist of mostly 0x00 bytes which would be&#xA;a dead giveaway to `RV+1` that `RV` was a rendez-vous node.&#xA;&#xA;The process for the partial onion creator boils down to:&#xA;&#xA; - Compute a path from `RV` of its choice to recipient `R`.&#xA; - Compute a shared secret using a random ephemeral private key and&#xA;  `RV`s public key, and then generate a prefill-key&#xA; - Compute the prefill by combining the correct substrings of the&#xA;   encryption streams for the nodes along the path, then add the&#xA;   ChaCha20 stream keyed with the prefill-key.&#xA; - Wrap the onion, including payloads for each of the nodes along path&#xA;   `RV` to `R`&#xA; - Trim out the unused space, which now will match the obfuscation&#xA;   stream generated with the prefill-key&#xA;&#xA;As an example such an onion, with 5 legacy hops (65 byte each) results&#xA;in a 325 + 66 bytes onion, and we save 975 bytes. See [2] for an example&#xA;of how this looks like.&#xA;&#xA;The sender `S` then just does the following:&#xA;&#xA; - Compute a route from `S` to `RV`&#xA; - Build an onion with the route, specifying the trimmed partial onion&#xA;   as payload, along with the usual parameters, for `RV`&#xA; - Initiate payment with the constructed onion&#xA;&#xA;Upon receiving an incoming HTLC with a partial onion the rendez-vous&#xA;node `RV` then just does the following:&#xA;&#xA; - Verify all parameters as usual&#xA; - Extract the partial onion&#xA; - Use the ephemeral key from the partial onion to generate the shared&#xA;   secret and the prefill key&#xA; - Generate the prefill stream and insert it in the correct place,&#xA;   before the HMAC. This reconstitutes the original routing packet&#xA; - Swap out the original onion with the reconstituted onion and forward.&#xA;&#xA;My writeup [1] is an early draft, but I wanted to get it out early to&#xA;give the discussion a basis to work off. I&#39;ll revisit it a couple of&#xA;times before opening a PR, but feel free to shout at me if I have&#xA;forgotten to consider something :-)&#xA;&#xA;Cheers,&#xA;Christian&#xA;&#xA;[1] https://github.com/lightningnetwork/lightning-rfc/blob/rendez-vous/proposals/0001-rendez-vous.md&#xA;[2] https://gist.github.com/cdecker/ec06452bc470749d9f6d2de73651c5fd&#xA;&#xA;Bastien TEINTURIER via Lightning-dev&#xA;&lt;lightning-dev at lists.linuxfoundation.org&gt; writes:&#xA;&gt; Good morning list,&#xA;&gt;&#xA;&gt; After exploring decoys [1], which is a cheap way of doing route blinding,&#xA;&gt; I&#39;m turning back to exploring rendezvous.&#xA;&gt; The previous mails on the mailing list mentioned that there was a&#xA;&gt; technicality&#xA;&gt; to make the HMACs check out, but didn&#39;t provide a lot of details.&#xA;&gt; The issue is that the filler generation needs to take into account some hops&#xA;&gt; that will be added *later*, by the payer.&#xA;&gt;&#xA;&gt; However it is quite easy to work-around, with a few space trade-offs.&#xA;&gt; Let&#39;s consider a typical rendezvous setup, where Alice wants to be paid via&#xA;&gt; rendezvous Bob, and Carol wants to pay that invoice:&#xA;&gt;&#xA;&gt; Carol -&gt; ... -&gt; Bob -&gt; ... -&gt; Alice&#xA;&gt;&#xA;&gt; If Alice knows how many bytes Carol is going to use for her part of the&#xA;&gt; onion&#xA;&gt; payloads, Alice can easily take them into account when generating her&#xA;&gt; filler by&#xA;&gt; pre-pending the same amount of `0` bytes. It seems reasonable to impose a&#xA;&gt; fixed&#xA;&gt; number of onion bytes for each side of the rendezvous (650 each?) so Alice&#xA;&gt; would&#xA;&gt; know that amount.&#xA;&gt;&#xA;&gt; When Carol completes the onion with her part of the route, she simply needs&#xA;&gt; to&#xA;&gt; generate filler data for her part of the route following the normal Sphinx&#xA;&gt; protocol&#xA;&gt; and apply it to the onion she found in the invoice.&#xA;&gt;&#xA;&gt; But the tricky part is that she needs to give Bob a way of generating the&#xA;&gt; same&#xA;&gt; filler data to unapply it. Then all HMACs correctly check out.&#xA;&gt;&#xA;&gt; I see two ways of doing that:&#xA;&gt;&#xA;&gt; * Carol simply sends that filler (650 bytes), probably via a TLV in&#xA;&gt; `update_add_htlc`.&#xA;&gt; This means every intermediate hop needs to forward that, which is painful&#xA;&gt; and&#xA;&gt; potentially leaking too much data.&#xA;&gt; * Carol provides Bob with the rho keys used to generate her filler, and the&#xA;&gt; length&#xA;&gt; used by each hop. This leaks to Bob an upper bound on the number of hops&#xA;&gt; and the&#xA;&gt; number of bytes sent to each hop.&#xA;&gt;&#xA;&gt; Since shift-and-xor kind of crypto is hard to read as equations, but very&#xA;&gt; easy to&#xA;&gt; read as diagrams, I spent a bit of time doing beautiful ASCII art [2].&#xA;&gt; Don&#39;t hesitate&#xA;&gt; to have a look at it to find more details about how that works. You can&#xA;&gt; also print&#xA;&gt; that on t-shirts to look fancy at conferences. I also have some sample code&#xA;&gt; working&#xA;&gt; in eclair [3] for those who can read Scala without getting headaches.&#xA;&gt;&#xA;&gt; Are there other tricks we can use to reconcile both sides of the onion at&#xA;&gt; Bob&#39;s?&#xA;&gt; Maybe cdecker (or someone else) has an ace up his sleeve for me there? :)&#xA;&gt;&#xA;&gt; One important thing to note is that rendezvous on normal onions will be&#xA;&gt; costly to&#xA;&gt; integrate into invoices: it takes 1366 bytes to include one onion, and if&#xA;&gt; we want&#xA;&gt; to handle route failures or let the sender use multi-part, we will need to&#xA;&gt; have a&#xA;&gt; handful of pre-encrypted onions in the invoice (hence a few kB, which may&#xA;&gt; not be&#xA;&gt; practical for QR codes).&#xA;&gt;&#xA;&gt; But I did mention before that doing rendezvous on the trampoline onion&#xA;&gt; could have&#xA;&gt; better properties [4]. When doing that, having Carol transmit her filler&#xA;&gt; data only&#xA;&gt; to Bob, via the outer onion payload becomes practical and doesn&#39;t leak&#xA;&gt; information.&#xA;&gt; Multi-part would work with a single trampoline onion in the invoice (~500&#xA;&gt; bytes),&#xA;&gt; because nodes can do MPP between trampoline nodes thanks to the&#xA;&gt; onion-in-onion&#xA;&gt; construction. We simply need to decide the size of the trampoline onion to&#xA;&gt; allow&#xA;&gt; each side of the rendezvous to be able to insert a number of hops we&#39;re&#xA;&gt; comfortable&#xA;&gt; with. You can find more details in the &#34;Rendezvous on a trampoline&#34; section&#xA;&gt; of [2].&#xA;&gt;&#xA;&gt; I&#39;m really interested in other approaches to making rendezvous work with&#xA;&gt; the HMACs&#xA;&gt; correctly checking out. If people on this list have drafts, intuitions or&#xA;&gt; random&#xA;&gt; thoughts about possible constructions, please share them, I&#39;d be happy to&#xA;&gt; dive into&#xA;&gt; them to explore alternatives to the one I found, hoping we can make this&#xA;&gt; work and&#xA;&gt; provide this feature to our users in the near future.&#xA;&gt;&#xA;&gt; A small side-note on Hornet. Hornet does offer many features that I believe&#xA;&gt; we will&#xA;&gt; want in Lightning in the future. It may seem that doing a custom rendezvous&#xA;&gt; scheme&#xA;&gt; is a waste of time since we&#39;ll ditch it once/if we implement Hornet. While&#xA;&gt; that is&#xA;&gt; true in the long run, I believe that if we&#39;re able to find a rendezvous&#xA;&gt; scheme that&#xA;&gt; isn&#39;t too much work to implement, it makes sense to have something&#xA;&gt; available soon-ish.&#xA;&gt; Hornet will likely be a longer-term effort that we won&#39;t get as soon as&#xA;&gt; we&#39;d like&#xA;&gt; (especially since it will probably require a network-wide update). But who&#xA;&gt; knows, maybe&#xA;&gt; we may see that we are trying to create many features that are already&#xA;&gt; built into Hornet&#xA;&gt; (rendezvous, directed message support, etc) and will decide to implement&#xA;&gt; Hornet sooner&#xA;&gt; than expected?&#xA;&gt;&#xA;&gt; Cheers,&#xA;&gt; Bastien&#xA;&gt;&#xA;&gt; [1]&#xA;&gt; https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-January/002435.html&#xA;&gt; [2] https://gist.github.com/t-bast/ab42a7f52eb2e73105557957c8359601&#xA;&gt; [3] https://github.com/ACINQ/eclair/tree/sphinx-rendezvous&#xA;&gt; [4]&#xA;&gt; https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-October/002237.html&#xA;&gt; _______________________________________________&#xA;&gt; Lightning-dev mailing list&#xA;&gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev</html></oembed>