‹ CHAPTER 16, ALL LESSONS

MASTER · CHAPTER 16 · LESSON 2 OF 5

Script & upgrades

Timelocks

How can bitcoin be made unspendable until a certain day? 5 min

Absolute timelocks

An absolute timelock says: not before this block height or this date. A whole transaction can carry one in its nLockTime field, and since 2015 an output can enforce one in its script with OP_CHECKLOCKTIMEVERIFY.

Relative timelocks

A relative timelock says: not before this many blocks after the output was confirmed. It arrived in 2016 with OP_CHECKSEQUENCEVERIFY. It is what lets a Lightning channel give the other side a window to react before funds of a force close can be spent.

  • Inheritance: a backup key that only works after a long period without activity.
  • Vaults: a delay during which a suspicious withdrawal can be cancelled with another key.
  • Lightning: penalty windows and the safety of routed payments.

What to remember

  • Absolute: not before a height or date (CLTV).
  • Relative: not before N blocks after confirmation (CSV).
  • Lightning and inheritance plans rely on them.

Quick check

What does a relative timelock measure from?

Which Bitcoin tool depends heavily on relative timelocks?