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.
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:
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.
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.
The main problem that HTLC solves is the risk of transacting. The contract greatly reduces the counterparty risk through hashlock and timelock mechanisms.
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.
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.
Join the thousands already learning crypto!