HTLC Contracts
Lightning Network's Security Foundation
What is an HTLC?
A Hash Timelock Contract (HTLC) is a mechanism that allows conditional payments in Lightning Network. It requires presenting the preimage of a hash before a deadline; otherwise, the payment is reverted.
Key components
Hash and Preimage
The receiver generates a secret preimage and shares its hash. The payer locks the funds with that hash.
Time Lock
If the receiver doesn't reveal the preimage on time, the payment expires and the funds return to the sender.
How do they enable routed payments?
HTLCs allow payments to traverse multiple payment channels without direct trust between sender and receiver. Each hop only sees the hash and temporal conditions, maintaining security and privacy.
When a payment fails or times out, the channel closure mechanisms ensure funds are returned safely to the sender.
Ready to explore more?
Learn about BOLT standards and how they define Lightning Network protocol specifications.
Related Topics
- How Lightning Works - Technical overview
- Payment Channels - Opening and managing channels
- Channel Closure - Closing channels and disputes
- BOLT Standards - Protocol specifications