What are HTLCs?
What are HTLCs?
Bitcoiner's Guide29 August, 2025
29 August, 2025 // Bitcoiner's Guide
TL;DR: Hashed Timelock Contracts (HTLCs) enable atomic, trustless swaps by combining a hashlock (prove a secret) with a timelock (refund if not revealed). First proposed in 2013 and adopted by Bitcoin’s Lightning Network in 2015, they now power cross-chain swaps, submarine swaps, and DEXs without wrapped assets. Despite privacy and optionality challenges, HTLCs remain the backbone of interoperability, evolving into PTLCs (Point Timelock Contracts) for greater privacy and efficiency.

A Hashed Timelock Contract (HTLC) is a type of smart contract that enables conditional payments or swaps. It combines two cryptographic primitives:

  • Hashlock: funds can only be claimed if the receiver provides the preimage s of a known hash H = Hash(s).
  • Timelock: if the receiver does not provide the preimage before a deadline, the sender can refund their funds.

This ensures atomicity: either the contract completes successfully for both parties, or it cancels safely.

HTLCs Use Cases:

  • Cross-chain atomic swaps, where assets on two different blockchains are exchanged without trust.
  • Lightning Network routing, where each hop in a payment is secured by an HTLC.
  • Bridges and submarine swaps, enabling on-chain ↔ off-chain interoperability without wrapped assets.

The general flow of an HTLC atomic swap is:

  1. User generates a secret s and shares only the hash H.
  2. User locks funds into an HTLC on chain A with hashlock H and timelock t_A.
  3. Solver, seeing H, locks funds into an HTLC on chain B with the same hash H but a shorter timelock t_B < t_A.
  4. User redeems Solver’s HTLC on chain B by revealing s.
  5. Solver learns s from chain B and uses it to redeem User’s HTLC on chain A.
  6. If anyone stalls, timelocks ensure funds are refunded safely.

More on atomic swaps using HTLCs here.

The Evolution of HTLCs

Origins: A Radical Idea in 2013

The story of HTLCs begins on the Bitcointalk forums in May 2013. A pseudonymous developer, TierNolan, outlined a method for cross-chain asset exchange without relying on intermediaries. The principle was elegant: a hashlock + a timelock = a contract that ensures all-or-nothing settlement.

Building blocks in Bitcoin script (2014-2016)

HTLCs became possible as Bitcoin introduced:

These enabled enforceable refund branches in contracts, making HTLCs practical on-chain.

Lightning Network: First Major Adoption (2015–2017)

The Lightning Network paper (2015) used HTLCs to secure multi-hop payments. When the receiver revealed the preimage, every upstream hop could safely claim funds.

By 2017, the BOLT specifications defined precise HTLC output formats on-chain, cementing their role as Lightning’s core mechanism.

Cross-chain Atomic Swaps (2017)

In September 2017, HTLCs made headlines:

This validated TierNolan’s original 2013 vision in practice.

Expansion and Experimentation (2018–2022)

HTLCs spread rapidly across use cases:

Research-driven Evolution: PTLCs (2020–2025)

HTLCs revealed issues around privacy leaks (same hash across hops, see Lightning Privacy research).

Point Timelock Contracts (PTLCs) with adaptor signatures emerged as the successor, offering privacy, efficiency, and resistance to routing interception.

Point Timelock Contracts (PTLCs) are the successor to HTLCs that use elliptic-curve points instead of hash preimages, solving HTLC privacy issues by preventing the same hash from being reused across every hop in a payment route. This makes payments harder to correlate and protects routing privacy.

Instead of revealing a hash preimage, PTLCs use adaptor signatures—a partial signature that embeds a secret scalar. When the recipient completes the signature to claim funds, the secret can be extracted, but each hop uses a unique curve point, unlike HTLCs. This not only preserves atomicity but also integrates cleanly with Schnorr/Taproot, making PTLCs more private, efficient, and indistinguishable from normal payments.

Our Vantage Point (2023)

At Garden, while exploring Bitcoin interoperability in late 2023, HTLCs naturally surfaced. Alternatives like wrapped tokens or lock-and-mint bridges introduced custodial risk and complexity.

HTLCs, by contrast, required no new assets, just direct, cryptographic settlement. This minimalism matched our ethos of trust-minimized interoperability.

The Road Forward

HTLCs today are:

  • The heartbeat of Lightning.
  • The bridge in submarine swaps.
  • The foundation for PTLCs.

From TierNolan’s forum post (2013) to multi-billion-dollar routing today, HTLCs evolved from forum discussion into global financial infrastructure.

Their successors may refine them, but the principle remains timeless: trustless, conditional, atomic settlement across systems.

About Garden

Garden is the fastest Bitcoin bridge, enabling cross-chain Bitcoin swaps in as little as 30 seconds. It is built using an intent-based architecture with trustless settlements, ensuring zero custody risk for users.

Join the Garden townhall and ask our expert gardeners about soil acidity and trimming bushes.

FAQs

1) What problem do HTLCs solve?

They enable atomic, trustless settlement across hops or chains, either the receiver reveals the preimage and everyone gets paid, or deadlines hit and everyone refunds, eliminating escrow/custodians.

2) Are HTLCs safe?

Yes, HTLCs are cryptographically safe because they rely on strong hash functions (collision-resistant, preimage-secure) and enforced timelocks in Bitcoin script (CLTV/CSV). These guarantees ensure that either the receiver reveals the secret to claim funds or, if the deadline passes, the sender safely refunds. This makes them trust-minimized by design, with no reliance on intermediaries or wrapped assets.

3) What’s the difference between HTLC and PTLC?

HTLCs use a hash preimage (H = Hash(s)), which can leak correlation across hops; PTLCs use an elliptic-curve point (P = s*G) via adaptor signatures, giving per-hop uniqueness, better privacy, and cleaner integration with Taproot, while preserving atomicity.

4) Do HTLCs require wrapped assets or custodians?

No, HTLCs swap the native assets on each chain using cryptographic conditions, no lock-and-mint or synthetic tokens required, which reduces custodial and bridge smart-contract risks.

5) What happens if the recipient never reveals the secret?

The timelock branch activates: downstream contracts refund first (shorter t_B), then upstream refunds (t_A > t_B). This staggered timeout design prevents funds from getting stuck and preserves atomicity in failure cases.

Last updated on 2 September, 2025