Hashed Timelock Contract (HTLC)
A smart contract construction that conditionally locks funds behind a cryptographic hash, releasing them only if the correct preimage is revealed before a deadline, or refunding them otherwise.
A Hashed Timelock Contract locks funds behind two conditions: the recipient must reveal a secret value (the "preimage") whose hash matches a specific target hash to claim the funds, and they must do so before a set deadline, after which the funds instead become refundable back to the original sender. This structure lets two parties who don't trust each other coordinate a conditional payment with cryptographic guarantees, rather than relying on either party's honesty.
HTLCs are the foundational mechanism behind routing payments across the Lightning Network's payment channels (see Kaavon's "Payment Channel" glossary definition), letting a payment hop safely across multiple intermediary channels, since each hop is only paid if it can also prove it relayed the payment correctly onward — and the same underlying hash-and-timelock structure underpins a submarine swap (see Kaavon's "Submarine Swap" glossary definition). A newer alternative structure called a Point Time-Locked Contract (see Kaavon's "Point Time-Locked Contract (PTLC)" glossary definition) achieves a similar goal with some privacy and efficiency improvements over a traditional HTLC.
Examples
- A Lightning Network payment routed across three intermediary nodes uses a chain of linked HTLCs, so each node is only paid if it successfully relays the payment and reveals the correct preimage onward.
- If the deadline on an HTLC passes without the correct preimage being revealed, the locked funds automatically become refundable to whoever originally locked them.
Learn more
The Lightning Network Explained
Read the full guide
Lightning Network
Read the Lightning Network glossary definition
Payment Channel
Read the Payment Channel glossary definition
Submarine Swap
Read the Submarine Swap glossary definition
Point Time-Locked Contract (PTLC)
Read the Point Time-Locked Contract (PTLC) glossary definition