Definition
A relative timelock prevents a coin from being spent until a defined amount of time has elapsed since the output it spends was confirmed. The deadline is measured relative to confirmation rather than to a fixed calendar point. Relative locks are defined by BIP 68, which gives consensus meaning to the input's nSequence field, and can be enforced inside a script with OP_CHECKSEQUENCEVERIFY.
How it is encoded
Each transaction input carries a 4-byte nSequence value. Under BIP 68, the low 16 bits hold the lock duration. Bit 22 selects units — clear for blocks (1-block steps) or set for time (512-second steps) — while bit 31 disables the relative-lock interpretation when set. A transaction is only valid once every input has aged past its specified relative lock, with time-based locks measured against Median Time Past.
Why it exists
Relative timelocks are essential for layer-2 protocols where two parties exchange off-chain commitments. In the Lightning Network, a revocation or HTLC path must give the counterparty a guaranteed reaction window before funds can be claimed. Because the timer is relative to confirmation, the same contract template works no matter when the channel is funded — a property an absolute deadline cannot provide.
This contrasts with an Absolute Timelock, which fixes a specific height or time. The script-level enforcer of relative locks is OP_CHECKSEQUENCEVERIFY (CSV).
In Simple Terms
A relative timelock prevents a coin from being spent until a defined amount of time has elapsed since the output it spends was confirmed. The…
