On Tue, Sep 21, 2021 at 2:05 PM fiatjaf <fiat...@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
_______________________________________________ Lightning-dev mailing list Lightning-dev@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev