<oembed><type>rich</type><version>1.0</version><title>Christian Decker [ARCHIVE] wrote</title><author_name>Christian Decker [ARCHIVE] (npub1wt…gtuyn)</author_name><author_url>https://njump.me/npub1wtx5qvewc7pd6znlvwktq03mdld05mv3h5dkzfwd3dc30gdmsptsugtuyn</author_url><provider_name>njump</provider_name><provider_url>https://njump.me</provider_url><html>📅 Original date posted:2021-12-17&#xA;📝 Original message:&#xA;I was looking into the docs [1] and stumbled over `createinvoice` which&#xA;does almost what you need. However it requires the preimage, and stores the&#xA;invoice in the database which you don&#39;t want.&#xA;&#xA;However if you have access to the `hsm_secret` you could sign in the plugin&#xA;itself, completely sidestepping `lightningd`. Once you have that it should&#xA;be a couple of days work to get a PoC plugin for the coordination and&#xA;testing. From there it depends on how much polish you want to apply and&#xA;what other systems you want to embed it into.&#xA;&#xA;Each recipient will have to run the plugin otherwise they&#39;d not understand&#xA;how to handle the payment, and creating an invoice requires a bit more work&#xA;(each payee needs to coordinate to be part of the Rendez-vous), but from&#xA;the senders point of view it&#39;s all seamless.&#xA;&#xA;As for whether this is better suited for the protocol itself: could be,&#xA;probably not though. We let everybody experiment and then formalize and&#xA;standardize the best ideas from the community, so it may make its way into&#xA;the spec, but would need to be implemented, tested and popular enough to&#xA;warrant everybody having to implement yet another feature. In this case&#xA;it&#39;s more for a bLiP, which are less formal and better match the fact that&#xA;only a small part of the network needs to implement it (only payees need to&#xA;coordinate and forward, senders and everybody else doesn&#39;t care).&#xA;&#xA;Cheers,&#xA;Christian&#xA;&#xA;[1] https://lightning.readthedocs.io/lightning-createinvoice.7.html&#xA;&#xA;&#xA;On Fri, 17 Dec 2021, 11:22 Ronan McGovern, &lt;Ronan at trelis.com&gt; wrote:&#xA;&#xA;&gt; Hi ZmnSCPxj,&#xA;&gt;&#xA;&gt; So, are you saying there needs to be a new command &#34;signfakeinvoice&#34; at&#xA;&gt; the protocol level?&#xA;&gt;&#xA;&gt; If that was there, how much work/hours would it be to build the poor man&#39;s&#xA;&gt; rendez-vous at the application level?&#xA;&gt;&#xA;&gt; If the above were to be implemented, when the payer pays the invoice, it&#39;s&#xA;&gt; then automatically split and sent to two (or more) recipients?&#xA;&gt;&#xA;&gt; Lastly, would it make more sense to have split payments at the protocol&#xA;&gt; level?&#xA;&gt;&#xA;&gt; Thanks, Ronan&#xA;&gt;&#xA;&gt; On Thu, Dec 16, 2021 at 11:44 PM ZmnSCPxj &lt;ZmnSCPxj at protonmail.com&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; Good morning William,&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; &gt; Has anyone coded up a &#39;Poor man&#39;s rendez-vous&#39; demo yet? How hard would&#xA;&gt;&gt; &gt; it be, could it be done with a clightning plugin perhaps?&#xA;&gt;&gt;&#xA;&gt;&gt; Probably not *yet*; it needs each intermediate payee (i.e. the one that&#xA;&gt;&gt; is not the last one) to sign an invoice for which it does not know the&#xA;&gt;&gt; preimage.&#xA;&gt;&gt; Maybe call such a command `signfakeinvoice`.&#xA;&gt;&gt;&#xA;&gt;&gt; However, if a command to do the above is implemented (it would have to&#xA;&gt;&gt; generate and sign the invoice, but not insert it into the database at all),&#xA;&gt;&gt; then intermediate payees can use `htlc_accepted` hook for the &#34;rendez-vous&#34;.&#xA;&gt;&gt;&#xA;&gt;&gt; So to generate the invoice:&#xA;&gt;&gt;&#xA;&gt;&gt; * Arrange the payees in some agreed fixed order.&#xA;&gt;&gt; * Last payee generates a normal invoice.&#xA;&gt;&gt; * From last payee to second, each one:&#xA;&gt;&gt;   * Passes its invoice to the previous payee.&#xA;&gt;&gt;   * The previous payee then creates its own signed invoice with&#xA;&gt;&gt; `signfakeinvoice` to itself, adding its payout plus a fee budget, as well&#xA;&gt;&gt; as adding its own delay budget.&#xA;&gt;&gt;   * The previous payee plugin stores the next-payee invoice and the&#xA;&gt;&gt; details of its own invoice to db, such as by `datastore` command.&#xA;&gt;&gt; * The first payee sends the sender the invoice.&#xA;&gt;&gt;&#xA;&gt;&gt; On payment:&#xA;&gt;&gt;&#xA;&gt;&gt; * The sender sends the payment to the first hop.&#xA;&gt;&gt; * From first payee to second-to-last:&#xA;&gt;&gt;   * Triggers `htlc_accepted` hook, and plugin checks if the incoming&#xA;&gt;&gt; payment has a hash that is in this scheme stored in the database.&#xA;&gt;&gt;   * The plugin gathers `htlc_accepted` hook invocations until they sum up&#xA;&gt;&gt; to the expected amount (this handles multipath between payees).&#xA;&gt;&gt;   * The plugin marks that it has gathered all `htlc_accepted` hooks for&#xA;&gt;&gt; that hash in durable storage a.k.a. `datastore` (this handles a race&#xA;&gt;&gt; condition where the plugin is able to respond to some `htlc_accepted`&#xA;&gt;&gt; hooks, but the node is restarted before all of them were able to be&#xA;&gt;&gt; recorded by C-Lightning in its own database --- this makes the plugin skip&#xA;&gt;&gt; the &#34;gathering&#34; step above, once it has already gathered them all before).&#xA;&gt;&gt;   * The plugin checks if there is already an outgoing payment for that&#xA;&gt;&gt; hash (this handles the case where our node gets restarted in the meantime&#xA;&gt;&gt; --- C-Lightning will reissue `htlc_accepted` on startup)&#xA;&gt;&gt;     * If the outgoing payment exists and is pending, wait for it to&#xA;&gt;&gt; resolve to either success or failure.&#xA;&gt;&gt;     * If the outgoing payment exists and succeeded, resolve all the&#xA;&gt;&gt; gathered `htlc_accepted` hooks.&#xA;&gt;&gt;     * If the outgoing payment exists and failed, fail all the gathered&#xA;&gt;&gt; `htlc_accepted` hooks.&#xA;&gt;&gt;     * Otherwise, perform a `pay`, giving `maxfeepercent` and `maxdelay`&#xA;&gt;&gt; based on its fee budget and delay budget.&#xA;&gt;&gt;       When the `pay` succeeds or fails, propagate it to the gathered&#xA;&gt;&gt; `htlc_accepted` hooks.&#xA;&gt;&gt; * The last payee just receives a normal payment using the normal&#xA;&gt;&gt; invoice-receive scheme.&#xA;&gt;&gt;&#xA;&gt;&gt; Regards,&#xA;&gt;&gt; ZmnSCPxj&#xA;&gt;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20211217/ad84b53b/attachment-0001.html&gt;</html></oembed>