Research/Lightning

HTLC Resolution: How Lightning Payments Settle Across Multiple Hops

Hash Time-Locked Contracts are the atomic mechanism behind Lightning payments. How they chain across hops to ensure trustless multi-party settlement.

bcMaoDec 3, 2026

Every Lightning payment, no matter how fast it appears on a mobile screen, relies on a cryptographic primitive called a Hash Time-Locked Contract (HTLC). An HTLC is a conditional payment: it can be claimed by revealing a secret or refunded after a timeout expires. When chained across multiple forwarding nodes, HTLCs create an atomic corridor where either every participant gets paid or nobody does. Understanding how this mechanism works is essential for anyone building on the Lightning Network or evaluating its tradeoffs against other scaling approaches.

The HTLC Primitive

An HTLC combines two independent conditions into a single Bitcoin Script output. The first condition is a hash lock: the recipient can claim the funds by presenting a value (the preimage) whose hash matches a committed value. The second condition is a time lock: if the preimage is never revealed, the sender can reclaim the funds after a specified block height using OP_CHECKLOCKTIMEVERIFY.

In pseudocode, the spending conditions look like this:

  • Path A (success): provide preimage x such that SHA256(x) equals the committed hash y, plus the recipient's signature
  • Path B (timeout): wait until block height T, then provide the sender's signature

This creates a one-way ratchet. The recipient can settle at any time by revealing the preimage. The sender can only reclaim funds after the timeout. Neither party needs to trust the other: the script enforces the rules.

Atomicity from a single hash: The same hash value is used at every hop in a multi-hop payment. This shared secret is what binds the entire route together: if any participant reveals the preimage, every upstream participant can use it too. No coordinator is needed.

Building a Multi-Hop Payment

Consider a payment from Alice to Dave through two intermediaries, Bob and Carol. Alice does not have a direct payment channel with Dave, but a path exists: Alice → Bob → Carol → Dave. The routing algorithm has already identified this path using the network's gossip data.

Step 1: Dave Creates the Invoice

Dave generates a random 256-bit secret (the preimage, x) and computes its SHA-256 hash (y = SHA256(x)). He embeds y in a BOLT 11 invoice (or a BOLT 12 offer) and sends it to Alice. Dave keeps x secret: it is his proof of payment and the key that will unlock funds along the entire route.

Step 2: Alice Locks Funds Forward

Alice creates an HTLC in her channel with Bob: "Bob, I will pay you 1,000 satoshis if you can present the preimage of hash y before block 800,100. Otherwise, I get the funds back." She updates her commitment transaction with Bob to include this new HTLC output.

Step 3: Bob Forwards to Carol

Bob recognizes the payment is not for him (the onion-routed packet tells him where to forward). He creates a new HTLC in his channel with Carol using the same hash y, but with a shorter timeout and a slightly smaller amount (keeping his routing fee): "Carol, 999 satoshis if you present the preimage of y before block 800,060."

Step 4: Carol Forwards to Dave

Carol does the same: she creates an HTLC with Dave for 998 satoshis (keeping her fee), locked to hash y, with a timeout of block 800,020. At this point, three HTLCs exist along the route, all locked to the same hash but with decreasing timeouts and amounts.

Preimage Propagation: Settling Backward

Dave holds the preimage x. He presents it to Carol to claim the 998 satoshis from their shared HTLC. Carol now knows x, so she presents it to Bob to claim 999 satoshis. Bob presents it to Alice to claim 1,000 satoshis. The payment has settled, and each node has earned its routing fee.

This backward propagation is the critical insight. The hash lock ensures that revealing x at any point in the chain gives every upstream node the ability to settle. If Carol learns x from Dave, she can always claim from Bob, regardless of whether Bob cooperates: she has the preimage and can enforce the claim on-chain if necessary.

In practice, all of this happens in under a second. The commitment transactions are updated off-chain through the Lightning protocol's revocation mechanism, and no blockchain transaction is broadcast during normal operation.

CLTV Delta: Why Timeouts Decrement

The decreasing timeouts across hops are not arbitrary. They are a security mechanism called the CLTV delta, and getting them wrong can result in lost funds for forwarding nodes.

Each forwarding node needs a window of time between when its outgoing HTLC expires and when its incoming HTLC expires. This window guarantees that if the outgoing HTLC times out (meaning the downstream node never revealed the preimage), the forwarding node can reclaim those funds before its own incoming HTLC expires. Without this buffer, a forwarding node could lose funds in both directions: paying downstream via preimage revelation while being unable to claim upstream because the timeout already passed.

