6

I'm considering the development of a lightning app, and I'm trying to make it non custodial.

I was thinking on pre-generating invoices for all users every x time to make things simpler. To do that I'd need to extend the expiry date.

I tried to look up why do lightning invoices expire, and I couldn't find a clear answer.

Why do lightning invoices have an expiry date?

Is it to ensure that they are not kept forever in the receivers DB? or is there another reason?

5

The bolt 11 which specifies invoices does not give a rational for this design choice therefor - unless one of the people who build it come along - I can only give an educated guess:

So first of all if invoices were valid for an arbitrary time the recipient would have to keep an arbitrary amount of preimages running eventually into memory / Harddisk issues. I guess this is the single most important reason.

As another one lightning payments and routing with htlcs is an Atomic process it either works or it doesn't. Giving a constrained timebound you can decide afterwords for sure what the result was. If the expiry is arbitrary it could always be the case that the payment has just not been initiated yet.

Last I can imagine that sending nodes would eat up htlcs and the recipient might have already deleted the preimage (without expiry time) In this case the network also has unnecessary load.

Excited to see if other reasons pop up and excellent question

  • 2 excellent points: delete the stale ones for efficiency and have a way to know when they have been deleted by the receiver – Enrique Alcazar Apr 11 at 23:27
  • 1
    Another reason is that even non-Bitcoin businesses put expirations on their traditional-currency invoices so that they're not obligated to deliver goods in the future at the prices they offered in the past. With digital currencies, this is even more important because of exchange rate volatility. – David A. Harding Apr 20 at 22:43
  • Of that is a good one! Do you mind me edditing this into my response? Also interestingly this is like the free call option Problem described by ZmnSCPxj and cjp – Rene Pickhardt Apr 22 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.