Stateless invoices with proof-of-payment



Summary:

The Lightning network can provide light-weight, no-login payments with minimal friction, but optimistically presenting payment requests leads to many of those payment requests going unused. The conventional approach is to create a lightning invoice on a node and store the invoice together with order details in a database. However, this setup needs protection against unbounded generation of payment requests. Stateless invoices could be a solution to this problem. With stateless invoices, invoices can be generated without the need to keep any state at all.To generate stateless invoices, the recipient does not need to know whom or what the payment is for, and they do not know the preimage that is needed to settle the htlc(s). To solve these problems, additional custom tlv records can be attached to the htlc, which would enable the recipient to encode the order details. Alternatively, part of the payment_secret (aka payment address) can be used to encode the order details. For the second problem, a deterministic preimage based on a (recipient node key-derived) secret, the payment secret, and other relevant properties can be used.Resilience can be achieved by implementing just-in-time inserted invoices to keep the difference small. Stateless invoices can be a simple way to improve the resiliency of systems that deal with lightning invoices. Unlimited amounts of invoices can be generated without worrying about storage or memory, regardless of whether the requests are due to popularity of a service or a deliberate dos attack.


Updated on: 2023-05-23T16:12:59.827874+00:00