Default CLTV Delta Values

Each Lightning implementation advertises its own default CLTV delta via the channel_update gossip message defined in BOLT 7. These values differ across implementations:

ImplementationDefault CLTV DeltaApproximate Time
LND80 blocks~13 hours
Core Lightning (CLN)34 blocks~5.5 hours
Eclair144 blocks~24 hours

These defaults change over time. LND increased its default from 40 to 80 blocks in version 0.16.1. Node operators can configure custom values, trading safety (larger deltas) against capital efficiency and routing attractiveness (smaller deltas). As Bitcoin Optech notes, implementations tend to change these defaults over time and usually allow users to choose their own setting.

Timeout accumulation: The total worst-case lock time for a payment is the sum of all CLTV deltas along the route, plus the final hop's expiry. A four-hop route where each node uses 80 blocks means funds could be locked for 320+ blocks (over two days) if the payment fails at the last hop.

When a Hop Fails: The Timeout Cascade

What happens when Dave is offline and never reveals the preimage? The payment must unwind, and the HTLC timeout structure ensures it does so safely.

Carol's HTLC with Dave expires first (block 800,020). Carol can either reclaim funds cooperatively by updating the commitment transaction with Dave, or force-close the channel and claim the timed-out HTLC on-chain. Once Carol has recovered her funds, the same logic applies one hop backward: Bob's HTLC with Carol expires at block 800,060. Then Alice's HTLC with Bob expires at block 800,100.

Each node gets its funds back, but only after waiting out its respective timeout. This is the operational cost of HTLC-based routing: failed payments tie up liquidity for the duration of the timeout chain.

The Griefing Problem

An attacker can exploit this timeout structure by deliberately holding HTLCs without settling or failing them, a technique known as channel jamming. By locking up all available HTLC slots or channel capacity, the attacker can disable a node's ability to forward payments for the duration of the timeout. Research has shown that in the worst case, funds can be committed for extended periods on the order of days.

Several mitigations have been proposed, including reputation-based forwarding, circuit breakers, and upfront fees for HTLC slots. None has been universally adopted, and channel jamming remains an active area of Lightning research. See the channel jamming mitigation deep dive for more detail.

On-Chain Enforcement: HTLCs in Commitment Transactions

During normal operation, HTLCs live entirely off-chain as outputs within commitment transactions that are never broadcast. But if a channel partner becomes unresponsive or malicious, any party can force-close the channel by broadcasting its latest commitment transaction. At that point, every pending HTLC becomes a real on-chain output that must be resolved.

Offered and Received HTLC Outputs

The BOLT 3 specification defines two types of HTLC outputs on a commitment transaction. An offered HTLC is one the local node is paying out: it can be claimed by the remote party with the preimage, or reclaimed by the local party after the timeout. A received HTLC is the mirror: the local node can claim it with the preimage, or the remote party reclaims it after timeout.

Both output types are P2WSH (pay-to-witness-script-hash) with a witness script containing three spending paths:

  • Revocation path: spendable immediately by the counterparty using the revocation key (a penalty mechanism if an old, revoked commitment is broadcast)
  • Preimage path: spendable by the recipient upon revealing the preimage
  • Timeout path: spendable by the sender after the CLTV expiry

Second-Level Transactions

HTLC outputs on a commitment transaction are not spent directly to a party's wallet. Instead, they are spent through second-level transactions: HTLC-success (the preimage path) and HTLC-timeout (the timeout path). These second-level transactions impose an additional CSV (relative timelock) delay on the broadcaster's output, giving the counterparty time to issue a justice transaction if the commitment was revoked.

Transaction TypeWho BroadcastsConditionWhen Spendable
HTLC-successPreimage holder (receiver)Knows preimage x where SHA256(x) = yAny time before timeout
HTLC-timeoutHTLC offerer (sender)Timeout block height reachedAfter CLTV expiry
Justice (penalty)CounterpartyRevoked commitment broadcastDuring CSV delay of second-level tx

This two-level structure means resolving HTLCs on-chain requires at least two transactions per HTLC (the commitment plus the second-level spend), making force-closes with pending HTLCs expensive. A 2026 empirical study of roughly 974,000 Lightning channel closes confirmed that HTLC resolution adds significant on-chain cost compared to cooperative closes.

Anchor Outputs and Fee Management

