Source / pinned edition
Version bits with timeout and delay
Source of package btc.consensus · BIP 9
- work
- urn:btc:clir:consensus#BIP9
- number
- BIP 9
- kind
- urn:btc:clir:consensus#other
BIP 9 raw MediaWiki at 7fe0b034ec967b52a5a28276419117326df93263
- edition
- urn:btc:clir:consensus#BIP9_RAW
- language
- en
- officiality
- official
- materialisation
- PINNED_OFFICIAL_BYTES
- life cycle
- —
Publications
| URI | Type | documentHash | Retrieved |
|---|---|---|---|
| https://raw.githubusercontent.com/bitcoin/bips/7fe0b034ec967b52a5a28276419117326df93263/bip-0009.mediawiki | text/plain; charset=utf-8 | sha256:0ffa7b1ad84e1f32c7499d8a8756721c737037cbc91c825d05d11640ed5fedda | 2026-08-31T00:00:00Z |
Fragments — 2
States · section · referenced by: 28
en · official · sha256:1956e0f8dd219961680ee88af672264798d0d3b99ef26df11b0d19ff8d53232b
With each block and soft fork, we associate a deployment state. The possible states are:
# '''DEFINED''' is the first state that each soft fork starts out as. The genesis block is by definition in this state for each deployment.
# '''STARTED''' for blocks past the starttime.
# '''LOCKED_IN''' for one retarget period after the first retarget period with STARTED blocks of which at least threshold have the associated bit set in nVersion.
# '''ACTIVE''' for all blocks after the LOCKED_IN retarget period.
# '''FAILED''' for one retarget period past the timeout time, if LOCKED_IN was not reached.Referencing norms: Bip9Activation, Bip9Activation/ActivateAfterLockedInPeriod, Bip9Activation/Active, Bip9Activation/Defined, Bip9Activation/FailAtTimeout, Bip9Activation/FailBeforeStart, Bip9Activation/Failed, Bip9Activation/LockInAtNinetyFivePercent, Bip9Activation/LockedIn, Bip9Activation/Start, Bip9Activation/Started, Bip9ActivationState, Bip9ActivationStep, Bip9ActivationTransition, Bip9State, Deployment, attempted_transition, bip9_current_locked_in_period_elapsed, bip9_current_period_boundary, bip9_period_boundary, current_state, entered_state, initial_state, left_state, one_locked_in_retarget_period_elapsed, procedure_instance, state_before, valid_transition
State transitions · section · referenced by: 33
en · official · sha256:31c540c27079f3efbf0add3344f0cc63754745bac4779f40f665ac50321103b6
All blocks within a retarget period have the same state. This means that if
floor(block1.height / 2016) = floor(block2.height / 2016), they are guaranteed to have the same state for every
deployment.
if ((block.height % 2016) != 0) {
return GetStateForBlock(block.parent);
}
Otherwise, the next state depends on the previous state:
switch (GetStateForBlock(GetAncestorAtHeight(block, block.height - 2016))) {
We remain in the initial state until either we pass the start time or the timeout. GetMedianTimePast in the code below
refers to the median nTime of a block and its 10 predecessors. The expression GetMedianTimePast(block.parent) is
referred to as MTP in the diagram above, and is treated as a monotonic clock defined by the chain.
case DEFINED:
if (GetMedianTimePast(block.parent) >= timeout) {
return FAILED;
}
if (GetMedianTimePast(block.parent) >= starttime) {
return STARTED;
}
return DEFINED;
After a period in the STARTED state, if we're past the timeout, we switch to FAILED. If not, we tally the bits set,
and transition to LOCKED_IN if a sufficient number of blocks in the past period set the deployment bit in their
version numbers. The threshold is ≥1916 blocks (95% of 2016), or ≥1512 for testnet (75% of 2016).Referencing norms: BIP9ThresholdIsNinetyFivePercentOf2016, Bip9Activation, Bip9Activation/ActivateAfterLockedInPeriod, Bip9Activation/Active, Bip9Activation/Defined, Bip9Activation/FailAtTimeout, Bip9Activation/FailBeforeStart, Bip9Activation/Failed, Bip9Activation/LockInAtNinetyFivePercent, Bip9Activation/LockedIn, Bip9Activation/Start, Bip9Activation/Started, Bip9ActivationState, Bip9ActivationStep, Bip9ActivationTransition, Deployment, attempted_transition, bip9_current_period_boundary, bip9_current_period_start_time_reached, bip9_current_period_threshold_met, bip9_current_period_timeout_reached, bip9_mainnet_threshold_met, bip9_period_boundary, current_state, deployment_start_time_reached, deployment_timeout_reached, entered_state, initial_state, left_state, procedure_instance, signals_in_2016_block_period, state_before, valid_transition
The hash beside the text is the sha256 of its exact bytes. It is the check that the text shown matches the one pinned in the package: a divergence fails the oracle’s static analysis.