From joost.jager at gmail.com Tue Sep 21 12:40:24 2021 From: joost.jager at gmail.com (Joost Jager) Date: Tue, 21 Sep 2021 14:40:24 +0200 Subject: [Lightning-dev] Stateless invoices with proof-of-payment In-Reply-To: <CAEjd=rqgp3KewOwOHHfhF75tP3KD0bXXijKVGsyY4--mbM0vgQ@mail.gmail.com> References: <CAJBJmV_nazFFf1SDhzo2gLRDe+ASChPxWKPM4zG9ObtyaXz6KQ@mail.gmail.com> <CAEjd=rqgp3KewOwOHHfhF75tP3KD0bXXijKVGsyY4--mbM0vgQ@mail.gmail.com> Message-ID: <CAJBJmV9JcVxE9nAir4WwR5A2Csum+PV-o4KqsqK5NLZBMRpZQg@mail.gmail.com> On Tue, Sep 21, 2021 at 2:05 PM fiatjaf <fiatjaf at gmail.com> wrote: > What if instead of the payer generating the preimage the payee could > generate stateless invoices? Basically just use some secret to compute the > preimage upon receiving the HTLC, for example: > Maybe my explanation wasn't clear enough, but this is exactly what I am proposing. The payee generates a stateless invoice and gives it to the payer. > 1. Payer requests an invoice. > 2. Payee computes hash = sha256(hmac(local_secret, arbitrary_invoice_id)), > then encodes arbitrary_invoice_id into the invoice somehow. > 3. Payer sends payment with arbitrary_invoice_id as tlv_record_a. > 4. Upon receiving the HTLC, payee computes preimage = hmac(local_secret, > tlv_record_a) and resolves it. > One way to do this that I tried to describe in the initial post is via the payment_secret. This is already an arbitrary invoice id that is already sent as a tlv record. > I've implemented such a scheme on @lntxbot, but it required low level code > in a c-lightning plugin and a hack with route hints: since TLV payloads > were not an option (as payers wouldn't know how to send them) I've used a > "shadow" route hint to a private channel that didn't exist, so preimage was > generated on the payee using preimage = hmac(local_secret, > next_channel_scid). > Clever workaround. Joost -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20210921/8f1a2a53/attachment.html>