CLTV Expiry Delta

The extra blocks a routing node demands between incoming and outgoing expiry, so it can claim safely.

Basically

It is the number of blocks a Lightning routing node keeps between the incoming and outgoing payment deadlines. The gap gives it time to claim the payment safely.

Key Takeaways

  • CLTV expiry delta is the safety buffer a Lightning forwarding node demands between its incoming and outgoing HTLC timelocks. It guarantees enough time to claim funds on-chain if a downstream peer settles.
  • Each hop in a payment route adds its own delta, so the total timelock accumulates from recipient back to sender. Longer routes lock sender funds for more blocks.
  • Implementations use different defaults: LND sets 80 blocks, about 13 hours, Core Lightning uses 34 blocks, and Eclair uses 144 blocks. The trade-off is safety versus capital efficiency and routing attractiveness.

What Is CLTV Expiry Delta?

CLTV expiry delta, also written cltv_expiry_delta, is the minimum number of Bitcoin blocks a Lightning Network forwarding node requires between the timelock on an incoming HTLC and the timelock on the corresponding outgoing HTLC. The value is defined per channel and broadcast through the BOLT #7 channel_update gossip message so that senders can build routes with correct timelocks.

Think of it as a reaction window between two linked contracts: one with the upstream peer, the incoming HTLC, and one with the downstream peer, the outgoing HTLC. If the downstream peer claims the outgoing HTLC by revealing the preimage, the forwarding node needs enough time to take that preimage and claim the incoming HTLC before it expires. The CLTV expiry delta is the size of that window, measured in blocks.

The name comes from Bitcoin's OP_CHECKLOCKTIMEVERIFY opcode, which enforces absolute block-height timelocks on HTLC outputs. The delta is the difference between two such timelocks at adjacent hops.

How It Works

Every HTLC in a Lightning payment carries a cltv_expiry value: the block height at which the HTLC times out and funds return to the sender. For a forwarding node, the incoming HTLC's expiry must be sufficiently larger than the outgoing HTLC's expiry. BOLT #4 specifies this forwarding rule.

If this condition is not met, the node must reject the HTLC. The delta gives the node time to respond to settlement.

The delta provides enough blocks for the forwarding node to observe the downstream settlement and react. This protection applies even if the settlement happens on-chain during a force close.

Accumulation Across Hops

Senders compute timelocks backwards from recipient to sender. Each hop adds its own delta to the running total. Consider a 4-hop route where the current block height is 800,000.

The sender's funds are locked for the full accumulated timelock. If the payment stalls or fails, the sender waits up to 276 blocks before the HTLC times out and funds are refunded. Pathfinding algorithms therefore penalise routes with large total timelocks because they represent longer capital lockup for the sender.

The Safety Formula

BOLT #2 provides a formula for calculating the minimum safe delta. The R factor accounts for blockchain reorganisations that could reverse settled transactions, while the G factor gives nodes time to detect and respond to on-chain events. The S factor provides a buffer for getting timeout or success transactions confirmed during periods of high fees, since HTLC transactions cannot always have their fees bumped after the fact, and it should be set conservatively because irregular block times, empty blocks, and sudden fee spikes can all delay confirmation.

Default Values by Implementation

Major Lightning implementations ship with different defaults, reflecting different risk tolerances. These defaults balance safety against capital efficiency and routing attractiveness.

For the final hop, the payment recipient, BOLT #11 specifies a default min_final_cltv_expiry_delta of 18 blocks if not explicitly set in the invoice. This was raised from 9 blocks after analysis showed thousands of mainnet channels were running dangerously low values.

Why It Matters

CLTV expiry delta directly affects three aspects of the Lightning Network that every node operator and wallet developer should understand. You should consider it when operating a node or developing a wallet.

For a deeper look at how routing decisions interact with channel parameters, see the Lightning Network routing deep dive. It examines the relationship between routing decisions and channel parameters.

Node Operator Configuration

Routing node operators tune their CLTV expiry delta based on their infrastructure, and a node with reliable uptime, redundant internet connections, and a dedicated watchtower can safely run a lower delta because it has more confidence in detecting and responding to on-chain events quickly. A node that goes offline periodically needs a higher delta to account for the time it might miss critical HTLC settlements.

In LND, you configure the delta with the bitcoin.timelockdelta parameter. This setting controls the timelock delta for your node.

Wallet Pathfinding

Lightning wallets use CLTV expiry delta values advertised by each channel to compute total route timelocks. A wallet building a route will sum the deltas along each candidate path and factor the total into its routing score alongside fee rates and channel capacity. Routes with lower total timelocks are preferred, all else being equal, because they reduce the sender's risk exposure.

Channel Management

When managing Lightning channels, the CLTV expiry delta interacts with other safety parameters. Nodes using anchor outputs have more flexibility to bump fees on commitment transactions, which can justify slightly lower deltas. Your overall approach to channel management should consider delta settings alongside reserve requirements and fee policies.

The Forwarding Risk

The fundamental risk that CLTV delta mitigates is a timing attack on forwarding nodes. If a forwarding node's delta is too small, this scenario becomes possible.

Replacement Cycling Attacks

Disclosed in October 2023, replacement cycling is an attack where a malicious peer repeatedly replaces the forwarding node's honest HTLC-claim transaction in the mempool. By cycling conflicting transactions, the attacker tries to prevent the honest transaction from confirming until the timelock expires. Longer CLTV deltas are a key mitigation because they give the forwarding node more attempts to get its transaction confirmed before the deadline.

Channel Jamming Amplification

Larger CLTV deltas can amplify channel jamming attacks. An attacker who sends payments that stall along a route locks up liquidity at each hop for the full timelock duration. Higher deltas mean each jammed HTLC ties up capital for longer, making the attack more effective per attempt.

Maximum Route Timelock

To limit exposure, implementations enforce a maximum total CLTV expiry for incoming HTLCs, which the BOLT specification standardised at 2,016 blocks, approximately two weeks. Any HTLC whose total timelock exceeds this limit is rejected. This cap means that routes with many hops or nodes running very high deltas may fail to find valid paths, since the accumulated delta would exceed the maximum.

Choosing the Right Value

There is no universally correct CLTV expiry delta. The right value depends on your node's specific circumstances.

For an in-depth discussion of how Bitcoin timelocks work at the protocol level, including both CLTV and CSV, see Bitcoin timelocks: CLTV and CSV explained. It covers both types of Bitcoin timelock.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.

0

← All 1876 glossary terms