Definition
OP_CHECKSEQUENCEVERIFY, abbreviated CSV, is a Bitcoin Script opcode defined in BIP 112 that enforces a relative timelock. Rather than a fixed calendar deadline, CSV requires that a minimum amount of time has elapsed since the output being spent was confirmed. It redefined the unused OP_NOP3, activating as a soft fork alongside BIP 68 and BIP 113.
How CSV reads nSequence
CSV checks the value on the stack against the relative locktime encoded in the spending input's nSequence field (per BIP 68). Bit 22 (the type flag) selects units: unset means the lock is measured in blocks with single-block granularity; set means it is measured in 512-second intervals. Bit 31 (the disable flag) turns the constraint off entirely — if it is set, CSV behaves as a NOP. The lock is satisfied only when the input has aged at least as long as the script demands.
Where it is used
CSV is the workhorse of the Lightning Network. Hash Time-Locked Contracts (HTLCs) and channel revocation paths rely on relative delays so a counterparty has a window to react before funds can be swept. Because the timer starts when the output confirms rather than at a fixed date, CSV-based contracts remain valid no matter when the channel is opened.
CSV governs “wait N after confirmation” logic, complementing the absolute deadlines of OP_CHECKLOCKTIMEVERIFY (CLTV). The block-vs-time interpretation it relies on is itself anchored by Median Time Past (MTP).
In Simple Terms
OP_CHECKSEQUENCEVERIFY, abbreviated CSV, is a Bitcoin Script opcode defined in BIP 112 that enforces a relative timelock. Rather than a fixed calendar deadline, CSV requires…
