<p>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:</p>

<p>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. </p>

<p>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. </p>

<p>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. </p>

<p>Excited to see if other reasons pop up and excellent question</p>

CC BY-SA 4.0
2019-04-11T23:27:55.187Z
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
CC BY-SA 4.0
2019-04-20T22:43:29.057Z
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
CC BY-SA 4.0
2019-04-22T04:26:21.530Z
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
CC BY-SA 4.0
2019-04-11T20:47:23.360Z
2019-04-11T20:47:23.360Z
Rene Pickhardt
<p>I'm considering the development of a lightning app, and I'm trying to make it non custodial.</p>

<p>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.</p>

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

<p><strong>Why do lightning invoices have an expiry date?</strong></p>

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

<lightning-network><invoices>
Why do lightning invoices expire?
Enrique Alcazar
# Why do lightning invoices expire?

(Asked by: username_0 on 2019-04-11)

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?**

**Tags:** lightning-network, invoices


---

## 1 answers

### Answer by username_1 on 2019-04-11. Score: 7 | Accepted answer

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

> **Comments:**
> **username_0**: 2 excellent points: delete the stale ones for efficiency and have a way to know when they have been deleted by the receiver  
> **username_2**: 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.  
> **username_1**: 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  

---

