<oembed><type>rich</type><version>1.0</version><author_name>npub17fjkngg0s0mfx4uhhz6n4puhflwvrhn2h5c78vdr5xda4mvqx89swntr0s</author_name><author_url>https://nostr.ae/npub17fjkngg0s0mfx4uhhz6n4puhflwvrhn2h5c78vdr5xda4mvqx89swntr0s</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-02-04&#xA;📝 Original message:&#xA;I&#39;m a bit confused, I don&#39;t know if the implementation work you&#39;re&#xA;mentioning refers to my proposal&#xA;or yours :).&#xA;&#xA;When you say `temporary id`, could you clarify whether you mean a temporary&#xA;`node_id` or `scid`?&#xA;&#xA;Firstly, need to brute-force the onion against your N keys.&#xA;&#xA;&#xA;This is probably the part that confuses me. Are you talking about Bob or&#xA;Alice there?&#xA;Alice can easily have her `decoy_node_id` be derived from her real&#xA;`node_id`&#39;s privacy key and the&#xA;`payment_hash` or `payment_preimage`. When she receives a payment, she&#xA;knows which `decoy_node_id`&#xA;should have been used so she doesn&#39;t need to brute-force.&#xA;&#xA;That means Alice doesn&#39;t even have to change how she stores invoices. When&#xA;Alice retrieves the&#xA;invoice from her DB, if it has the `decoy_node_id` feature bit set, she&#xA;knows she needs to derive&#xA;the correct `node_id`. If it doesn&#39;t have that feature bit set, it&#39;s a&#xA;&#34;legacy&#34; invoice and she has&#xA;to use her real `node_id`.&#xA;&#xA;Now Mallory uses Bob-&gt;C2 to pay to N1 for Inv1. If it works, he knows it&#39;s&#xA;&gt; the same node issuing both invoices.&#xA;&#xA;&#xA;Same, that wouldn&#39;t work because Alice can easily detect the mismatch and&#xA;pretend she can&#39;t decrypt&#xA;the onion (the code doesn&#39;t even have to pretend: it will use the expected&#xA;`node_id` and use the&#xA;existing error paths).&#xA;&#xA;Actually, that was too hasty.&#xA;&#xA;&#xA;Ok I think your second email came to the same conclusions and clarifies it&#xA;a bit :).&#xA;&#xA;It&#39;s true that this is code where the developer may easily get confused&#xA;between keys (but it&#39;s a&#xA;lot simpler than the Sphinx or Noise implementation).&#xA;&#xA;However in my opinion it&#39;s still simpler than the `scid` state management&#xA;that needs to happen at&#xA;Alice and Bob in https://github.com/lightningnetwork/lightning-rfc/pull/681&#xA;(but I would need to&#xA;implement both E2E to be able to fairly judge that).&#xA;&#xA;Thanks for the feedback, I&#39;ll keep working on improving the proposal.&#xA;Bastien&#xA;&#xA;Le mar. 4 févr. 2020 à 05:29, Rusty Russell &lt;rusty at rustcorp.com.au&gt; a écrit&#xA;:&#xA;&gt;&#xA;&gt; Rusty Russell &lt;rusty at rustcorp.com.au&gt; writes:&#xA;&gt; &gt; Bastien TEINTURIER &lt;bastien at acinq.fr&gt; writes:&#xA;&gt; &gt;&gt; That&#39;s of course a solution as well. Even with that though, if Alice&#xA;opens&#xA;&gt; &gt;&gt; multiple channels to each of her Bobs,&#xA;&gt; &gt;&gt; she should use Tor and a different node_id each time for better&#xA;privacy.&#xA;&gt; &gt;&#xA;&gt; &gt; There are two uses for this feature (both of which I started&#xA;implementing):&#xA;&gt; &gt;&#xA;&gt; &gt; 1. Simply always use a temporary id when you have a private channel, to&#xA;&gt; &gt;    obscure your onchain footprint.  This is a nobrainer.&#xA;&gt; &gt;&#xA;&gt; &gt; 2. For an extra layer of transience, apply a new temporary id and new&#xA;&gt; &gt;    nodeid on every invoice *which applies only for that invoice*.&#xA;&gt; &gt;&#xA;&gt; &gt; But implementing the latter securely is fraught!&#xA;&gt; &gt;&#xA;&gt; &gt; Firstly, need to brute-force the onion against your N keys.  Secondly,&#xA;&gt; &gt; if you use a temporary key, then you *don&#39;t* end up using the HTLC to&#xA;&gt; &gt; pay an invoice matching that key, you *MUST* pretend you couldn&#39;t&#xA;&gt; &gt; decrypt the onion!  This applies to all code paths between the two,&#xA;&gt; &gt; including parsing the TLV, etc: they must ALL return&#xA;&gt; &gt; WIRE_INVALID_ONION_HMAC.&#xA;&gt; &gt;&#xA;&gt; &gt; Otherwise, Mallory can get an invoice, then send malformed payments to&#xA;&gt; &gt; Alice using the transient key in the invoice and see if she decrypts it.&#xA;&gt;&#xA;&gt; Actually, that was too hasty.  You can use the payment_hash as a&#xA;&gt; fastpath:&#xA;&gt;&#xA;&gt; 1. Look up invoice using payment_hash.&#xA;&gt;&#xA;&gt; 2. If there is an invoice, and it has a temporary id associated with it,&#xA;&gt;    try using that to decrypt the onion.  If that works, and the onion is&#xA;&gt;    on the final hop, and the TLV decodes, and the payment_secret is&#xA;&gt;    correct, you can go back and use this temporary key to decrypt the&#xA;onion.&#xA;&gt;    Otherwise, go back and use the normal node key.&#xA;&gt;&#xA;&gt; That&#39;s still quite a bit of tricky code though...&#xA;&gt;&#xA;&gt; Cheers,&#xA;&gt; Rusty.&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200204/f31934c0/attachment.html&gt;</html></oembed>