What Is the Difference Between Bitcoin CLTV and CSV?
CLTV is an absolute timelock condition; CSV can enforce a relative timelock condition. Both are Bitcoin Script opcodes that restrict when an output may be spent. Neither automatically sends coins when a deadline arrives.
What does CLTV check?
OP_CHECKLOCKTIMEVERIFY compares a script-provided threshold with the spending transaction's nLockTime, subject to height-versus-time compatibility and other consensus rules. The relevant input sequence must not be final.
What does CSV check?
OP_CHECKSEQUENCEVERIFY works with the spending input's nSequence and BIP68 relative-locktime semantics. It can constrain spending by elapsed blocks or time units relative to the output's confirmation context, depending on the encoded flags.
Which should a developer choose?
Use CLTV when the condition must reference a fixed height or time; use CSV when it should be relative to the age of the spent output. Complex protocols may combine them. Review transaction version, sequence flags, signature rules, and relay policy before deployment.
Related references
- BIP65: https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
- BIP68: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
- BIP112: https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki
