BIP 113 Median Time Past and Locktime: This guide explains BIP 113 Median time-past as endpoint for lock-time calculations in plain English. It covers the problem behind the BIP, why it matters and whether the proposal is part of Bitcoin today.
TL;DR
- What it is: BIP 113 changed time-based transaction finality to compare nLockTime with the median timestamp of the previous eleven blocks instead of the candidate block’s timestamp. The deployed soft fork made lock-time behaviour more predictable and aligned consensus with existing mempool policy.
- Why it matters: BIP 113 made time-based locktime depend on recent chain history rather than one miner’s candidate timestamp. Correct operation uses median time past, active consensus state and reorganisation-aware wallet and mining tests.
- Current position: An operator should verify activation state and node release, not assume the presence of one opcode proves every related rule is active.
BIP 113 Median Time Past and Locktime in simple English
BIP 113 Median Time Past and Locktime: Median time past is the median timestamp of the previous eleven blocks. One extreme timestamp cannot move the median by itself, and the value advances according to chain history rather than the operator’s system clock.
Simple example
A node operator is checking BIP 113 Median Time Past and Locktime. Before BIP 113, a miner could choose a candidate timestamp within consensus bounds and thereby influence whether a time-locked transaction became final in that block.
Key terms in plain English
- BIP:
- Bitcoin Improvement Proposal: a document describing a proposed rule, standard or process. Its status must be checked separately.
- Consensus:
- The shared rules full nodes use to decide whether blocks and transactions are valid.
- Soft fork:
- A proposed tightening of Bitcoin rules that old nodes may not enforce themselves.
- Mempool:
- A node’s changing local collection of valid, unconfirmed transactions.
- Node:
- A computer running Bitcoin software that checks data and communicates with other peers.
Why block time was unstable
Before BIP 113, a miner could choose a candidate timestamp within consensus bounds and thereby influence whether a time-locked transaction became final in that block. Mempools already used a chain-derived median for acceptance, creating a difference between relay prediction and block validity. The new endpoint reduced that discrepancy.
Median of eleven blocks
Median time past is the median timestamp of the previous eleven blocks. One extreme timestamp cannot move the median by itself, and the value advances according to chain history rather than the operator’s system clock. It can lag real time, so a calendar deadline is not guaranteed to unlock at an exact wall-clock minute.
Locktime values stay the same
BIP 113 did not change nLockTime encoding: values below the threshold remain height based, and larger values remain Unix-time based. It changed the comparison endpoint for time locks. Sequence-finality requirements still apply, so a transaction with all-final sequences can bypass ordinary locktime enforcement.
Consensus and mempool alignment
Using the previous block’s median made a transaction accepted to the mempool more likely to be valid for the next block under the same finality rule. Policy can still be stricter or state can advance before mining. Pool template builders must use their validating node instead of recalculating finality from local time.
Coordinated CSV deployment
BIP 113 deployed with BIP 68 relative lock time and BIP 112 CHECKSEQUENCEVERIFY through versionbits. Their shared activation supported predictable absolute and relative timelocks. An operator should verify activation state and node release, not assume the presence of one opcode proves every related rule is active.
Reorganisations and monitoring
A reorganisation replaces the recent eleven-block window and can change median time and transaction finality at the new tip. Wallets should monitor confirmation and reacceptance rather than schedule irreversible business actions from a pre-confirmation estimate. Mining failover nodes must agree on the active chain.
How specialists test it
Developers test the proposal with made-up data on an isolated test network. They check normal cases and deliberately invalid cases. Different implementations should reach the same result before anyone relies on the proposal.
Frequently asked questions
What is the main point of BIP 113 Median Time Past and Locktime?
BIP 113 Median Time Past and Locktime: Median time past is the median timestamp of the previous eleven blocks.
For BIP 113 Median Time Past and Locktime, why block time was unstable?
Before BIP 113, a miner could choose a candidate timestamp within consensus bounds and thereby influence whether a time-locked transaction became final in that block.
For BIP 113 Median Time Past and Locktime, what should a beginner know about median of eleven blocks?
Median time past is the median timestamp of the previous eleven blocks.
For BIP 113 Median Time Past and Locktime, what should a beginner know about locktime values stay the same?
BIP 113 did not change nLockTime encoding: values below the threshold remain height based, and larger values remain Unix-time based.
Conclusion
BIP 113 made time-based locktime depend on recent chain history rather than one miner’s candidate timestamp. Correct operation uses median time past, active consensus state and reorganisation-aware wallet and mining tests.
Primary sources
Check the current specification status and the documentation for the exact implementation you operate before moving production funds or changing a mining node.
Join the ASIC Mining Discussion
Members can read and join the discussion
Log in to read comments from other miners. Create a free account if you would like to ask a question or share your experience.
Membership helps us protect the discussion from spam and keep answers useful.