<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:2021-12-16&#xA;📝 Original message:&#xA;Good morning William,&#xA;&#xA;&#xA;&gt; Has anyone coded up a &#39;Poor man&#39;s rendez-vous&#39; demo yet? How hard would&#xA;&gt; it be, could it be done with a clightning plugin perhaps?&#xA;&#xA;Probably not *yet*; it needs each intermediate payee (i.e. the one that is not the last one) to sign an invoice for which it does not know the preimage.&#xA;Maybe call such a command `signfakeinvoice`.&#xA;&#xA;However, if a command to do the above is implemented (it would have to generate and sign the invoice, but not insert it into the database at all), then intermediate payees can use `htlc_accepted` hook for the &#34;rendez-vous&#34;.&#xA;&#xA;So to generate the invoice:&#xA;&#xA;* Arrange the payees in some agreed fixed order.&#xA;* Last payee generates a normal invoice.&#xA;* From last payee to second, each one:&#xA;  * Passes its invoice to the previous payee.&#xA;  * The previous payee then creates its own signed invoice with `signfakeinvoice` to itself, adding its payout plus a fee budget, as well as adding its own delay budget.&#xA;  * The previous payee plugin stores the next-payee invoice and the details of its own invoice to db, such as by `datastore` command.&#xA;* The first payee sends the sender the invoice.&#xA;&#xA;On payment:&#xA;&#xA;* The sender sends the payment to the first hop.&#xA;* From first payee to second-to-last:&#xA;  * Triggers `htlc_accepted` hook, and plugin checks if the incoming payment has a hash that is in this scheme stored in the database.&#xA;  * The plugin gathers `htlc_accepted` hook invocations until they sum up to the expected amount (this handles multipath between payees).&#xA;  * The plugin marks that it has gathered all `htlc_accepted` hooks for that hash in durable storage a.k.a. `datastore` (this handles a race condition where the plugin is able to respond to some `htlc_accepted` hooks, but the node is restarted before all of them were able to be recorded by C-Lightning in its own database --- this makes the plugin skip the &#34;gathering&#34; step above, once it has already gathered them all before).&#xA;  * The plugin checks if there is already an outgoing payment for that hash (this handles the case where our node gets restarted in the meantime --- C-Lightning will reissue `htlc_accepted` on startup)&#xA;    * If the outgoing payment exists and is pending, wait for it to resolve to either success or failure.&#xA;    * If the outgoing payment exists and succeeded, resolve all the gathered `htlc_accepted` hooks.&#xA;    * If the outgoing payment exists and failed, fail all the gathered `htlc_accepted` hooks.&#xA;    * Otherwise, perform a `pay`, giving `maxfeepercent` and `maxdelay` based on its fee budget and delay budget.&#xA;      When the `pay` succeeds or fails, propagate it to the gathered `htlc_accepted` hooks.&#xA;* The last payee just receives a normal payment using the normal invoice-receive scheme.&#xA;&#xA;Regards,&#xA;ZmnSCPxj</html></oembed>