Hashed Timelock Contracts: Trustless Transactions in Crypto

Hashed Timelock Contract (HTLC) is an agreement between two parties that does not require trust between two users, offering special risk mitigation features.

What is a Hashed Timelock Contract ?

HTLC is a distinctive feature in the form of a time-locked escrow (timelock) that is most commonly used in the creation of smart contracts that allow creators to modify payment channels.
This is an agreement in which the receipt must be acknowledged by the recipient or beneficiary before a set date or deadline. If it is not, the recipient loses the ability to claim payment. The recipient must acknowledge the payment before the deadline.

There are two main terms to be aware of in HTLC:

  • Timelock is a feature that restricts any transactions until the recipient confirms payment before a predetermined time. The function is activated by Bitcoin commands. If it is not, the paying party can request a refund.
  • Hashlock is a passphrase required to claim funds. The recipient must enter the correct specific phrase in order to access the funds.

The HTLC feature is used for transfers over bi-directional and routable channels, providing security. The contract can work without the trust of either party.

How does HTLC work?

Hashlock and Timelock are key components required in a contract.

First of all, the paying party creates the passphrase code and hashes it. Hashlock is the phase that is the limiting mechanism. The hash is protected until the final transaction occurs.

A timelock mechanism is then used to limit future transactions by setting a timelock. One of the timelocks is called the Check Lock Time verify. This lock establishes a baseline time to release and limit funds. The next lock is known as Check Sequence Verify, this timelock counts the number of locks created.

Application of HTLC

HTLC is most commonly used in the Bitcoin Lightning network to conduct transactions through interconnected channels.

The main problem users face with p2p transactions is trust. HTLC solves this problem because it does not require trust from either party. It allows two users to make transactions without being directly linked to each other through a payment channel.

HTLC allows other users to facilitate transactions, while Hashlock and Timelock do not allow other users to hinder transactions.

Benefits of HTLC

  • HTLC solves a problem such as transaction risk. The contract reduces counterparty risk through hashlock and timelock mechanisms.
  • These swaps are smart contracts that eliminate the need for middlemen or exchanges through the use of hashlock contracts.
  • With timelock, contracts are settled at pre-defined times, which also eliminates delays in contract settlement.
Related terms