HTLC
Also · Hashed timelock contract · Hashlock
An HTLC is a Bitcoin contract that pays whoever reveals a secret before a deadline, and refunds the sender after. It is how Lightning routes payments across several hops safely.
A hashed timelock contract combines 2 conditions. The funds go to the recipient if they present the preimage of a given hash, the secret. If the secret is not revealed before a timelock expires, the funds return to the sender. Nobody needs to trust anybody. Either the secret is shown and everyone along the way gets paid, or the deadline passes and everyone is refunded.
Lightning chains these contracts across a route. The final recipient generates the secret and shares only its hash. Each hop forwards an HTLC locked to that hash with a slightly shorter deadline. When the recipient claims the last one, the secret propagates backwards and each hop settles in turn. The same primitive powers atomic swaps between chains and layers.
In French · HTLC
