# Timewarp attack 600 second grace period

**URL:** <https://delvingbitcoin.org/t/timewarp-attack-600-second-grace-period/1326>\
**Category:** Protocol Design\
**Tags:** softfork\
**Created:** [December 17, 2024, 6:31am UTC](https://delvingbitcoin.org/t/timewarp-attack-600-second-grace-period/1326 "2024-12-17T06:31:46Z")\
**Posts on this page:** 1\
**Showing post:** 32

<div class="post-metadata">

**Author:** ![sipa](https://delvingbitcoin.org/user_avatar/delvingbitcoin.org/sipa/32/1100_2.png) [@sipa](https://delvingbitcoin.org/u/sipa)\
**Post date:** [January 8, 2025, 1:56pm UTC](https://delvingbitcoin.org/t/timewarp-attack-600-second-grace-period/1326/32 "2025-01-08T13:56:30Z")

</div>

Let’s say c\_i is the actual time at which block i is found, and t\_i is its timestamp.

If the attacker (who is assumed to have 100% hashrate) follows this strategy:

- The first block in every period p uses as timestamp the previous block’s timestamp minus the grace period: t\_{2016p} = t\_{2016p-1} - G (the minimum legal time according to the proposed rule).
- The 2014 middle blocks use the minimum legal time, which doesn’t really matter as long as it’s low enough: t\_{2016p+k} = 0 for 0 \< k \< 2015.
- The final block in the period uses the current time t\_{2016p+2015} = c\_{2016p+2015}.

Then the observed duration of the **2015** blocks in period p (relevant for difficulty adjustment) is t\_{2016p+2015} - t\_{2016p} = c\_{2016p+2015} - c\_{2016p-1} + G, i.e. the time it took to mine **2016** blocks plus G.

The difficulty multiplier m will thus be m = \frac{P}{X + G}, where X is Erlang distributed with k=2016 and \lambda=\operatorname{hashrate} \cdot \frac{\operatorname{target}}{2^{256}}.

In a simulation with G=600 I get an effective average block interval under constant hashrate of 599.9997… seconds. With G=7200 I get 596.7211… seconds.

---

_[View the full topic](https://delvingbitcoin.org/t/timewarp-attack-600-second-grace-period/1326)._
