← Bitcoin Encyclopedia

Timelock (CSV & CLTV)

🌿 Intermediate

💡 The Plain-English Definition

A timelock is a Bitcoin spending condition that stops funds from being moved until a specified future time or block height. Bitcoin has two kinds: CLTV, which is absolute (you must wait until a specific block number), and CSV, which is relative (you must wait a certain number of blocks after the transaction holding the funds confirms).

🤔 But Why Though?

Bitcoin’s scripting system — the simple programming language that defines spending conditions — can express not just “who can spend this” but “when can this be spent.” Timelocks are the time dimension of Bitcoin security: they make it possible to create bitcoin that can’t be moved for a set period, no matter who holds the key.

CLTV — CheckLockTimeVerify, defined in BIP65 — locks funds until an absolute point in time or block height. Bitcoin locked with CLTV to block 900,000 can’t be spent before the chain reaches that block, no matter what. It’s like a safe-deposit box that physically can’t open until a calendar date.

CSV — CheckSequenceVerify, defined in BIP112 — locks funds for a relative period after the transaction holding them confirms. A CSV timelock of 144 blocks means the funds are locked for roughly 24 hours after they arrive (144 blocks × 10 minutes each). This relative kind is critical for Lightning Network security. When a channel force-closes — one party broadcasts the channel’s state on their own, without the other’s cooperation — the broadcasting party’s funds are held under a CSV delay of 144 to 2,016 blocks. That delay gives the other party time to broadcast a justice transaction — a special transaction that claims all the channel’s funds as a penalty — if a cheating, out-of-date state was broadcast.

Timelocks have uses well beyond Lightning: vaults (bitcoin locked with a withdrawal delay so a theft can be reversed), inheritance arrangements (bitcoin that becomes spendable after a set period if the owner hasn’t acted), and escrow (funds locked until conditions are met by a certain date). They’re a foundational building block that enables complex financial arrangements with no trusted third party.

🌍 The Real-World Analogy

Think of timelocks like a will with a probate period. The money doesn’t pass to heirs the moment someone dies — it’s held in probate for a required period so disputes can be raised. CLTV is like specifying “this vault opens on January 1, 2030.” CSV is like specifying “this vault opens 90 days after this document is filed.” Both block immediate access regardless of who holds the key, making the time dimension of security as enforceable as the identity dimension.

⚡ So What?

You rely on timelocks every time you use the Lightning Network — they’re the security behind force-closes and HTLCs (Hash Time-Locked Contracts, the conditional payment structures that let Lightning payments route without trust). When a Lightning payment fails and “refunds automatically after expiry,” a timelock is what enforced that guarantee. For advanced users, timelocks are the building block for vaults, inheritance setups, and escrow — security arrangements that used to require lawyers and trusted third parties.

📩 The Daily Bit · free

Get one plain-English Bitcoin email each morning.

The Daily Bit — free, two minutes, unsubscribe anytime.

The Bitcoin EncyclopediaPrefer a book? The Bitcoin Encyclopedia