What is a Hash Time Locked Contract?
If you’ve ever applied for a job in the digital age, you might have received a digital contract that will expire after a certain period of time should you not accept it. A Hash Time Locked Contract (HTLC) is a form of payment that operates in a similar way by implementing time-bound transactions in the crypto world.
The contract achieves this through the use of hashlocks and timelocks that require the receiver of the payment to acknowledge that they received the payment before a certain amount of time has passed and generate a cryptographic proof of payment. If the person receiving the money doesn’t create a proof of payment within a certain amount of time, they won’t receive it and the transaction will become void.
The HTLC agreement is named after the hashlock and timelock mechanisms because they play a very crucial role in the settlement of blockchain transactions.
What is a Hashlock?
Similar to how a smart contract works, a hashlock is a form of restriction that prevents an investment or purchase from completing until specific, predetermined rules are met. In the above example, the rule is that the proof of payment is generated after the receiver has confirmed they have received the payment.
What is a Timelock?
Similar to a hashlock, a timelock is a restricting mechanism that prevents a transaction completing or an account from being accessed until a certain time in the future.
Examples of HTLC in action include the Bitcoin Lightning Network, which implements HTLCs into its payment channels, allowing for money to be transferred between people through intermediaries even if they are not directly connected through one payment channel and atomic swaps.