<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-02&#xA;📝 Original message:&#xA;On Fri, Nov 02, 2018 at 10:20:46AM +1030, Rusty Russell wrote:&#xA;&gt;         There&#39;s been some discussion of what the lightning payment flow&#xA;&gt; might look like in the future, and I thought I&#39;d try to look forwards so&#xA;&gt; we can avoid painting ourselves into a corner now.  I haven&#39;t spent time&#xA;&gt; on concrete design and implementation to be sure this is correct,&#xA;&gt; however.&#xA;&#xA;I think I&#39;d like to see v1.1 of the lightning spec include&#xA;experimental/optional support for using secp256k1 public/private keys&#xA;for payment hashes/preimages. That assumes using either 2-party ECDSA&#xA;magic or script magic until it&#39;s viable to do it via Schnorr scriptless&#xA;scripts, but that seems like it&#39;s not totally infeasible? I think the&#xA;components would need to be:&#xA;&#xA; - invoices: will the preimage for the hash be a secp256k1 private key&#xA;   or a sha256 preimage? (or payer&#39;s choice?)&#xA; - channel announcements: do you support secp256k1 for hashes or just&#xA;   sha256?&#xA; - node features: how do you support secp256k1? not at all (default),&#xA;   via 2p-ecdsa, via script magic, (eventually) via schnorr, ...?&#xA;&#xA;I think this is (close to) a necessary precondition for payment&#xA;decorrelation, AMP, and third-party verifiable proof-of-payment.&#xA;&#xA;&gt; Desired Status&#xA;&gt; --------------&#xA;&gt; Ideally, you could create one invoice which could be paid arbitrary many&#xA;&gt; times, by different individuals.  eg. &#34;My donation invoice is on my web&#xA;&gt; page&#34;, or &#34;I&#39;ve printed out the invoice for a widget and stuck it to the&#xA;&gt; widget&#34;, or &#34;Pay this invoice once a month please&#34;.&#xA;&gt; &#xA;&gt; Also, you should be able to prove you&#39;ve paid, in a way I can&#39;t just&#xA;&gt; copy the proof and claim I paid, too, even if I&#39;m the merchant, and that&#xA;&gt; you agreed to my terms, eg. &#34;I&#39;m paying for 500 widgets to be shipped to&#xA;&gt; Rusty in Australia&#34;.&#xA;&#xA;So, I think at a high level the logic here goes:&#xA;&#xA;  1. Alice: &#34;Buy a t-shirt from me for $5!&#34;&#xA;  2. Bob: &#34;Alice, I want to buy a t-shirt from you, here&#39;s $5&#34;&#xA;  3. Alice: &#34;Receipt: Bob bought a t-shirt from me&#34;&#xA;  4. Bob: &#34;Your Honour, here&#39;s my receipt from Alice for a t-shirt, please&#xA;     make her deliver on it!&#34;&#xA;&#xA;Going backwards; for the last step to be useful, the receipt has to be&#xA;a signature with the Alice&#39;s public key -- if it were anything short of&#xA;that, Alice will claim Bob could have just made up all the numbers. For a&#xA;Schnorr sig, that means (R,s) with the vendor choosing R and not revealing&#xA;R&#39;s preimage as that would reveal their private key.&#xA;&#xA;If both vendor and customer know R, then to get the signature, you need&#xA;the private key holder to reveal s which is just revealing the secp256k1&#xA;private key corresponding to S, calculated as:&#xA;&#xA;    S = R + H(P,R,&#34;Bob bought a $5 t-shirt from me&#34;)*P&#xA;&#xA;where P is Alice&#39;s public key. If R is calculated via the Schnorr BIP&#39;s&#xA;recommendation, then r = H(p, &#34;Bob bought a $5 t-shirt from me&#34;) -- ie,&#xA;based on the private key and the message being signed.&#xA;&#xA;Even if you calculate r differently, I don&#39;t think you can do this&#xA;without Bob and Alice interacting to get the nonce R prior to sending&#xA;the transaction, which seems effectively the same as having dynamic&#xA;invoice hashes, though.&#xA;&#xA;Maybe querying for a nonce through the lightning network would make&#xA;sense though, which would allow the &#34;invoice&#34; to be static, and all the&#xA;dynamic things would be via lightning p2p? That step could perhaps be&#xA;combined with the 0 satoshi payment probes that Fabrice proposes in&#xA;&#xA; https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-October/001484.html&#xA;&#xA;but I think replying with a public nonce value would need a new message&#xA;type of some sort?&#xA;&#xA;&#xA;&#xA;I think AMP is independent, other than also using secp256k1 preimages&#xA;rather than SHA256. I think AMP splits and joins are just:&#xA;&#xA; - if you&#39;re joining incoming payments, don&#39;t forward until you&#39;ve&#xA;   got all the HTLCs, and ensure you can generate the secret for each&#xA;   incoming payment from the single outgoing payment&#xA;&#xA; - if you&#39;re splitting an incoming payment into many outgoing payments,&#xA;   ensure you can claim the incoming payment from *any* outgoing&#xA;   payments&#39; secret&#xA;&#xA;Which I think in practice just means knowing x_i for each input, and&#xA;y_j for each output other than the first, and verifying:&#xA;&#xA;    I_i = O_1 + x_i*G&#xA;    O_j = O_1 + y_j*G&#xA;&#xA;(this gives I_i = O_j + (x_i-y_j)*G and the corresponding secret being&#xA;i_i = o_j + x_i - y_j) allowing you to claim all incoming HTLCs given&#xA;the secret from any outgoing HTLC)&#xA;&#xA;Cheers,&#xA;aj</html></oembed>