Bitget App
Trade smarter
Buy cryptoMarketsTradeFuturesCopyBotsEarn

Hashed TimeLock Contract (HTLC)

Advanced
share

A Hashed Timelock Contract (HTLC) helps facilitate secure and trustless transactions between parties. This mechanism is an advanced type of smart contract that combines the concepts of hashlocks and timelocks to ensure that transactions occur within a specific timeframe and only if certain conditions are met. HTLCs are particularly useful in complex scenarios such as the Bitcoin Lightning Network and cross-chain atomic swaps, where they significantly reduce risks and eliminate the need for intermediaries.

What Is Hashed Timelock Contract (HTLC)?

At its core, an HTLC involves two main components: the hashlock and the timelock. The hashlock requires the recipient of a transaction to provide a cryptographic proof, known as a pre-image, to unlock the funds. This ensures that the transaction can only be completed if the recipient has the correct secret. On the other hand, the timelock sets a deadline for the transaction. If the recipient fails to provide the necessary proof within the specified time, the funds are returned to the sender, ensuring that no money is lost.

HTLCs are widely used in the Bitcoin Lightning Network, a second-layer solution designed to facilitate faster and cheaper transactions. By using HTLCs, the Lightning Network enables users to send funds through multiple interconnected channels without requiring trust between them. This allows for efficient and secure transactions, even if the users are not directly connected.

Another application of HTLCs is in atomic swaps, which are smart contracts that allow for the direct exchange of different cryptocurrencies without the need for a centralized exchange. By utilizing HTLCs, atomic swaps ensure that both parties in the transaction fulfill their obligations simultaneously, reducing the risk of fraud.

Download app
Download app