<oembed><type>rich</type><version>1.0</version><author_name>npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l</author_name><author_url>https://nostr.ae/npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2023-07-27&#xA;🗒️ Summary of this message: A scheme for creating a `keysend` protocol that allows for multipath payments is proposed, where the receiver can claim the payment once all parts have arrived.&#xA;📝 Original message:&#xA;Good morning list,&#xA;&#xA;I would like to share a simple scheme for creating a `keysend` protocol that allows for multipath payments.&#xA;&#xA;In `keysend`, the preimage is embedded as TLV 5482373484 with length 32.&#xA;&#xA;In the multipath case, we want the receiver to only be able to claim the payment once all parts have arrived at the receiver.&#xA;&#xA;For example, suppose we want to split the `keysend` into 2 parts.&#xA;Let us select a true preimage `p` at random.&#xA;Then, we generate the payment hash `h = SHA256(p)`.&#xA;&#xA;Then, we generate a new 256-bit scalar, `a`.&#xA;For one part, we send `a` for TLV 5482373484, and for the second part, we send `a ^ p`, where `^` is XOR.&#xA;All parts use the same payment hash `h`.&#xA;&#xA;The receiver, on receiving either part, will find that the supposed preimage does not match the actual HTLC payment hashes.&#xA;Instead of failing, it holds the payment, using the usual basic multipath payment rules.&#xA;&#xA;When the receiver receives another part, it will XOR together the supposed preimages.&#xA;In the above case, it would get `a` and `a ^ p`, which when XORed together result in `a ^ a ^ p` or `p`, which is now the correct preimage, and the receiver can now claim the entire complete funds.&#xA;&#xA;The same technique would work with any number of parts --- if we split into `n` parts, we generate `n - 1` additional random scalars and use it for the first `n - 1` parts, then XOR all of them with the scalar-to-be-split for the `n`th part.&#xA;This scheme also works for dynamic splitting, i.e. if you are splitting a part that was already split off from a part that was already split off from a part etc.&#xA;&#xA;A sender can detect if the receiver does not support multipath `keysend` if a part reaches the receiver and it errors with `incorrect_or_unknown_payment_details`.&#xA;If the receiver is aware of multipath `keysend`, it would hold onto the incoming HTLCs until MPP timeout, and instead error with `mpp_timeout`.&#xA;Thus, support for this on the receiver side does not need to be specially announced via a new feature bit --- an MPP-capable sender can simply try to split, and if it gets an `incorrect_or_unknown_payment_details`, knows that the receiver does not support multipath `keysend`.&#xA;The same feature bit 55 can be reused.&#xA;&#xA;Regards,&#xA;ZmnSCPxj</html></oembed>