<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-08&#xA;📝 Original message:&#xA;Anthony Towns &lt;aj at erisian.com.au&gt; writes:&#xA;&gt; On Thu, Nov 07, 2019 at 02:56:51PM +1030, Rusty Russell wrote:&#xA;&gt;&gt; &gt; What you wrote to Zmn says &#34;Rusty decrypts the onion, reads the prepay&#xA;&gt;&gt; &gt; field: it says 14, LLLL.&#34; but Alice doesn&#39;t know anything other than&#xA;&gt;&gt; &gt; ZZZZ so can&#39;t put LLLL in the onion?&#xA;&gt;&gt; Alice created the onion.  Alice knows all the preimages, since she&#xA;&gt;&gt; created the chain AAAAA....ZZZZZ.&#xA;&gt;&#xA;&gt; In your reply to Zmn, it was Rusty (Bob) preparing the nonce and creating&#xA;&gt; the chain AAAA...ZZZZ -- so I was lost as to what you were proposing...&#xA;&#xA;Oops.  Don&#39;t trust that Rusty guy, let&#39;s stick with Alice.&#xA;&#xA;[ Snip summary, which is correct ]&#xA;&#xA;&gt; As far as the &#34;fair price&#34; goes, the spitballed formula is &#34;16 - X/4&#34;&#xA;&gt; where X is number of zero bits in some PoW-y thing. The proposal is&#xA;&gt; the thing is SHA256(blockhash|revealedonion) which works, and (I think)&#xA;&gt; means each step is individually grindable.&#xA;&gt;&#xA;&gt; I think an alternative would be to use the prepayment hashes themselves,&#xA;&gt; so you generate the nonce AAAA as the value you&#39;ll send to Dave then&#xA;&gt; hash it repeatedly to get BBBB..QQQQ, then check if pow(AAAA,BBBB) has&#xA;&gt; 60 leading zero bits or pow(AAAA,CCCC) has 56 leading zero bits etc.&#xA;&gt; If you made pow(a,b) be SHA256(a,b,shared-onion-key) I think it&#39;d&#xA;&gt; preserve privacy, but also mean you can&#39;t meaningfully grind unfairly&#xA;&gt; cheap routing except for very short paths?&#xA;&gt;&#xA;&gt; If you don&#39;t grind and just go by luck, the average number of hashes&#xA;&gt; per hop is ~15.93 (if I got my maths right), so you should be able to&#xA;&gt; estimate path length pretty accurate by dividing claimed prepaid funds by&#xA;&gt; 15.93*25msat or whatever. If everyone grinds at each level independently,&#xA;&gt; I think you&#39;d just subtract maybe 6 hops from that, but the maths would&#xA;&gt; mostly stay the same?&#xA;&gt;&#xA;&gt; Though I think you could obfusticate that pretty well by moving&#xA;&gt; some of the value from the HTLC into the prepayment -- you&#39;d risk losing&#xA;&gt; that extra value if the payment made it all the way to the recipient but&#xA;&gt; they declined the HTLC that way though.&#xA;&#xA;Yeah, and doesn&#39;t help obscure in the in-the-middle failure case unf.&#xA;Which is really bad with current payment_hash since you can spot&#xA;multiple attempts so easily.  Hence my attempt to roll in some PoW to&#xA;obscure the amounts.&#xA;&#xA;The ideal prepay range would be wider, so you can believably have&#xA;payments between 16 and 4 per hop, say.  But if I can grind it I&#39;ll&#xA;naturally restrict the range to the lower end, and if it&#39;s ungrindable&#xA;(eg. based on nodeid and payment_hash or recent block hash) then&#xA;everyone on the path knows what it so too.&#xA;&#xA;So, hashcash here is better than nothing, but still not very good.&#xA;&#xA;&gt;&gt; &gt;&gt; Does Alice lose everything on any routing failure?&#xA;&gt;&gt; &gt; That was my thought yeah; it seems weird to pay upfront but expect a&#xA;&gt;&gt; &gt; refund on failure -- the HTLC funds are already committed upfront and&#xA;&gt;&gt; &gt; refunded on failure.&#xA;&gt;&gt; AFAICT you have to overpay, since anything else is very revealing of&#xA;&gt;&gt; path length.  Which kind of implies a refund, I think.&#xA;&gt;&#xA;&gt; I guess you&#39;d want to pay for a path length of about 20 whether the&#xA;&gt; path is actually 17, 2, 10 or 5. But a path length of 20 is just paying&#xA;&gt; for bandwidth for maybe 200kB of total traffic which at $1/GB is 2% of&#xA;&gt; 1 cent, which doesn&#39;t seem that worth refunding (except for really tiny&#xA;&gt; micropayments, where paying for payment bandwidth might not be feasible&#xA;&gt; at all).&#xA;&gt;&#xA;&gt; If you&#39;re buying a $2 coffee and paying 500ppm in regular fees per hop&#xA;&gt; with 5 hops, then each routing attempt increases your fees by 4%, which&#xA;&gt; seems pretty easy to ignore to me.&#xA;&#xA;True, but ideally we&#39;d have lots of noise even if people are trying to&#xA;minimize fees (which, if they&#39;re sending messages rather than payments,&#xA;they might).&#xA;&#xA;Cheers,&#xA;Rusty.</html></oembed>