Security & Resilience
The time-warp attack, and the timestamp rules that bound it
Protocol referenceSource: Bitcoin Core consensus rules; Bitcoin Optech difficulty-adjustment topicThe attack is described as a majority-hash-rate strategy; no hash-rate or difficulty figure is quoted here.
- Written by
- The Bitcoin Data Guide editorial team
- Reviewed by
- Protocol review desk
- Dates
- Published 2026-10-31 · Last reviewed 2026-10-31
Fact
A block's timestamp must be greater than the median of the previous eleven blocks and no more than two hours ahead of network time, which bounds how far a miner can move it.
Forecast
Whether the strategy is worth mounting depends on the cost of a majority of hash rate against the difficulty reduction it could achieve, which the attack model does not measure.
The attack model
The difficulty adjustment reads the timestamps in the block headers to decide how long the previous 2,016 blocks took. If they took longer than the target, difficulty falls; if they took less, difficulty rises. The timestamps are set by the miners who produce the blocks, and the rules that constrain them are loose: a block's timestamp must be greater than the median of the previous eleven blocks, and no more than two hours ahead of network time.
The time-warp strategy exploits the lower bound. A miner that produces every block in a retarget period can set each timestamp to the earliest value the median-time-past rule allows, so the period appears to have taken longer than it did. The adjustment then lowers the difficulty, and the miner can produce blocks faster for the same hash rate. Repeated across periods, the strategy could in principle drive difficulty down and let a miner with a fixed amount of hash rate produce blocks at an accelerating rate.
The strategy requires a majority of hash rate, because the miner has to produce the blocks whose timestamps it manipulates. It is therefore a variant of the majority attack rather than a separate class of attack, and it is subject to the same cost: a majority of hash rate is expensive to acquire and to hold.
The assumptions the attack needs
The first assumption is a majority of hash rate. Without it, the miner does not produce enough of the blocks in a retarget period to control the timestamps the adjustment reads. This is the same assumption the 51% attack page states, and it is the binding constraint on the strategy.
The second assumption is that the timestamp rules do not close the gap. The median-time-past rule bounds how far back a miner can set a timestamp, and the two-hour future rule bounds how far forward. The strategy can only move a timestamp within that window, so the difficulty reduction it can achieve per period is limited. A change to the timestamp rules would change the attack's ceiling, which is why the rules are part of the security argument.
The third assumption is that the manipulation is not detected. A chain whose timestamps are visibly compressed is a signal that something is wrong, and the response available to the rest of the network is to reject the chain or to coordinate against the miner. The model treats the miner as unopposed, which is a simplification.
What the defence actually is
The defence is the timestamp rules themselves, and the cost of a majority. The median-time-past rule prevents a miner from setting a timestamp arbitrarily far in the past, and the two-hour future rule prevents one arbitrarily far in the future. Together they bound the manipulation to a window that limits how much difficulty a miner can shed per period. The difficulty adjustment's own clamp — a retarget may at most quadruple difficulty or reduce it to a quarter — further limits how fast the change can compound.
The practical reading is that the time-warp attack is a real result about the looseness of the timestamp rules, and a strategy that requires a majority to mount. The difficulty adjustment page sets out the retarget rule in full, and the security budget page explains what a majority of hash rate costs to acquire.
Sources
- Bitcoin Optech
- Difficulty adjustment — the 2,016-block retarget and the timestamp rules the adjustment reads.
- Bitcoin Core
- Consensus documentation — the median-time-past and future-time rules applied to block headers.
Related reading
- Security & ResilienceHow the network resists attack, and what happens when it is stressed.
- Can Miners Cheat?What a miner can and cannot do with the block it finds, and why invalid blocks fail.
- Double SpendingHow a double spend works, and why confirmation depth is the defence.
- 51% AttacksWhat a majority of hash rate can achieve, and what it cannot.
- Eclipse AttacksHow a node can be isolated from the honest network, and the defences against it.
- When Your Node Goes OfflineWhy a disconnected node is not a threat, and how it catches up on return.