Mitigation for Timewarp Attack in Testnet 4

182 views
Skip to first unread message

Murch

unread,
Aug 27, 2024, 3:00:46 PM8/27/24
to Bitcoin Mining Development Mailing List
Hey y’all,

I want to pick your brain and make you aware regarding the new timestamp
restriction included in the Testnet 4 consensus rules:
Testnet 4 requires that the timestamp of the first block of a difficulty
period does not precede the timestamp of the last block of the prior
difficulty period by more than ten minutes.
To put it differently, time cannot go back more than 600 seconds between
difficulty periods, or formally:

for each blockheight b where b%2016 == 0
| timestamp_{b} ≥ timestamp_{b-1} - 600

The rule is part of the consensus changes put forth per the Great
Consensus Cleanup proposal (see
https://delvingbitcoin.org/t/great-consensus-cleanup-revival/710) and
helps prevent the jump of a difficulty period’s end time versus the
start of the subsequent difficulty period’s start time necessary for the
classic timewarp attack (see e.g.
https://bitcoin.stackexchange.com/q/75831/5406).

I am concerned that if this rule were eventually introduced to mainnet
it might cause a miner to build an invalid block due to them assigning
the current time to their block template after someone timestamped the
last block of a difficulty period into the future by more than ten minutes.

Would adherence to this rule present a challenge for mining software or
hardware, or the software that coordinates mining pool contributions?

Best,
Murch

russeree

unread,
Sep 3, 2024, 8:50:18 PM9/3/24
to Bitcoin Mining Development Mailing List
This would be no problem for MARA Digital Holdings. The timestamp used is created from Getblocktemplate and we run the latest version of Bitcoin Core. 

Thanks,
Portland.HODL

Murch

unread,
Sep 4, 2024, 5:54:50 PM9/4/24
to bitcoinm...@googlegroups.com
Hey Portland.HODL,

On 9/3/24 15:25, russeree wrote:
> This would be no problem for MARA Digital Holdings. The timestamp used is
> created from Getblocktemplate and we run the latest version of Bitcoin
> Core.

Thanks for sharing, that’s good to hear!

To provide a bit more context here, the upcoming Bitcoin Core 28.0
release that will ship support for Testnet 4 will also include a
mitigation to the issue I described:
In the case that the last block in a difficulty period were stamped into
the future, the response to a `getblocktemplate` call for the first
block in the subsequent difficulty period would automatically raise the
timestamp of the block template to adhere to the 10-minute constraint
(see https://github.com/bitcoin/bitcoin/pull/30681).

The time constraint might however create an issue if anyone were for
example using other software to modify timestamps on block templates
between creating them and sending them out, or if they used different
software to produce block templates.

Cheers,
Murch
Reply all
Reply to author
Forward
0 new messages