<oembed><type>rich</type><version>1.0</version><author_name>npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_name><author_url>https://nostr.ae/npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-11-03&#xA;📝 Original message:&#xA;On Fri, Nov 02, 2018 at 03:45:58PM +1030, Rusty Russell wrote:&#xA;&gt; Anthony Towns &lt;aj at erisian.com.au&gt; writes:&#xA;&gt; &gt; On Fri, Nov 02, 2018 at 10:20:46AM +1030, Rusty Russell wrote:&#xA;&gt; &gt;&gt;         There&#39;s been some discussion of what the lightning payment flow&#xA;&gt; &gt;&gt; might look like in the future, and I thought I&#39;d try to look forwards so&#xA;&gt; &gt;&gt; we can avoid painting ourselves into a corner now.  I haven&#39;t spent time&#xA;&gt; &gt;&gt; on concrete design and implementation to be sure this is correct,&#xA;&gt; &gt;&gt; however.&#xA;&gt; &gt; I think I&#39;d like to see v1.1 of the lightning spec include&#xA;&gt; &gt; experimental/optional support for using secp256k1 public/private keys&#xA;&gt; &gt; for payment hashes/preimages. That assumes using either 2-party ECDSA&#xA;&gt; &gt; magic or script magic until it&#39;s viable to do it via Schnorr scriptless&#xA;&gt; &gt; scripts, but that seems like it&#39;s not totally infeasible?&#xA;&gt; Not totally infeasible, but since every intermediary needs to support&#xA;&gt; it, I think we&#39;d need considerable buy-in before we commit to it in 1.1.&#xA;&#xA;&#34;every intermediary&#34; just means &#34;you have to find a path where every&#xA;channel supports it&#34;; nodes/channels that aren&#39;t in the route you choose&#xA;aren&#39;t a problem, and can still pass on the gossiped announcements,&#xA;I think?&#xA;&#xA;&gt; &gt; I think the&#xA;&gt; &gt; components would need to be:&#xA;&gt; &gt;  - invoices: will the preimage for the hash be a secp256k1 private key&#xA;&gt; &gt;    or a sha256 preimage? (or payer&#39;s choice?)&#xA;&gt; From BOLT11:&#xA;&gt;    The `p` field supports the current 256-bit payment hash, but future&#xA;&gt;    specs could add a new variant of different length, in which case&#xA;&gt;    writers could support both old and new, and old readers would ignore&#xA;&gt;    the one not the correct length.&#xA;&gt; So the plan would be you provide two `p` fields in transition.&#xA;&#xA;Yeah, that sounds workable.&#xA;&#xA;&gt; &gt;  - channel announcements: do you support secp256k1 for hashes or just&#xA;&gt; &gt;    sha256?&#xA;&gt; Worse, it becomes &#34;I support secp256k1 with ECDSA&#34; then a new &#34;I support&#xA;&gt; secp256k1 with Schnorr&#34;.  You need a continuous path of channels with&#xA;&gt; the same feature.&#xA;&#xA;I don&#39;t think that&#39;s correct: whether it&#39;s 2p-ecdsa, Schnorr or script&#xA;magic only matters for the two nodes directly involved in the channel&#xA;(who need to be able to understand the commitment transactions they&#39;re&#xA;signing, and extract the private key from the on-chain tx if the channel&#xA;gets unilaterally closed). For everyone else, they just need to know that&#xA;they can put in a public key based HTLC, and get back the corresponding&#xA;private key when the HTLC goes through.&#xA;&#xA;It&#39;s also (theoretically) upgradable afaics: if two nodes have a channel&#xA;that supports 2p-ecdsa, and eventually both upgrade to support segwit&#xA;v1 scriptless schnorr sigs or whatever, they just need to change the&#xA;addresses they use in new commitment txs, even for existing HTLCs.&#xA;&#xA;&gt; &gt; Even if you calculate r differently, I don&#39;t think you can do this&#xA;&gt; &gt; without Bob and Alice interacting to get the nonce R prior to sending&#xA;&gt; &gt; the transaction, which seems effectively the same as having dynamic&#xA;&gt; &gt; invoice hashes, though.&#xA;&gt; I know Andrew Poelstra thought it was possible, so I&#39;m going to leave a&#xA;&gt; response to him :)&#xA;&#xA;AFAICT, in general, if you&#39;re going to have n signatures with a public&#xA;key P, you need to generate the n R=r*G values from n*32B worth of random data,&#xA;that&#39;s previously unknown to the signature recipients. If you&#39;ve got&#xA;less than that, then you will have calculated each R by doing something&#xA;like based on &lt;n*32B of data you&#39;ve been given:&#xA;&#xA;    R = a*R1 + b*R2 + ..&#xA;&#xA;and the n signatures you eventually receive will give you n simultaneous&#xA;linear equations along the lines of:&#xA;&#xA;    s = (a*r1 + b*r2 + c*r3 + ..) + H(..)*p&#xA;&#xA;with &lt;= n unknowns (p and less than n r1,r2,.. values). (If you don&#39;t&#xA;known the values a,b,c you won&#39;t be able to calculate the R values for&#xA;your signatures in the first place)&#xA;&#xA;Willing to be surprised by a different approach, but I&#39;m pretty&#xA;skeptical...&#xA;&#xA;&#xA;I think it makes sense to think of proof-of-payment in terms of a&#xA;verification algorithm (that a third party court could use), that takes:&#xA;&#xA;  m - the invoice details, eg&#xA;      &#34;aj paid $11 for stickers to be delivered to Australia&#34;&#xA;  P - the pubkey of the vendor&#xA;  sig - some signature&#xA;&#xA;With the current SHA256 preimages, you can make sig=(R,s,pre)&#xA;where the sig is valid if:&#xA;&#xA;  s*G = R + H(P,R,m+SHA256(pre))*P&#xA;&#xA;If you share R,s,SHA256(pre) beforehand, the payer can tell they&#39;ll have&#xA;a valid signature if they pay to SHA256(pre). That&#39;s a 96B signature,&#xA;and it requires &#34;pre&#34; be different for each sale, and needs pre-payment&#xA;interactivity to agree on m and communicate R,s back to the payer.&#xA;&#xA;With seckp256k1 preimages, it&#39;s easy to reduce that to sig=(R,s),&#xA;and needing to communicate an R to the payer initially, who can then&#xA;calculate S and send &#34;m&#34; along with the payment.&#xA;&#xA;&#xA;Maybe it makes sense to disambiguate the term &#34;invoice&#34; -- when you don&#39;t&#xA;know who you might be giving the goods/service to, call it an &#34;offer&#34;,&#xA;which can be a write-once/accept-by-anyone deal that you just leave on&#xA;a webpage or your email signature; but an &#34;invoice&#34; should be specific&#xA;to each individual payment, with a &#34;receipt&#34; provided once an invoice&#xA;is paid.&#xA;&#xA;&#xA;AMP:&#xA;&#xA;&gt; I think a general scheme is: payer creates a random group-marker, sends&#xA;&gt; &lt;group-marker&gt;&lt;32-byte-randomness&gt;[encrypted data...] in each payment.&#xA;&gt; Receipient collects payments by &lt;group-marker&gt;, xoring the&#xA;&gt; &lt;32-byte-randomness&gt;; if that xor successfully decrypts the data, you&#39;ve&#xA;&gt; got all the pieces.&#xA;&gt; &#xA;&gt; (For low-AMP, you use payment_hash as &lt;group-marker&gt;, and just use&#xA;&gt; SHA256(&lt;xor-of-all-randomness&gt;&lt;32-byte-randomness&gt;) as the per-payment&#xA;&gt; preimage so no [encrypted data] needed).&#xA;&#xA;Hmm, right, I&#39;ve got decorrelation and AMP combined in my head. I&#39;m also&#xA;a bit confused about what exactly you mean by &#34;low-AMP&#34;...&#xA;&#xA;Rereading through the AMP threads, Christian&#39;s post makes a lot of sense&#xA;to me:&#xA;&#xA;https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-February/001023.html&#xA;&#xA;I&#39;m not really seeing the benefits in complicated AMP schemes without&#xA;decorrelation...&#xA;&#xA;It seems to me like there are three levels that could be implemented:&#xA;&#xA; - laolu/conner: (&#34;low AMP&#34; ?)&#xA;    works with sha256&#xA;    some privacy improvement&#xA;    loses proof-of-payment&#xA;    can&#39;t claim unless all payments arrive&#xA;&#xA; - just send multiple payments with the same hash:&#xA;    works with sha256&#xA;    privacy not improved much (some intermediary nodes no longer know&#xA;      full invoice value)&#xA;    can claim partial payments as soon as they arrive&#xA;    accepting any partial payment provides proof-of-payment&#xA;&#xA; - secp256k1: (&#34;high AMP&#34; ?)&#xA;    needs secp256k1 preimages&#xA;    works fine with decorrelation improving privacy at every step&#xA;    can set it up so can only claim once all partial payments arrive&#xA;    accepting partial payment provides proof-of-payment&#xA;&#xA;In theory, both &#34;just send multiple payments&#34; and &#34;secp256k1&#34; could have&#xA;splitting and joining at any hop, if we could encode the instructions&#xA;on how to do that in the onion message; joining is probably easy, but&#xA;splitting seems like it might be hard?&#xA;&#xA;Cheers,&#xA;aj</html></oembed>