Hashed Timelock Contract (HTLC)
Abbreviation: HTLC
Pronunciation: HASHD TIME-lock KON-trakt
Also known as: Hash Time-Locked Contract, Hash Time Lock Contract, HTLC
Definition
A hashed timelock contract is a conditional payment mechanism that releases funds when a recipient reveals a secret value matching a known hash before a deadline; otherwise, a refund path becomes available after the timeout. HTLCs connect payment across channels or chains without requiring both sides to trust an intermediary, but they require careful timeout ordering, liquidity, fee, and failure management.
Overview
A Hashed Timelock Contract (HTLC) combines a hash condition with a time condition. The payer commits to the hash of a secret. The recipient claims the funds by revealing the matching preimage before the deadline, while the sender can recover the funds through a separate path after the timelock expires.
In the Lightning Network, connected channels use related HTLCs so one revealed preimage can complete a routed payment across several participants. Each hop knows the payment hash but not the secret until fulfillment. Timelocks are staggered so intermediaries have time to claim incoming funds after paying the next hop.
HTLCs can also support atomic-swap designs across compatible chains. If one party claims an asset by revealing the secret, the other party learns the same preimage and can claim the corresponding asset. If no claim occurs, timeouts return funds. Compatibility depends on hash functions, scripting capabilities, and reliable observation.
The mechanism does not eliminate all operational risk. Incorrect timeout ordering, insufficient channel liquidity, fee changes, dust limits, offline nodes, or chain congestion can cause failure. Privacy is also limited because repeated payment hashes and timing relationships can reveal information unless the protocol adds stronger protections.
HTLC settlement is a conditional State Transition, not immediate finality. Systems must track offered, fulfilled, failed, and timed-out states and preserve the preimage securely. Payment applications should not treat the route as complete until the relevant channel and, when necessary, on-chain enforcement conditions are resolved. Operational implementations normally express this lifecycle through a State Machine and record each conditional Value Transfer separately.
Key Takeaway
An HTLC makes payment conditional on revealing a hash preimage before a deadline, enabling trust-minimized routing or swaps while introducing timeout and liquidity requirements.
Sources
- BOLT 0: Lightning Network Introduction — Lightning Network Specifications (2026-08-02)
- BOLT 3: Bitcoin Transaction and Script Formats — Lightning Network Specifications (2026-08-02)
- Bitcoin Developer Guide: Transactions — Bitcoin Developer Documentation (2026-08-02)