Skip to content

Indian Exam Hub

Building The Largest Database For Students of India & World

Menu
  • Main Website
  • Free Mock Test
  • Fee Courses
  • Live News
  • Indian Polity
  • Shop
  • Cart
    • Checkout
  • Checkout
  • Youtube
Menu

Hashed Timelock Contract

Posted on October 17, 2025October 22, 2025 by user

Hashed Timelock Contract (HTLC)

A Hashed Timelock Contract (HTLC) is a type of smart contract used in blockchain systems to enable conditional, time-limited transfers. HTLCs reduce counterparty risk by combining cryptographic proof (a hashlock) with a deadline (a timelock). They are a core mechanism for atomic swaps and off-chain payment networks like the Lightning Network.

Key takeaways
* HTLCs require a cryptographic secret (preimage) to unlock funds and impose a deadline after which funds can be reclaimed if the secret isn’t revealed.
* They enable atomic, cross-chain exchanges and conditional payments without trusting a third party.
* Common timelock mechanisms are CheckLockTimeVerify (CLTV) and CheckSequenceVerify (CSV).

Explore More Resources

  • › Read more Government Exam Guru
  • › Free Thousands of Mock Test for Any Exam
  • › Live News Updates
  • › Read Books For Free

How an HTLC works
* Hashlock: The sender creates a secret and publishes its hash (the lock). The recipient must reveal the secret’s preimage to claim the funds. Revealing the preimage on one chain can be used to claim on another chain, enabling atomic swaps.
* Timelock: The contract sets a time or block-height limit. If the recipient fails to claim funds before the deadline, the sender can reclaim them. CLTV enforces an absolute time/block height; CSV enforces a relative waiting period measured in blocks.

Typical HTLC flow (atomic swap example)
1. Alice wants to swap Bitcoin for Bob’s Litecoin.
2. Alice generates a secret, hashes it, and shares the hash with Bob.
3. Alice locks her BTC in an HTLC that can be claimed by anyone who presents the secret before time T1.
4. Bob, seeing Alice’s hash, locks his LTC in an HTLC that can be claimed by anyone who presents the same secret before time T2 (T2 < T1 to prevent loss).
5. Alice reveals the secret to claim Bob’s LTC. The secret becomes publicly visible on the Litecoin chain.
6. Bob uses that revealed secret to claim Alice’s BTC before T1 expires.
7. If either party fails to claim in time, the locked funds are returned to their original owners after the respective timelocks elapse.

Explore More Resources

  • › Read more Government Exam Guru
  • › Free Thousands of Mock Test for Any Exam
  • › Live News Updates
  • › Read Books For Free

Where HTLCs are used
* Atomic swaps — trustless cross-chain exchanges.
* Payment channels and the Lightning Network — to route conditional, off-chain payments.
* Any conditional payment or escrow scenario on a blockchain that supports the necessary scripting primitives.

Requirements and limitations
* Both parties typically need open channels or the ability to create on-chain transactions (wallets or exchanges).
* Properly staggered timelocks are essential to prevent race conditions and ensure neither party can be cheated.
* If the preimage is leaked unintentionally, funds can be claimed by anyone who learns it.
* HTLCs require scripting features (hash and timelock opcodes) in the blockchain’s design.

Explore More Resources

  • › Read more Government Exam Guru
  • › Free Thousands of Mock Test for Any Exam
  • › Live News Updates
  • › Read Books For Free

Related concepts (brief)
* Timelock contract: A smart contract that locks funds until a specific time or block height, used within HTLCs.
* Smart contract: Code stored on a blockchain that executes automatically when conditions are met.
* Bitcoin and smart contracts: Bitcoin’s scripting is limited but supports HTLC-style constructions; the Taproot upgrade expanded Bitcoin’s smart-contract expressiveness.
* Smart contract cost: On platforms like Ethereum, deploying and executing contracts consumes gas, so complexity affects transaction fees.

Conclusion
HTLCs are a practical tool for trustless, conditional transfers across and within blockchains. By combining hashlocks and timelocks, they enable atomic swaps and scalable off-chain payment routing while minimizing counterparty risk when designed and timed correctly.

Explore More Resources

  • › Read more Government Exam Guru
  • › Free Thousands of Mock Test for Any Exam
  • › Live News Updates
  • › Read Books For Free

Youtube / Audibook / Free Courese

  • Financial Terms
  • Geography
  • Indian Law Basics
  • Internal Security
  • International Relations
  • Uncategorized
  • World Economy
Economy Of South KoreaOctober 15, 2025
Protection OfficerOctober 15, 2025
Surface TensionOctober 14, 2025
Uniform Premarital Agreement ActOctober 19, 2025
Economy Of SingaporeOctober 15, 2025
Economy Of Ivory CoastOctober 15, 2025