<blockquote>
<p>Should block height or MTP (median time past [...]) or a mixture of both be used in an activation mechanism like BIP 8 or BIP 9 for defining the timings of the state transitions?  What are the advantages and disadvantages of both and how do they compare?</p>
</blockquote>
<p>The main advantage of MTP is that it usually roughly corresponds to wall time, so it's easy to communicate what a number means to humans.  For example, BIP141 says: &quot;the BIP9 starttime will be midnight 15 november 2016 UTC [...] and BIP9 timeout will be midnight 15 november 2017 UTC&quot;.  When both of those MTP values were reached on the actual network, they were within three hours of actual UTC.</p>
<p>The main disadvantage of MTP is that it can be manipulated by miners.  MTP is the median of the value recorded in the nTime field of the current block header and the previous 10 blocks.  Miners can set their nTime values to any value greater than the current MTP and less than two hours in the future.  This makes it possible for a majority of miners working for an extended amount of time to hold MTP to an old value (say 3 months ago) and then, in the space of a single block, move to a much later time (say 1 month ago).  This can allow them to jump over MTP-based mandatory signaling periods such as specified in BIP148.</p>
<p>The main advantage of block heights is that there's no way to skip over a height-based threshold, so they make sense for flag day activations, mandatory signaling requirements, and other transitions we want to ensure happen (such as from BIP9 LOCKED_IN to ACTIVE, which happens using a relative height-based threshold of 2,016 blocks).</p>
<p>The main disadvantage of block heights is that they're not particularly consistent.  In an average year, we expect there to be 52,596 blocks, but it would not be extraordinary for there to be 58,440 blocks---reducing an intended 12-month deployment to 10.8 months.</p>
<p>There's no harm in mixing MTP times and heights, and there can be significant advantages if you can take advantage of both strengths at the same time without losing too much to their weaknesses.</p>

CC BY-SA 4.0
2021-03-25T20:41:08.843Z
2021-03-25T20:41:08.843Z
David A. Harding
<p>Using block heights for the start and timeout parameters has the advantage of giving miners a known number of signaling periods. Loss of hashpower doesn't reduce the number of retarget periods available for activation.  Especially for an activation mechanism over a shorter time horizon (e.g. the Speedy Trial <a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html" rel="nofollow noreferrer">proposal</a>) it may be important to ensure miners have the maximum number of signaling periods. Block heights are also arguably easier to communicate and easier to reason about as blockchain developers are used to working with them.</p>
<p>Using MTP (median time past) has the advantage of being able to schedule an activation at a specific time in the day to avoid activation occurring in the middle of the night for some region in the world. Concerns around hashrate decreases or increases affecting the number of signaling periods can be mitigated with selecting mid signaling period MTPs. The short duration of proposals like <a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html" rel="nofollow noreferrer">Speedy Trial</a> are less sensitive to hashrate drifts changing the number of periods (a large hashrate decrease would be required to decrease the number of signalling periods).</p>
<p>A concern with MTP is that a <a href="https://github.com/bitcoin/bitcoin/pull/21377#pullrequestreview-617754202" rel="nofollow noreferrer">coalition</a> of miners could scale down their mined blocks at nTime to MTP + 1 to prevent reaching a MTP start time at the expected real world time. This concern seems minor as it could impact difficulty adjustments and would require broad participation from miners to limit MTP.</p>
<p>It is also subject to debate whether using block height consistently or using a mixture of both block heights and MTP is preferable for making the implementation and release of an alternative competing (compatible or incompatible) activation mechanism (e.g. a UASF release) more difficult or for avoiding a scalp for <a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018715.html" rel="nofollow noreferrer">marketing purposes</a>.</p>
<p>AJ Towns explains a disadvantage with using MTP for the minactivation point <a href="https://github.com/bitcoin/bitcoin/pull/21377#issuecomment-792425221" rel="nofollow noreferrer">here</a>. If activation time falls near a difficulty retarget block activation could happen the next day or in two weeks. This presents some communication challenges.</p>
<p>In addition:</p>
<blockquote>
<p>The height at which you transition from LOCKED_IN to ACTIVE must be fully determined as soon as you transition from STARTED to LOCKED_IN. That way the entire LOCKED_IN period has to be re-orged if you want to steal funds protected by both nLocktime and the new rules.</p>
</blockquote>
<p>In summary, there appears to be consensus that block heights should be used exclusively in activation mechanisms for future soft forks but it is less clear whether there is consensus to use them exclusively for the proposed Taproot activation mechanism, Speedy Trial.</p>
<p>For more details on the timewarp attack on MTP see <a href="https://github.com/bitcoin/bitcoin/pull/21393#issuecomment-815698514" rel="nofollow noreferrer">this</a> from Mark Friedenbach and <a href="https://github.com/bitcoin/bips/pull/1104#issuecomment-819068299" rel="nofollow noreferrer">this</a> from Andrew Chow.</p>
<p>This answer was taken from comments on <a href="https://github.com/bitcoin/bitcoin/pull/21377" rel="nofollow noreferrer">GitHub</a> and the <a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018715.html" rel="nofollow noreferrer">mailing list</a> from Andrew Chow, AJ Towns, Jeremy Rubin, Sjors Provoost, Antoine Riard and David Harding.</p>

CC BY-SA 4.0
2021-03-25T17:17:01.553Z
2021-04-13T21:44:34.750Z
2021-04-13T21:44:34.750Z
Michael Folkson
<p>Should block height or MTP (<a href="https://bitcoin.stackexchange.com/questions/76453/why-does-the-median-past-time-average-the-last-11-block-timestamps-and-not-the-l">median time past</a> defined in <a href="https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki" rel="nofollow noreferrer">BIP 113</a>) or a mixture of both be used in an activation mechanism like BIP 8 or BIP 9 for defining the timings of the <a href="https://github.com/bitcoin/bips/blob/master/bip-0008.mediawiki#state-transitions" rel="nofollow noreferrer">state transitions</a>?</p>
<p>What are the advantages and disadvantages of both and how do they compare?</p>

