BITCOIN MAINNETLive explorer status
PROGRAMMABLE LOCKS

Timelocks: CLTV and CSV

Timelocks stop bitcoin being spent until a set time. CLTV uses an absolute block or date; CSV counts from when the coins were received. See examples.

Two kinds of "not yet"

AbsoluteRelative
Transaction-levelnLockTimenSequence (BIP 68)
Script-levelOP_CHECKLOCKTIMEVERIFY (CLTV, BIP 65)OP_CHECKSEQUENCEVERIFY (CSV, BIP 112)
Meaning"not before block 900,000""not until 144 blocks after this output confirmed"
An output locked until a given block height🔒 cannot be spent yetunlocks at block 900,000now
An output locked until a given block height

CLTV: absolute

<900000> OP_CHECKLOCKTIMEVERIFY OP_DROP <pubkey> OP_CHECKSIG

The spending transaction must have a locktime of at least 900,000, and it can't be mined before that block. Useful for savings locks or inheritance plans.

CSV: relative

<144> OP_CHECKSEQUENCEVERIFY OP_DROP <pubkey> OP_CHECKSIG

The input's sequence must say at least 144 blocks (about a day) have passed since the output was confirmed. This is essential for the The Lightning Network: it gives the other side time to react if someone cheats. See Closing channels and watchtowers.

Combining with other paths

Timelocks are often one branch of a script: "Alice and Bob together any time, or Alice alone after a year". Taproot makes such branches private until used.

Real uses

  • Inheritance: "My key now, or my family's key after one year of no movement."
  • Savings lock: coins that can't be spent before a chosen date.
  • Lightning: a delay before a closing party can take its funds, so cheating can be punished.
  • Vaults: a waiting period during which a recovery key can cancel a suspicious withdrawal.

Careful

A timelock can't be undone. If you lock coins with only a timelock path, there's no way to reach them early, even if you need them.

Share this guide
Share on X ↗

Key takeaways

  • CLTV locks coins until an absolute height or time.
  • CSV locks coins until a delay has passed since confirmation.
  • Lightning relies on relative timelocks for safety.

Common questions

Can a timelock be cancelled?

Not the lock itself. If the script has another path, such as multiple signers, that path can be used instead.

What's the longest timelock?

Absolute locks can be years in the future. Relative locks are limited to about 65,535 blocks (over a year) or about 388 days in time units.

What is the difference between CLTV and CSV?

CLTV locks until an absolute block height or date; CSV locks for a relative period after the coins confirmed.

Can I use timelocks in my wallet?

Some advanced wallets support timelocked scripts through descriptors and miniscript.