Home
Glossary
Hashed Timelock Contract (HTLC)
A hashed timelock contract (HTLC) is an agreement between two parties that requires no trust between two users by offering special features to reduce risk.
What Is Hashed Timelock Contract (HTLC)?
In basic terms, it is an agreement in which the receipt must be confirmed by the receiver or the beneficiary before a preset date or deadline, and failing to do so will result in the receiver losing the ability to claim the payment. The receiver must acknowledge the payment before the deadline.
There are two main terms that you should know in a hashed timelock contract:
-
Timelock – It is a function that limits any transacting from the funds of the contract until the receiver affirms the payment before a pre-decided time. This is enabled using Bitcoin commands. If this is not done, the paying party can claim a refund.
-
Hashlocks – This is a passphrase to claim the funds. The recipient must input the correct phase to gain access to the funds.
The hashed timelock contract feature is used for safe transfers through bidirectional and routed channels, the contract functions without any trust from either party.
How Does the Hashed Timelock Contract Work?
The hashlocks and timelocks are the most pivotal and important components that come into play while settling the contract.
Firstly, the paying party generates a code or password phase and hashes the code. This is known as the hashlock phase which is the restricting mechanism. The hash is protected until the final transaction takes place.
Next, the timelock mechanism is used by setting a set of timelocks to restrict future transactions. One of the timelocks is called a Check Lock Time verify. This sets a base time to release and limit the funds. The next timelock is known as Check Sequence Verify, this timelock keeps a count of the number of locks created to aid with finalizing the transaction.
Application of Hashed Timelock Contract
Advantages
Reduced Risk
The main problem that HTLC solves is the risk of transacting. The contract greatly reduces the counterparty risk through hashlock and timelock mechanisms.
Atomic Swaps
Going by the name, these swaps are smart contracts that remove the need for any intermediaries or exchanges with the help of hashed timelock contracts.
Reduced Delays
With the help of the timelock mechanism, the contracts are settled on a pre-determined deadline which eliminates the chances of a delay in the settlement of the contracts.