return to the Bitcoin Improvement Proposals
Title | CHECKSEQUENCEVERIFY |
Layer | Consensus (soft fork) |
Author | BtcDrak, Mark Friedenbach, Eric Lombrozo |
Comments-Summary | No comments yet. |
Comments-URI | https://github.com/bitcoin/bips/wiki/Comments:BIP-0112 |
Status | Final |
Type | Standards Track |
Created | 2015-08-10 |
Post History | |
Description | https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki |
License | PD |
This BIP describes a new opcode (CHECKSEQUENCEVERIFY) for the Bitcoin scripting system that in combination with BIP 68 allows execution pathways of a script to be restricted based on the age of the output being spent.
CHECKSEQUENCEVERIFY redefines the existing NOP3 opcode. When executed, if any of the following conditions are true, the script interpreter will terminate with an error:
Otherwise, script execution will continue as if a NOP had been executed.
BIP68 prevents a non-final transaction from being selected for inclusion in a block until the corresponding input has reached the specified age, as measured in block-height or block-time. By comparing the argument to CHECKSEQUENCEVERIFY against the nSequence field, we indirectly verify a desired minimum age of the the output being spent; until that relative age has been reached any script execution pathway including the CHECKSEQUENCEVERIFY will fail to validate, causing the transaction not to be selected for inclusion in a block.
BIP68 repurposes the transaction nSequence field meaning by giving sequence numbers new consensus-enforced semantics as a relative lock-time. However, there is no way to build Bitcoin scripts to make decisions based on this field. By making the nSequence field accessible to script, it becomes possible to construct code pathways that only become accessible some minimum time after proof-of-publication. This enables a wide variety of applications in phased protocols such as escrow, payment channels, or bidirectional pegs.