<oembed><type>rich</type><version>1.0</version><title>Anthony Towns [ARCHIVE] wrote</title><author_name>Anthony Towns [ARCHIVE] (npub17r…x9l2h)</author_name><author_url>https://yabu.me/npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2019-11-05&#xA;📝 Original message:&#xA;On Tue, Nov 05, 2019 at 07:56:45PM +1030, Rusty Russell wrote:&#xA;&gt; Sure: for simplicity I&#39;m sending a 0-value HTLC.&#xA;&gt; ZmnSCPxj has balance 10000msat in channel with Rusty, who has 1000msat&#xA;&gt; in the channel with YAIjbOJa.&#xA;&#xA;Alice, Bob and Carol sure seem simpler than Zmn YAI and Rusty...&#xA;&#xA;&gt; Rusty prepares a nonce, AAAAA and hashes it 25 times = ZZZZZ.&#xA;&gt; ZmnSCPxj prepares the onion, but adds extra fields (see below).  &#xA;&#xA;It would have made more sense to me for Alice (Zmn) to generate&#xA;the nonce, hash it, and prepare the onion, so that the nonce is&#xA;revealed to Dave (Rusty) if/when the message ever actually reaches its&#xA;destination. Otherwise Rusty has to send AAAAA to Zmn already so that&#xA;Zmn can prepare the onion?&#xA;&#xA;&gt; He then&#xA;&gt; sends the HTLC to Rusty, but also sends ZZZZZ, and 25x50 msat (ie. those&#xA;&gt; fields are in the update_add_htlc msg).  His balance with Rusty is now&#xA;&gt; 8750msat (ie. 25x50 to Rusty).&#xA;&gt; &#xA;&gt; Rusty decrypts the onion, reads the prepay field: it says 14, LLLLL.&#xA;&gt; Rusty checks: the hash of the onion &amp; block (or something) does indeed&#xA;&gt; have the top 8 bits clear, so the cost is in fact 16 - 8/2 == 14.  He&#xA;&gt; then hashes LLLLL 14 times, and yes, it&#39;s ZZZZZ as ZmnSCPxj said it&#xA;&gt; should be.&#xA;&#xA;I&#39;m not sure why lucky hashing should result in a discount? You&#39;re&#xA;giving a linear discount for exponentially more luck in hashing which&#xA;also seems odd.&#xA;&#xA;You&#39;ve only got two nonce choices -- the initial AAAA and the depth&#xA;that you tell Bob and Carol to hash to as steps in the route; so the&#xA;incentive there seems to be to do a large depth, so you might hash&#xA;AAAA 1000 times, and figure that you&#39;ll find a leading eight 0&#39;s once&#xA;in the first 256 entries, then another by the time you get up to 512,&#xA;and another by the time you get to 768, which gets you discounts on&#xA;three intermediaries. But the cost there is that your intermediaries&#xA;collectively have to do the same amount of hashing you did, so it&#39;s not&#xA;proof-of-work, because it&#39;s as hard to verify as it is to generate.&#xA;&#xA;I think you could just make the scheme be:&#xA;&#xA;  Alice sends HTLC(k,v) + 1250 msat to Bob&#xA;  Bob unwraps the onion and forwards HTLC(k,v) + 500 msat to Carol&#xA;  Carol unwraps the onion and forwards HTLC(k,v) + 250 msat to Dave&#xA;  Dave redeems the HTLC, claims an extra 300 msat and refunds 200 msat to Carol&#xA;  Carol redeems the HTLC and refunds 200 msat to Bob&#xA;  Bob redeems the HTLC and refunds 200 msat to Alice&#xA;&#xA;If there&#39;s a failure, Alice loses the 1250 msat, and someone in the&#xA;path steals the funds. You could make the accountable by having Alice&#xA;also provide &#34;Hash(AAAA, refund=200)&#34; to everyone, encoding AAAA in the&#xA;onion to Dave, and then each hop reveals AAAA and refunds 200msat to&#xA;demonstrate their honesty.&#xA;&#xA;Does that miss anything that all the hashing achieves?&#xA;&#xA;I think the idea here is that you&#39;re paying tiny amounts for the&#xA;bandwidth, which when it&#39;s successful does in fact pay for the bandwidth;&#xA;and when it&#39;s unsuccessful results in a channel closure, which makes it&#xA;unprofitable to cheat the system, but doesn&#39;t change the economics of&#xA;lightning much overall because channel closures can happen anytime anyway.&#xA;I think that approach makes sense.&#xA;&#xA;Cheers,&#xA;aj</html></oembed>