A persistent challenge with on-chain HTLC resolution is fee estimation. Commitment transactions are pre-signed, so their fee rate is locked in at creation time. If the mempool becomes congested, the pre-set fee may be too low to confirm before the HTLC timeout.

Anchor outputs address this by adding small spendable outputs to the commitment transaction that either party can use to CPFP (child-pays-for-parent) bump the transaction's effective fee rate. The newer v3 transaction format and pay-to-anchor (P2A) design further simplify this by using a single shared anchor output and relying on package relay support in Bitcoin Core.

Practical Limits of HTLC Routing

HTLCs impose several practical constraints on Lightning payments beyond the timeout risk:

The 483-HTLC Limit

Each channel can carry at most 483 concurrent HTLCs in each direction. This limit exists because each pending HTLC adds an output to the commitment transaction, and Bitcoin consensus rules impose a maximum transaction weight. If a commitment transaction with more than 483 HTLC outputs were broadcast, it would exceed the standard transaction size limit and be rejected by the network. This ceiling is defined in BOLT 2 and exploitable via channel jamming attacks, where an attacker fills all slots with tiny, slow-settling HTLCs.

Trimmed HTLCs and the Dust Threshold

HTLCs below the dust limit (the minimum economically viable output value) are "trimmed": they are not included as separate outputs in the commitment transaction. Instead, their value is added to the transaction fee. This means that very small payments routed via HTLCs can be lost if a force-close occurs, since there is no on-chain output to claim. The trimmed HTLC threshold depends on the negotiated dust limit and current fee rates.

PTLCs: The Schnorr-Based Successor

HTLCs have a well-known privacy weakness: the same payment hash appears at every hop in the route. If two colluding nodes sit on the same payment path, they can correlate the payment by matching hashes, even though the onion routing conceals the full route.

Point Time-Locked Contracts (PTLCs) are the proposed successor. Instead of locking funds to a hash, PTLCs lock funds to an elliptic-curve point using adaptor signatures. Each hop uses a different point (derived by adding a random blinding factor), so no single value links the hops together. As Bitcoin Optech describes, a point lock can even be folded into an existing Schnorr signature, consuming no additional block space.

PTLCs became technically feasible after Taproot activated in November 2021, enabling native Schnorr signature support on Bitcoin. However, adopting PTLCs requires changes to Lightning's channel construction and routing protocols. As of late 2026, no mainnet Lightning implementation has shipped PTLC support, though research continues. For a deeper look, see the PTLCs: the next evolution of Lightning research article.

PropertyHTLCPTLC
Lock mechanismSHA-256 hash of preimageElliptic-curve point (adaptor signature)
Cross-hop correlationSame hash at every hop (linkable)Different point per hop (unlinkable)
On-chain footprintDistinct hash-check opcode in scriptCan fold into Schnorr signature (smaller)
Cryptographic requirementSHA-256 (available since Bitcoin launch)Schnorr signatures (requires Taproot)
Deployment statusProduction (all Lightning implementations)Research and development

Beyond HTLCs: How Spark Approaches Settlement

The HTLC mechanism is a remarkable piece of cryptographic engineering, but it carries inherent complexity: timeout chains that can lock liquidity for days, force-close scenarios requiring multiple on-chain transactions, a 483-slot limit per channel, and privacy-weakening hash correlation across hops. These are not bugs but fundamental properties of routing conditional payments through a channel network.

Spark takes a different approach entirely. Statechain transfers on Spark settle in a single atomic operation between sender and receiver, with no intermediate hops, no hash locks, and no timeout chains. The transfer updates key ownership via FROST threshold signatures rather than chaining conditional payments across a multi-party route. There is no CLTV delta to configure, no channel capacity to manage, and no griefing vector from held HTLCs.

For developers building on Bitcoin, Spark's SDK and documentation at docs.spark.money provide integration paths that avoid the HTLC complexity described in this article. For users, wallets like General Bread demonstrate what instant, self-custodial Bitcoin payments look like without channels or HTLCs. And for those who do need Lightning compatibility, Spark maintains native interoperability: payments flow between the two networks through atomic swaps with Spark Service Providers.

For more context on how Lightning routing works at the network level, see the Lightning Network routing deep dive. For a comparison of channel-based and channel-free scaling models, see rollup vs. state channel scaling tradeoffs.

This article is for educational purposes only. It does not constitute financial or investment advice. Bitcoin and Layer 2 protocols involve technical and financial risk. Always do your own research and understand the tradeoffs before using any protocol.