<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-06&#xA;📝 Original message:&#xA;On Wed, Nov 06, 2019 at 10:43:23AM +1030, Rusty Russell wrote:&#xA;&gt; &gt;&gt; Rusty prepares a nonce, AAAAA and hashes it 25 times = ZZZZZ.&#xA;&gt; &gt;&gt; ZmnSCPxj prepares the onion, but adds extra fields (see below).  &#xA;&gt; &gt; It would have made more sense to me for Alice (Zmn) to generate&#xA;&gt; &gt; the nonce, hash it, and prepare the onion, so that the nonce is&#xA;&gt; &gt; revealed to Dave (Rusty) if/when the message ever actually reaches its&#xA;&gt; &gt; destination. Otherwise Rusty has to send AAAAA to Zmn already so that&#xA;&gt; &gt; Zmn can prepare the onion?&#xA;&gt; The entire point is to pay *up-front*, though, to prevent spam.&#xA;&#xA;Hmm, I&#39;m not sure I see the point of paying upfront but not&#xA;unconditionally -- you already commit the funds as part of the HTLC,&#xA;and if you&#39;re refunding some of them, you kind-of have to keep them&#xA;reserved or you risk finalising the HTLC causing a failure because you&#xA;don&#39;t have enough msats spare to do the refund?&#xA;&#xA;If you refund on routing failure, why wouldn&#39;t a spammer just add a fake&#xA;&#34;Ezekiel&#34; at the end of the route after Dave, so that the HTLCs always&#xA;fail and all the fees are returned?&#xA;&#xA;&gt; Bob/ZmnSCPxj doesn&#39;t prepare anything in the onion.  They get handed the&#xA;&gt; last hash directly: Alice is saying &#34;I&#39;ll pay you 50msat for each&#xA;&gt; preimage you can give me leading to this hash&#34;.&#xA;&#xA;So my example was Alice paying Dave via Bob and Carol (so Alice/Bob,&#xA;Bob/Carol, Carol/Dave being the individual channels).&#xA;&#xA;What you wrote to Zmn says &#34;Rusty decrypts the onion, reads the prepay&#xA;field: it says 14, LLLL.&#34; but Alice doesn&#39;t know anything other than&#xA;ZZZZ so can&#39;t put LLLL in the onion?&#xA;&#xA;Are you using Hornet so that every intermediary can communicate a nonce&#xA;back to the source of the route? If not, &#34;Rusty&#34; generating the nonce&#xA;seems like you&#39;re informing Rusty that you&#39;re actually the origin of the&#xA;HTLC, and not just innocently forwarding it along; if so, it seems like&#xA;you have independent nonces at each step, rather than&#xA;AAAA/BBBB/LLLL/ZZZZ in a direct chain.&#xA;&#xA;&gt; &gt; I&#39;m not sure why lucky hashing should result in a discount?&#xA;&gt; Because the PoW adds noise to the amounts, otherwise the path length is&#xA;&gt; trivially exposed, esp in the failure case.  It&#39;s weak protection&#xA;&gt; though.&#xA;&#xA;With a linear/exponential relationship you just get &#34;half the time it&#39;s&#xA;1 unit, 25% of the time it&#39;s 2 units, 12% of the time it&#39;s 3 units&#34;, so&#xA;I don&#39;t think that&#39;s adding much noise?&#xA;&#xA;&gt; &gt; You&#39;ve only got two nonce choices -- the initial AAAA and the depth&#xA;&gt; &gt; that you tell Bob and Carol to hash to as steps in the route;&#xA;&gt; No, the sphinx construction allows for grinding, that was my intent&#xA;&gt; here.  The prepay hashes are independent.&#xA;&#xA;Oh, because you&#39;re also xoring with the onion packet, right, I see.&#xA;&#xA;&gt; &gt; I think you could just make the scheme be:&#xA;&gt; &gt;   Alice sends HTLC(k,v) + 1250 msat to Bob&#xA;&gt; &gt;   Bob unwraps the onion and forwards HTLC(k,v) + 500 msat to Carol&#xA;&gt; &gt;   Carol unwraps the onion and forwards HTLC(k,v) + 250 msat to Dave&#xA;&gt; &gt;   Dave redeems the HTLC, claims an extra 300 msat and refunds 200 msat to Carol&#xA;&#xA;The math here doesn&#39;t add up. Let&#39;s assume I meant:&#xA;&#xA;  Bob keeps 500 sat, forwards 750 sat&#xA;  Carol keeps 250 sat, forwards 500 sat&#xA;  Dave keeps 300 sat, refunds 200 sat&#xA;&#xA;&gt; &gt;   Carol redeems the HTLC and refunds 200 msat to Bob&#xA;&gt; &gt;   Bob redeems the HTLC and refunds 200 msat to Alice&#xA;&gt; &gt;&#xA;&gt; &gt; If there&#39;s a failure, Alice loses the 1250 msat, and someone in the&#xA;&gt; &gt; path steals the funds.&#xA;&gt; This example confuses me.&#xA;&#xA;Well, that makes us even at least? :)&#xA;&#xA;&gt; So, you&#39;re charging 250msat per hop?  Why is Bob taking 750?  Does Carol&#xA;&gt; now know Dave is the last hop?&#xA;&#xA;No, Alice is choosing to pay 500, 250 and 300 msat to Bob, Carol and&#xA;Dave respectively, as part of setting up the onion, and picks those&#xA;numbers via some magic algo trading off privacy and cost.&#xA;&#xA;&gt; Does Alice lose everything on any routing failure?&#xA;&#xA;That was my thought yeah; it seems weird to pay upfront but expect a&#xA;refund on failure -- the HTLC funds are already committed upfront and&#xA;refunded on failure.&#xA;&#xA;&gt; If so, that is strong incentive for Alice to reduce path-length privacy&#xA;&gt; by keeping payments minimal, which I was really trying to avoid.&#xA;&#xA;Assuming v is much larger than 1250msat, and 1250 msat is much lower than&#xA;the cost to Bob of losing the channel with Alice, I don&#39;t think that&#39;s&#xA;a problem. 1250msat pays for 125kB of bandwdith under your assumptions&#xA;I think?&#xA;&#xA;&gt; &gt; Does that miss anything that all the hashing achieves?&#xA;&gt; It does nothing if Carol is the one who can&#39;t route.&#xA;&#xA;If Carol can&#39;t route, then ideally she just refunds all the money and&#xA;everyone&#39;s happy.&#xA;&#xA;If Carol tries to steal, then she can keep 750 msat instead of 250 msat.&#xA;This doesn&#39;t give any way for Bob to prove Carol cheated on him though;&#xA;but Bob could just refund the 1250 msat and write the 750 msat off as a&#xA;loss of dealing with cheaters like Carol.&#xA;&#xA;Cheers,&#xA;aj</html></oembed>