Hodl Invoice
A Lightning invoice that stays unsettled until the receiver acts, which gives the network escrow-like conditional payments.
Basically
With a hodl invoice on the Lightning Network, the receiver can wait before completing a payment. You can use it for escrow-like payments that only complete when agreed conditions are met.
Key Takeaways
- Hodl invoices delay payment settlement. Standard Lightning invoices settle instantly, but the receiver of a hodl invoice decides when, or if, to finalise the payment. This creates a window for conditional logic.
- Hodl invoices use HTLCs with manual preimage release. The receiver generates the preimage but withholds it until conditions are met. They can settle by releasing the preimage or cancel by letting the HTLC expire, based on external factors.
- Hodl invoices enable escrow without trusted third parties. They power marketplace escrow, atomic swaps, submarine swaps, and any scenario requiring conditional payment release on Lightning.
What Is a Hodl Invoice?
A hodl invoice, sometimes spelled "hold invoice", is a Lightning Network invoice where the receiver controls when the payment settles. In a standard Lightning payment, the receiver releases the preimage immediately upon receiving the HTLC, and the payment completes in milliseconds. With a hodl invoice, the receiver deliberately holds the HTLC open, creating a pending state that can last minutes, hours, or until timeout.
Delayed settlement turns Lightning from a pure payment rail into a programmable money layer. The receiver can inspect conditions, verify external events, or coordinate with other systems before deciding to accept or reject the payment.
The name comes from the crypto meme "HODL", meaning "hold on for dear life", repurposed here to describe holding a payment in limbo. The receiver "hodls" the HTLC until they are ready to settle or cancel.
How It Works
Hodl invoices build on standard Lightning payments. A normal payment works as follows:
The entire process takes seconds because the receiver reveals the preimage immediately upon receiving the HTLC. No decision point exists.
Hodl invoices modify step 4. Instead of immediately revealing the preimage, the receiver:
The sender's funds stay locked in the HTLC chain during the hold period. The sender cannot spend those sats elsewhere, but the receiver has not claimed them yet. This creates a trustless escrow state enforced by the HTLC timelock.
The Three Possible Outcomes
Every hodl invoice resolves in one of three ways:
Why Use Hodl Invoices?
Standard Lightning invoices work perfectly for simple payments where trust exists or is not needed. You buy coffee, pay the invoice, and receive your coffee. The instant settlement matches the instant delivery.
Many transactions require conditionality. You may want to pay only if something happens, or coordinate payment across multiple systems. Hodl invoices enable these patterns:
Trusted intermediaries are needed for these patterns without hodl invoices. HTLC mechanics provide trustless enforcement with hodl invoices.
Technical Implementation
Hodl invoice implementations require control over preimage handling at the node level. Most Lightning implementations support this through specific APIs:
LND Implementation
LND provides hodl invoice support through its invoicesrpc subserver. The key difference from regular invoices is that you provide the payment hash externally instead of letting LND generate it.
The application stores the preimage securely and only calls settleinvoice when conditions are met. If conditions fail, calling cancelinvoice releases the sender's funds immediately rather than waiting for timeout.
Core Lightning Implementation
CLN supports hodl invoices through the hold plugin:
Application Architecture
A typical hodl invoice flow in an application:
Marketplace Escrow
Peer-to-peer marketplaces face the classic escrow problem: buyers want to pay after receiving goods, while sellers want payment before shipping. Traditional solutions require trusted intermediaries who hold funds.
Hodl invoices provide trustless escrow:
The HTLC times out and the buyer recovers funds if the buyer disputes or the seller never ships. No intermediary holds the money at any point.
Atomic Swaps
Atomic swaps exchange assets across different systems, such as chains and layers, with guaranteed atomicity: either both sides complete or neither does. Hodl invoices enable the Lightning leg of these swaps.
An example is swapping on-chain Bitcoin for Lightning sats:
The shared hash links both transactions. Neither party can cheat because claiming one side reveals the secret needed for the other.
Submarine Swaps
Submarine swaps move funds between on-chain Bitcoin and Lightning. Services like Loop and Boltz use hodl invoices to make these swaps trustless. The hodl invoice holds the Lightning payment while the on-chain transaction confirms, then settles atomically.
Conditional Payments
Any payment conditional on external events can use hodl invoices:
Channel Liquidity Lock
The sender's funds are locked while a hodl invoice is pending. More importantly, every routing node along the path also has liquidity locked in their HTLCs. Extended hold times reduce network-wide liquidity and can strain routing nodes.
Routing nodes may reject HTLCs with long timelocks or from sources known to create long-held HTLCs. Some nodes set maximum HTLC hold times and will fail HTLCs that exceed them.
Griefing Attacks
Malicious receivers can create hodl invoices and never settle, locking sender funds until timeout. This "griefing attack" costs the attacker nothing but locks victim liquidity for hours or days.
Mitigations include reputation systems, requiring deposits, and using shorter HTLC timeouts. The Lightning Network community continues developing solutions like HTLC endorsement to address this.
Timeout Risks
The receiver loses the payment entirely if they fail to settle before the HTLC timeout. Applications using hodl invoices need monitoring and alerting. A system crash during the hold period could mean lost funds.
Implementation Complexity
Hodl invoices require careful state management. Applications must track preimages, monitor HTLC states, handle edge cases such as partial payments and retries, and manage timeouts correctly. Bugs can result in stuck payments or lost funds.