Community Forex Questions
What is a hashed timelock contract (HTLC)?
A hashed timelock contract (HTLC) is a type of smart contract used in blockchain systems to enable secure and trustless transactions between parties, especially in cross-chain exchanges like atomic swaps. It combines two key components: a hashlock and a timelock, which work together to ensure that funds are only transferred when specific conditions are met.

The hashlock requires the receiver to provide a secret cryptographic key (called a preimage) that matches a previously agreed-upon hash. This ensures that only the intended recipient can claim the funds. Once the recipient reveals the correct secret, the transaction is completed, and the funds are released.

The timelock adds a time-based condition to the contract. If the recipient does not provide the correct secret within a specified time, the transaction is automatically reversed, and the funds are returned to the sender. This protects both parties from the risk of one side failing to complete the deal.

HTLCs are widely used in atomic swaps, where two users exchange cryptocurrencies across different blockchains without relying on a centralised exchange. They are also a core component of off-chain scaling solutions like payment channels.

In summary, HTLCs provide a secure, trustless mechanism for conditional payments, ensuring that transactions either complete successfully or are safely cancelled without loss to either party.

Add Comment

Add your comment