The term Hashed TimeLock Contract (HTLC) refers to a special feature that is used to create smart contracts
that are able to modify payment channels. Technically, the HTLC feature enables the implementation of time-bound transactions between two users. In practice, the recipient of a HTLC transaction has to acknowledge the payment by submitting a cryptographic proof within a specified timeframe (number of blocks). If the recipient forfeits or fails to claim the payment, the funds will be returned to the original sender.
The HTLC feature is applied in both bidirectional and routed payment channels to allow the secure transfers of funds over various channels, without requiring trust on any of the intermediaries.
There are two key elements which distinguish HTLC from standard cryptocurrency transactions, which are:
The Bitcoin Lightning Network
is among the most popular use cases of Hashed Timelocked Contracts. By implementing HTLC into payment channels, funds can be transacted from user to user through interconnected payment channels, without requiring any level of trust. This process is known as network routing. It allows Alice to exchange funds with Carol even if they are not directly connected through a payment channel. HTLC’s enable Alice to send her funds to Carol through other participants of the network (e.g., Bob) - and the hashlock and timelock features ensure that Bob cannot intercept the funds.
Besides being used on the Lightning Network, HTLCs can also be useful in other contexts, such as cross-chain atomic swaps
, financial smart contracts and escrow, and much more.