<oembed><type>rich</type><version>1.0</version><title>Rusty Russell [ARCHIVE] wrote</title><author_name>Rusty Russell [ARCHIVE] (npub1zw…hkhpx)</author_name><author_url>https://yabu.me/npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2019-11-07&#xA;📝 Original message:&#xA;Anthony Towns &lt;aj at erisian.com.au&gt; writes:&#xA;&gt; On Wed, Nov 06, 2019 at 10:43:23AM +1030, Rusty Russell wrote:&#xA;&gt;&gt; &gt;&gt; Rusty prepares a nonce, AAAAA and hashes it 25 times = ZZZZZ.&#xA;&gt;&gt; &gt;&gt; ZmnSCPxj prepares the onion, but adds extra fields (see below).  &#xA;&gt;&gt; &gt; It would have made more sense to me for Alice (Zmn) to generate&#xA;&gt;&gt; &gt; the nonce, hash it, and prepare the onion, so that the nonce is&#xA;&gt;&gt; &gt; revealed to Dave (Rusty) if/when the message ever actually reaches its&#xA;&gt;&gt; &gt; destination. Otherwise Rusty has to send AAAAA to Zmn already so that&#xA;&gt;&gt; &gt; Zmn can prepare the onion?&#xA;&gt;&gt; The entire point is to pay *up-front*, though, to prevent spam.&#xA;&gt;&#xA;&gt; Hmm, I&#39;m not sure I see the point of paying upfront but not&#xA;&gt; unconditionally -- you already commit the funds as part of the HTLC,&#xA;&gt; and if you&#39;re refunding some of them, you kind-of have to keep them&#xA;&gt; reserved or you risk finalising the HTLC causing a failure because you&#xA;&gt; don&#39;t have enough msats spare to do the refund?&#xA;&#xA;?  These are upfront an unconditional.  I&#39;m confused.  You pay per&#xA;HTLC added (or, in future, to send a message).&#xA;&#xA;What part was unclear here?&#xA;&#xA;Alice pays X to Bob.  Bob gives X-&lt;num-preimages&gt; back to Alice.  Bob&#xA;gets preimages from the onion, and from Carol etc.&#xA;&#xA;This happens independent of HTLC success or failure.&#xA;&#xA;&gt;&gt; Bob/ZmnSCPxj doesn&#39;t prepare anything in the onion.  They get handed the&#xA;&gt;&gt; last hash directly: Alice is saying &#34;I&#39;ll pay you 50msat for each&#xA;&gt;&gt; preimage you can give me leading to this hash&#34;.&#xA;&gt;&#xA;&gt; So my example was Alice paying Dave via Bob and Carol (so Alice/Bob,&#xA;&gt; Bob/Carol, Carol/Dave being the individual channels).&#xA;&gt;&#xA;&gt; What you wrote to Zmn says &#34;Rusty decrypts the onion, reads the prepay&#xA;&gt; field: it says 14, LLLL.&#34; but Alice doesn&#39;t know anything other than&#xA;&gt; ZZZZ so can&#39;t put LLLL in the onion?&#xA;&#xA;Alice created the onion.  Alice knows all the preimages, since she&#xA;created the chain AAAAA....ZZZZZ.&#xA;&#xA;&gt;&gt; &gt; I&#39;m not sure why lucky hashing should result in a discount?&#xA;&gt;&gt; Because the PoW adds noise to the amounts, otherwise the path length is&#xA;&gt;&gt; trivially exposed, esp in the failure case.  It&#39;s weak protection&#xA;&gt;&gt; though.&#xA;&gt;&#xA;&gt; With a linear/exponential relationship you just get &#34;half the time it&#39;s&#xA;&gt; 1 unit, 25% of the time it&#39;s 2 units, 12% of the time it&#39;s 3 units&#34;, so&#xA;&gt; I don&#39;t think that&#39;s adding much noise?&#xA;&#xA;It depends how much people are prepared to grind, doesn&#39;t it?&#xA;&#xA;&gt;&gt; &gt; You&#39;ve only got two nonce choices -- the initial AAAA and the depth&#xA;&gt;&gt; &gt; that you tell Bob and Carol to hash to as steps in the route;&#xA;&gt;&gt; No, the sphinx construction allows for grinding, that was my intent&#xA;&gt;&gt; here.  The prepay hashes are independent.&#xA;&gt;&#xA;&gt; Oh, because you&#39;re also xoring with the onion packet, right, I see.&#xA;&gt;&#xA;&gt;&gt; &gt; I think you could just make the scheme be:&#xA;&gt;&gt; &gt;   Alice sends HTLC(k,v) + 1250 msat to Bob&#xA;&gt;&gt; &gt;   Bob unwraps the onion and forwards HTLC(k,v) + 500 msat to Carol&#xA;&gt;&gt; &gt;   Carol unwraps the onion and forwards HTLC(k,v) + 250 msat to Dave&#xA;&gt;&gt; &gt;   Dave redeems the HTLC, claims an extra 300 msat and refunds 200 msat to Carol&#xA;&gt;&#xA;&gt; The math here doesn&#39;t add up. Let&#39;s assume I meant:&#xA;&gt;&#xA;&gt;   Bob keeps 500 sat, forwards 750 sat&#xA;&gt;   Carol keeps 250 sat, forwards 500 sat&#xA;&gt;   Dave keeps 300 sat, refunds 200 sat&#xA;&gt;&#xA;&gt;&gt; &gt;   Carol redeems the HTLC and refunds 200 msat to Bob&#xA;&gt;&gt; &gt;   Bob redeems the HTLC and refunds 200 msat to Alice&#xA;&gt;&gt; &gt;&#xA;&gt;&gt; &gt; If there&#39;s a failure, Alice loses the 1250 msat, and someone in the&#xA;&gt;&gt; &gt; path steals the funds.&#xA;&gt;&gt; This example confuses me.&#xA;&gt;&#xA;&gt; Well, that makes us even at least? :)&#xA;&gt;&#xA;&gt;&gt; So, you&#39;re charging 250msat per hop?  Why is Bob taking 750?  Does Carol&#xA;&gt;&gt; now know Dave is the last hop?&#xA;&gt;&#xA;&gt; No, Alice is choosing to pay 500, 250 and 300 msat to Bob, Carol and&#xA;&gt; Dave respectively, as part of setting up the onion, and picks those&#xA;&gt; numbers via some magic algo trading off privacy and cost.&#xA;&#xA;OK.&#xA;&#xA;&gt;&gt; Does Alice lose everything on any routing failure?&#xA;&gt;&#xA;&gt; That was my thought yeah; it seems weird to pay upfront but expect a&#xA;&gt; refund on failure -- the HTLC funds are already committed upfront and&#xA;&gt; refunded on failure.&#xA;&#xA;AFAICT you have to overpay, since anything else is very revealing of&#xA;path length.  Which kind of implies a refund, I think.&#xA;&#xA;&gt;&gt; If so, that is strong incentive for Alice to reduce path-length privacy&#xA;&gt;&gt; by keeping payments minimal, which I was really trying to avoid.&#xA;&gt;&#xA;&gt; Assuming v is much larger than 1250msat, and 1250 msat is much lower than&#xA;&gt; the cost to Bob of losing the channel with Alice, I don&#39;t think that&#39;s&#xA;&gt; a problem. 1250msat pays for 125kB of bandwdith under your assumptions&#xA;&gt; I think?&#xA;&#xA;That&#39;s irrelevant?  Since retries are common, it&#39;s natural for Alice to&#xA;want to minimize losses.  If she&#39;s going to lose everything on any&#xA;failure, she&#39;ll pay the minimum amount, which exposes her path length&#xA;trivially.&#xA;&#xA;Thus my attempt to try to reduce the lossage. I think.&#xA;&#xA;&gt;&gt; &gt; Does that miss anything that all the hashing achieves?&#xA;&gt;&gt; It does nothing if Carol is the one who can&#39;t route.&#xA;&gt;&#xA;&gt; If Carol can&#39;t route, then ideally she just refunds all the money and&#xA;&gt; everyone&#39;s happy.&#xA;&#xA;That tells Bob clearly that Carol failed.  If Carol claims a variable&#xA;amount, it&#39;s less obvious (though still pretty bad).&#xA;&#xA;&gt; If Carol tries to steal, then she can keep 750 msat instead of 250 msat.&#xA;&gt; This doesn&#39;t give any way for Bob to prove Carol cheated on him though;&#xA;&gt; but Bob could just refund the 1250 msat and write the 750 msat off as a&#xA;&gt; loss of dealing with cheaters like Carol.&#xA;&#xA;What actually happens is that Carol sends a signature on a commitment&#xA;which Bob does&#39;t agree with (since he expected his money back).  They go&#xA;onchain.&#xA;&#xA;Now Bob is out the total he fwd to Carol, but he&#39;s probably more annoyed&#xA;at losing the channel.&#xA;&#xA;Cheers,&#xA;Rusty.</html></oembed>