<oembed><type>rich</type><version>1.0</version><author_name>npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_name><author_url>https://nostr.ae/npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-11-04&#xA;📝 Original message:&#xA;Anthony Towns &lt;aj at erisian.com.au&gt; writes:&#xA;&gt;&gt; &gt;  - channel announcements: do you support secp256k1 for hashes or just&#xA;&gt;&gt; &gt;    sha256?&#xA;&gt;&gt; Worse, it becomes &#34;I support secp256k1 with ECDSA&#34; then a new &#34;I support&#xA;&gt;&gt; secp256k1 with Schnorr&#34;.  You need a continuous path of channels with&#xA;&gt;&gt; the same feature.&#xA;&gt;&#xA;&gt; I don&#39;t think that&#39;s correct: whether it&#39;s 2p-ecdsa, Schnorr or script&#xA;&gt; magic only matters for the two nodes directly involved in the channel&#xA;&gt; (who need to be able to understand the commitment transactions they&#39;re&#xA;&gt; signing, and extract the private key from the on-chain tx if the channel&#xA;&gt; gets unilaterally closed). For everyone else, they just need to know that&#xA;&gt; they can put in a public key based HTLC, and get back the corresponding&#xA;&gt; private key when the HTLC goes through.&#xA;&#xA;I&#39;m not sure.  Jonas Nick proposed a scheme, which very much assumes&#xA;Schnorr AFAICT:&#xA;&#xA;Jonas Nick wrote:&#xA;&gt; How I thought it would work is that the invoice would contain a&#xA;&gt; Schnorr nonce R. Then the payer would construct s*G = R +&#xA;&gt; H(payee_pubkey,R,&#34;I&#39;ve bought 5 shirts shipped to Germany&#34;)*G. Then&#xA;&gt; the payer builds the scriptless script payment path such that when the&#xA;&gt; payee claims, the payer learns s and thus has a complete&#xA;&gt; signature. However, that doesn’t work with recurrent payments because&#xA;&gt; the payee can use the nonce only once.&#xA;&#xA;I would probably enhance this to include a nonce, which allows for AMP&#xA;(you have to xor the AMP payments to get the nonce):&#xA;&#xA;R + H(payee_pubkey,R,&#34;I&#39;ve bought 5 shirts shipped to Germany&#34;,NONCE)*G&#xA;&#xA;&gt; I think it makes sense to think of proof-of-payment in terms of a&#xA;&gt; verification algorithm (that a third party court could use), that takes:&#xA;&gt;&#xA;&gt;   m - the invoice details, eg&#xA;&gt;       &#34;aj paid $11 for stickers to be delivered to Australia&#34;&#xA;&gt;   P - the pubkey of the vendor&#xA;&gt;   sig - some signature&#xA;&gt;&#xA;&gt; With the current SHA256 preimages, you can make sig=(R,s,pre)&#xA;&gt; where the sig is valid if:&#xA;&gt;&#xA;&gt;   s*G = R + H(P,R,m+SHA256(pre))*P&#xA;&gt;&#xA;&gt; If you share R,s,SHA256(pre) beforehand, the payer can tell they&#39;ll have&#xA;&gt; a valid signature if they pay to SHA256(pre). That&#39;s a 96B signature,&#xA;&gt; and it requires &#34;pre&#34; be different for each sale, and needs pre-payment&#xA;&gt; interactivity to agree on m and communicate R,s back to the payer.&#xA;&#xA;For current-style invoices (no payer-supplied data), the payee knows&#xA;&#39;m&#39;, so no interactivity needed, which is nice.&#xA;&#xA;In the payer-supplied data case, I think &#39;m&#39; should include a signature&#xA;for a key only the payer knows: this lets them prove *they* made the&#xA;payment.&#xA;&#xA;How does this interact with AMP, however?&#xA;&#xA;&gt; With seckp256k1 preimages, it&#39;s easy to reduce that to sig=(R,s),&#xA;&gt; and needing to communicate an R to the payer initially, who can then&#xA;&gt; calculate S and send &#34;m&#34; along with the payment.&#xA;&#xA;OK, I buy that.&#xA;&#xA;&gt; Maybe it makes sense to disambiguate the term &#34;invoice&#34; -- when you don&#39;t&#xA;&gt; know who you might be giving the goods/service to, call it an &#34;offer&#34;,&#xA;&gt; which can be a write-once/accept-by-anyone deal that you just leave on&#xA;&gt; a webpage or your email signature; but an &#34;invoice&#34; should be specific&#xA;&gt; to each individual payment, with a &#34;receipt&#34; provided once an invoice&#xA;&gt; is paid.&#xA;&#xA;&#34;offer&#34; is a good name, since I landed on the same one while thinking&#xA;about this too :)&#xA;&#xA;For an &#34;offer&#34; you would need a (lightning-network-carried) req/resp to&#xA;get the per-payment invoice.  An offer could use a 128-bit &#39;p&#39;: smaller&#xA;would do, but this is too large to brute-force iterate through (hey, I&#xA;wonder if they sell other stuff?).&#xA;&#xA;&gt; Rereading through the AMP threads, Christian&#39;s post makes a lot of sense&#xA;&gt; to me:&#xA;&gt;&#xA;&gt; https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-February/001023.html&#xA;&gt;&#xA;&gt; I&#39;m not really seeing the benefits in complicated AMP schemes without&#xA;&gt; decorrelation...&#xA;&#xA;In practice it should increase reliability of payments through capacity&#xA;bottlenecks.  But don&#39;t underestimate the benefits of PoP: we&#39;re so used&#xA;to intermediates we take it for granted, but once the middleman is&#xA;removed the ability to prove the invoice/payment cycles is vital for&#xA;usability.&#xA;&#xA;&gt; It seems to me like there are three levels that could be implemented:&#xA;&gt;&#xA;&gt;  - laolu/conner: (&#34;low AMP&#34; ?)&#xA;&gt;     works with sha256&#xA;&gt;     some privacy improvement&#xA;&gt;     loses proof-of-payment&#xA;&gt;     can&#39;t claim unless all payments arrive&#xA;&#xA;Yep.&#xA;&#xA;&gt;  - just send multiple payments with the same hash:&#xA;&gt;     works with sha256&#xA;&gt;     privacy not improved much (some intermediary nodes no longer know&#xA;&gt;       full invoice value)&#xA;&gt;     can claim partial payments as soon as they arrive&#xA;&gt;     accepting any partial payment provides proof-of-payment&#xA;&#xA;Interestingly, if vendor takes part payment, rest can be stolen by&#xA;intermediaries.  This puts pressure on vendor to treat them atomically.&#xA;I haven&#39;t thought about this before, but it has desirable attributes.&#xA;(If the contract is &#34;you will only release preimage once you&#39;ve got the&#xA;payment&#34;, all this requires is a single bit to say &#34;I know this is&#xA;partial, more are coming, please wait&#34;).&#xA;&#xA;&gt;  - secp256k1: (&#34;high AMP&#34; ?)&#xA;&gt;     needs secp256k1 preimages&#xA;&gt;     works fine with decorrelation improving privacy at every step&#xA;&gt;     can set it up so can only claim once all partial payments arrive&#xA;&gt;     accepting partial payment provides proof-of-payment&#xA;&#xA;Yes.  Though I&#39;m not sure exactly how this works with your scheme&#xA;above...&#xA;&#xA;&gt; In theory, both &#34;just send multiple payments&#34; and &#34;secp256k1&#34; could have&#xA;&gt; splitting and joining at any hop, if we could encode the instructions&#xA;&gt; on how to do that in the onion message; joining is probably easy, but&#xA;&gt; splitting seems like it might be hard?&#xA;&#xA;I don&#39;t think so.  If you can join two payments, it wasn&#39;t private?  For&#xA;splitting, in the specific case of having two channels between the same&#xA;nodes, you might be able to do something, but that&#39;s a pretty narrow&#xA;case.  And as TCP discovered, you&#39;re better off failing back to sender&#xA;than trying to add fragmentation to the protocol.&#xA;&#xA;Note: if we need an interaction message for BOLT11 features we want in&#xA;future[1], then it has the advantage that it decouples the bolt11&#xA;features from changing preimages to secp256k1.  That makes this question&#xA;*critical* for the Summit next week.&#xA;&#xA;Thanks!&#xA;Rusty.&#xA;&#xA;[1] If we&#39;re not careful we&#39;re going to implement HORNET so we can pass&#xA;arbitrary messages around, which means we want to start charging for&#xA;them to prevent spam, which means we reopen the pre-payment debate, and&#xA;need reliable error messages...</html></oembed>