<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-02&#xA;📝 Original message:&#xA;Anthony Towns &lt;aj at erisian.com.au&gt; writes:&#xA;&gt; On Fri, Nov 02, 2018 at 10:20:46AM +1030, Rusty Russell wrote:&#xA;&gt;&gt;         There&#39;s been some discussion of what the lightning payment flow&#xA;&gt;&gt; might look like in the future, and I thought I&#39;d try to look forwards so&#xA;&gt;&gt; we can avoid painting ourselves into a corner now.  I haven&#39;t spent time&#xA;&gt;&gt; on concrete design and implementation to be sure this is correct,&#xA;&gt;&gt; however.&#xA;&gt;&#xA;&gt; I think I&#39;d like to see v1.1 of the lightning spec include&#xA;&gt; experimental/optional support for using secp256k1 public/private keys&#xA;&gt; for payment hashes/preimages. That assumes using either 2-party ECDSA&#xA;&gt; magic or script magic until it&#39;s viable to do it via Schnorr scriptless&#xA;&gt; scripts, but that seems like it&#39;s not totally infeasible?&#xA;&#xA;Not totally infeasible, but since every intermediary needs to support&#xA;it, I think we&#39;d need considerable buy-in before we commit to it in 1.1.&#xA;&#xA;&gt; I think the&#xA;&gt; components would need to be:&#xA;&gt;&#xA;&gt;  - invoices: will the preimage for the hash be a secp256k1 private key&#xA;&gt;    or a sha256 preimage? (or payer&#39;s choice?)&#xA;&#xA;&gt;From BOLT11:&#xA;&#xA;   The `p` field supports the current 256-bit payment hash, but future&#xA;   specs could add a new variant of different length, in which case&#xA;   writers could support both old and new, and old readers would ignore&#xA;   the one not the correct length.&#xA;&#xA;So the plan would be you provide two `p` fields in transition.&#xA;&#xA;&gt;  - channel announcements: do you support secp256k1 for hashes or just&#xA;&gt;    sha256?&#xA;&#xA;Worse, it becomes &#34;I support secp256k1 with ECDSA&#34; then a new &#34;I support&#xA;secp256k1 with Schnorr&#34;.  You need a continuous path of channels with&#xA;the same feature.&#xA;&#xA;&gt;  - node features: how do you support secp256k1? not at all (default),&#xA;&gt;    via 2p-ecdsa, via script magic, (eventually) via schnorr, ...?&#xA;&#xA;We could make these global feature bits, if you want to preferentually&#xA;establish channels with nodes who support a specific feature.&#xA;&#xA;&gt; I think this is (close to) a necessary precondition for payment&#xA;&gt; decorrelation, AMP, and third-party verifiable proof-of-payment.&#xA;&#xA;Yes, that&#39;s the easy part :)&#xA;&#xA;...&#xA;&gt; Even if you calculate r differently, I don&#39;t think you can do this&#xA;&gt; without Bob and Alice interacting to get the nonce R prior to sending&#xA;&gt; the transaction, which seems effectively the same as having dynamic&#xA;&gt; invoice hashes, though.&#xA;&#xA;I know Andrew Poelstra thought it was possible, so I&#39;m going to leave a&#xA;response to him :)&#xA;&#xA;&gt; Maybe querying for a nonce through the lightning network would make&#xA;&gt; sense though, which would allow the &#34;invoice&#34; to be static, and all the&#xA;&gt; dynamic things would be via lightning p2p? That step could perhaps be&#xA;&gt; combined with the 0 satoshi payment probes that Fabrice proposes in&#xA;&gt;&#xA;&gt;  https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-October/001484.html&#xA;&gt;&#xA;&gt; but I think replying with a public nonce value would need a new message&#xA;&gt; type of some sort?&#xA;&#xA;We might eventually end up going full HORNET, for other reasons.  But it&#xA;places demands on the network which need careful consideration, and the&#xA;more traffic you send the more chances for analysis.  A single pass is&#xA;enough.&#xA;&#xA;&gt; I think AMP is independent, other than also using secp256k1 preimages&#xA;&gt; rather than SHA256. I think AMP splits and joins are just:&#xA;&gt;&#xA;&gt;  - if you&#39;re joining incoming payments, don&#39;t forward until you&#39;ve&#xA;&gt;    got all the HTLCs, and ensure you can generate the secret for each&#xA;&gt;    incoming payment from the single outgoing payment&#xA;&gt;&#xA;&gt;  - if you&#39;re splitting an incoming payment into many outgoing payments,&#xA;&gt;    ensure you can claim the incoming payment from *any* outgoing&#xA;&gt;    payments&#39; secret&#xA;&gt;&#xA;&gt; Which I think in practice just means knowing x_i for each input, and&#xA;&gt; y_j for each output other than the first, and verifying:&#xA;&gt;&#xA;&gt;     I_i = O_1 + x_i*G&#xA;&gt;     O_j = O_1 + y_j*G&#xA;&gt;&#xA;&gt; (this gives I_i = O_j + (x_i-y_j)*G and the corresponding secret being&#xA;&gt; i_i = o_j + x_i - y_j) allowing you to claim all incoming HTLCs given&#xA;&gt; the secret from any outgoing HTLC)&#xA;&#xA;I think a general scheme is: payer creates a random group-marker, sends&#xA;&lt;group-marker&gt;&lt;32-byte-randomness&gt;[encrypted data...] in each payment.&#xA;Receipient collects payments by &lt;group-marker&gt;, xoring the&#xA;&lt;32-byte-randomness&gt;; if that xor successfully decrypts the data, you&#39;ve&#xA;got all the pieces.&#xA;&#xA;(For low-AMP, you use payment_hash as &lt;group-marker&gt;, and just use&#xA;SHA256(&lt;xor-of-all-randomness&gt;&lt;32-byte-randomness&gt;) as the per-payment&#xA;preimage so no [encrypted data] needed).&#xA;&#xA;Cheers,&#xA;Rusty.</html></oembed>