<soft-fork><bip9-version-bits><activation-mechanism><bip8-version-bits>
Should block height or MTP or a mixture of both be used in a soft fork activation mechanism?
Michael Folkson
# Should block height or MTP or a mixture of both be used in a soft fork activation mechanism?

(Asked by: username_0 on 2021-03-25)

Should block height or MTP ([median time past](https://bitcoin.stackexchange.com/questions/76453/why-does-the-median-past-time-average-the-last-11-block-timestamps-and-not-the-l) defined in [BIP 113](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)) or a mixture of both be used in an activation mechanism like BIP 8 or BIP 9 for defining the timings of the [state transitions](https://github.com/bitcoin/bips/blob/master/bip-0008.mediawiki#state-transitions)?

What are the advantages and disadvantages of both and how do they compare?

**Tags:** soft-fork, bip9-version-bits, activation-mechanism, bip8-version-bits


---

## 2 answers

### Answer by username_1 on 2021-03-25. Score: 6

> Should block height or MTP (median time past [...]) or a mixture of both be used in an activation mechanism like BIP 8 or BIP 9 for defining the timings of the state transitions? What are the advantages and disadvantages of both and how do they compare?

The main advantage of MTP is that it usually roughly corresponds to wall time, so it's easy to communicate what a number means to humans. For example, BIP141 says: "the BIP9 starttime will be midnight 15 november 2016 UTC [...] and BIP9 timeout will be midnight 15 november 2017 UTC". When both of those MTP values were reached on the actual network, they were within three hours of actual UTC.

The main disadvantage of MTP is that it can be manipulated by miners. MTP is the median of the value recorded in the nTime field of the current block header and the previous 10 blocks. Miners can set their nTime values to any value greater than the current MTP and less than two hours in the future. This makes it possible for a majority of miners working for an extended amount of time to hold MTP to an old value (say 3 months ago) and then, in the space of a single block, move to a much later time (say 1 month ago). This can allow them to jump over MTP-based mandatory signaling periods such as specified in BIP148.

The main advantage of block heights is that there's no way to skip over a height-based threshold, so they make sense for flag day activations, mandatory signaling requirements, and other transitions we want to ensure happen (such as from BIP9 LOCKED\_IN to ACTIVE, which happens using a relative height-based threshold of 2,016 blocks).

The main disadvantage of block heights is that they're not particularly consistent. In an average year, we expect there to be 52,596 blocks, but it would not be extraordinary for there to be 58,440 blocks---reducing an intended 12-month deployment to 10.8 months.

There's no harm in mixing MTP times and heights, and there can be significant advantages if you can take advantage of both strengths at the same time without losing too much to their weaknesses.


---

### Answer by username_0 on 2021-03-25. Score: 1

Using block heights for the start and timeout parameters has the advantage of giving miners a known number of signaling periods. Loss of hashpower doesn't reduce the number of retarget periods available for activation. Especially for an activation mechanism over a shorter time horizon (e.g. the Speedy Trial [proposal](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html)) it may be important to ensure miners have the maximum number of signaling periods. Block heights are also arguably easier to communicate and easier to reason about as blockchain developers are used to working with them.

Using MTP (median time past) has the advantage of being able to schedule an activation at a specific time in the day to avoid activation occurring in the middle of the night for some region in the world. Concerns around hashrate decreases or increases affecting the number of signaling periods can be mitigated with selecting mid signaling period MTPs. The short duration of proposals like [Speedy Trial](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html) are less sensitive to hashrate drifts changing the number of periods (a large hashrate decrease would be required to decrease the number of signalling periods).

A concern with MTP is that a [coalition](https://github.com/bitcoin/bitcoin/pull/21377#pullrequestreview-617754202) of miners could scale down their mined blocks at nTime to MTP + 1 to prevent reaching a MTP start time at the expected real world time. This concern seems minor as it could impact difficulty adjustments and would require broad participation from miners to limit MTP.

It is also subject to debate whether using block height consistently or using a mixture of both block heights and MTP is preferable for making the implementation and release of an alternative competing (compatible or incompatible) activation mechanism (e.g. a UASF release) more difficult or for avoiding a scalp for [marketing purposes](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018715.html).

AJ Towns explains a disadvantage with using MTP for the minactivation point [here](https://github.com/bitcoin/bitcoin/pull/21377#issuecomment-792425221). If activation time falls near a difficulty retarget block activation could happen the next day or in two weeks. This presents some communication challenges.

In addition:

> The height at which you transition from LOCKED\_IN to ACTIVE must be fully determined as soon as you transition from STARTED to LOCKED\_IN. That way the entire LOCKED\_IN period has to be re-orged if you want to steal funds protected by both nLocktime and the new rules.

In summary, there appears to be consensus that block heights should be used exclusively in activation mechanisms for future soft forks but it is less clear whether there is consensus to use them exclusively for the proposed Taproot activation mechanism, Speedy Trial.

For more details on the timewarp attack on MTP see [this](https://github.com/bitcoin/bitcoin/pull/21393#issuecomment-815698514) from Mark Friedenbach and [this](https://github.com/bitcoin/bips/pull/1104#issuecomment-819068299) from Andrew Chow.

This answer was taken from comments on [GitHub](https://github.com/bitcoin/bitcoin/pull/21377) and the [mailing list](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018715.html) from Andrew Chow, AJ Towns, Jeremy Rubin, Sjors Provoost, Antoine Riard and username_1 username_1.


---

