<p>I'll start with explaining the confusing documentation.</p>

<blockquote>
  <p>BIP34 says it activates when 950 out of 1000 blocks signal for Version 2. It is not clear if this includes the current block or refers to previous blocks</p>
</blockquote>

<p>It refers to previous blocks. To determine whether the rules are active for the block at height <code>n</code>, we check whether 950 of the blocks from <code>n-1001</code> to <code>n-1</code> signal version 2 or greater.</p>

<blockquote>
  <p>BIP66 says it activates when 950 of the previous 1000 blocks signal for Version 3. However, the client notes say 951 of the previous 1001 blocks. Then BIP66 says it activates using the protocol of BIP34. Now we have three possible methods. They do not match up.</p>
</blockquote>

<p>There are only two possible methods, and they're actually the same thing. 950 of the previous 1000 block is the same as the BIP 34 method. And this is actually the same thing as the 951 out of the previous 1001 if you consider a slightly different perspective. Either way, BIP 66 uses the same mechanism as BIP 34. Specifically, they use a function called IsSuperMajority to determine whether they are active. So both use the same mechanism. The issue is with how we describe this mechanism.</p>

<p>The "950 out of the previous 1000 blocks" wording used in BIPs is as I described earlier. It is determining whether the rules are being enforced for block <code>n</code> by looking at the 1000 blocks that precede it. So here <code>n</code> is not included in the count or in the sequence.</p>

<p>The "951/1001" wording includes block <code>n</code>. It looks at the blocks from <code>n-1001</code> to block <code>n</code> (inclusive) and checks whether 951 of those blocks have the right version number. These two wordings are identical because the 1001 one includes the activation block while the 1000 one does not.</p>

<p>One way to think of the 950/1000 is: after seeing a sequence of 1000 blocks where 950 blocks signal the new version, the next block to be mined must follow the new rules. The new rules are about to begin enforcement.</p>

<p>One way to think of the 951/1001 is: after seeing a sequence of 1001 blocks where 951 blocks signal the new version, the 1001st block in that sequence already enforced the new rules and enforcement has already begun.</p>

<p>Basically humans suck at describing things with words. It's all much clearer when you look at the code.</p>

<hr>

<p>Now onto the discrepancies. I've written a python script that does the IsSuperMajority check to verify these numbers.</p>

<h3>BIP 34</h3>

<p>I'm not sure where BitMex got their block height from. Checking that height, and ones before and after it do not result in activation. So I believe this is just incorrect.</p>

<p>Now for 277930 vs 277931, this is an interpretation issue. Like I talked about previously with the 950/100 vs 951/1001, this depends on inclusivity and perspective. At height 277930, a sequence of 1000 blocks was found where 950 had block version 2. So this means that at height 277930, the rules were not enforced for that block, but would be for the next one, i.e. 277931. Bitcoin Core uses 277931 because that is the first block that the BIP 34 rules are being enforced for so that is the value that is in the source code.</p>

<h3>BIP 66</h3>

<p>The 363724 vs 363725 discrepancy is the same thing as the 277930 vs 277931 in BIP 34.</p>

<p>BitMex's number is a little more confusing. The only way that this makes sense is if they are looking at the slightly difficult activation BIP 66 had. Due to miners spy mining, there was an inadvertent chain fork when BIP 66 activated. Block 363725 was the first block where the new rules were to be enforced. However a miner who had not upgraded found a block 363725. Because he was not upgraded, this block was invalid under the new rules and most of the network rejected it. But a many miners did not fully validate that block and mined on top of it. This turned out to be a significant portion of the hashrate and they ended up producing a fork 6 blocks in length before the valid main chain caught up and overtook them. This happened with block 363731. So one could say that is when BIP 66 activated.</p>

<p>But that's not the end of that story. The next day, there was a 3 block fork due to the same issue. So you could also say that BIP 66 activated a day later.</p>

<p>Either way, BIP 66 began being enforced with block 363725 being the first block under the new rules.</p>

<h3>BIP 65</h3>

<p>The 388380 vs 388381 discrepancy is the same thing as the 277930 vs 277931 in BIP 34.</p>

CC BY-SA 4.0
2020-04-22T23:27:12.703Z
I don't follow your argument regarding the BIP 66 activation. There were two chain tips that got extincted due to not following activated rules. They are not part of the best chain. How does that change that the rules were enforced starting with block 363,725?
Murch
CC BY-SA 4.0
2020-04-23T00:08:57.500Z
I was more trying to find something that makes sense for their number, but I agree that it doesn't make that much sense.
Ava Chow
CC BY-SA 4.0
2020-05-22T12:13:28.657Z
That was a superb answer. Thanks. Can I cite you in my study?
Aman Saggu
CC BY-SA 4.0
2020-04-22T17:23:16.973Z
2020-04-23T00:08:20.763Z
2020-04-23T00:08:20.763Z
Ava Chow
<p>Inconsistent Consensus/Activation of BIPs</p>

<p><strong>BIP34</strong></p>

<p>Activated Block Height 227,835 (<a href="https://blog.bitmex.com/bitcoins-consensus-forks/" rel="nofollow noreferrer">BitMEX Reference</a>)</p>

<p>Activated Block Height 227,930 (<a href="https://bitcoin.org/en/developer-reference#block-versions" rel="nofollow noreferrer">Bitcoin Developer Reference</a>)</p>

<p>Activated Block Height 227,931 (<a href="https://github.com/bitcoin/bitcoin/blob/c90a9e6fffa73707b6fcd4c39c39b2fc5aaf8398/src/chainparams.cpp#L64" rel="nofollow noreferrer">Github Reference</a>)</p>

<p><strong>BIP66</strong></p>

<p>Activated Block Height 363,724 (<a href="https://bitcoin.stackexchange.com/questions/38436/when-did-bip66-switch-from-activation-to-enforcement">Previous Question</a>)</p>

<p>Activated Block Height 363,725 (<a href="https://github.com/bitcoin/bitcoin/blob/c90a9e6fffa73707b6fcd4c39c39b2fc5aaf8398/src/chainparams.cpp#L64" rel="nofollow noreferrer">Github Reference</a>)</p>

<p>Activated Block Height 363,731 (<a href="https://blog.bitmex.com/bitcoins-consensus-forks/" rel="nofollow noreferrer">BitMEX Reference</a>)</p>

<p><strong>BIP65</strong></p>

<p>Activated Block Height 388,380 (<a href="https://blog.bitmex.com/bitcoins-consensus-forks/" rel="nofollow noreferrer">BitMEX Reference</a>)</p>

<p>Activated Block Height 388,381 (<a href="https://github.com/bitcoin/bitcoin/blob/c90a9e6fffa73707b6fcd4c39c39b2fc5aaf8398/src/chainparams.cpp#L64" rel="nofollow noreferrer">Github Reference</a>)</p>

<p><strong>Confusing Documentation</strong></p>

<p>BIP34 says it activates when 950 out of 1000 blocks signal for Version 2. It is not clear if this includes the current block or refers to previous blocks</p>

<p><a href="https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki" rel="nofollow noreferrer">BIP66</a> says it activates when 950 of the previous 1000 blocks signal for Version 3. However, the <a href="https://bitcoin.org/en/release/v0.10.0" rel="nofollow noreferrer">client notes</a> say 951 of the previous 1001 blocks. Then BIP66 says it activates using the protocol of BIP34. Now we have three possible methods. They do not match up.</p>

<p>Any advice on what is going on here?</p>

<mining-theory><protocol><consensus><bip><soft-fork>
BIP34, BIP66 and BIP65 should have been enforced at unique block heights. Why do different sources claim different block heights for enforcement?
Aman Saggu
# BIP34, BIP66 and BIP65 should have been enforced at unique block heights. Why do different sources claim different block heights for enforcement?

(Asked by: username_0 on 2020-04-22)

Inconsistent Consensus/Activation of BIPs

**BIP34**

Activated Block Height 227,835 ([BitMEX Reference](https://blog.bitmex.com/bitcoins-consensus-forks/))

Activated Block Height 227,930 ([Bitcoin Developer Reference](https://bitcoin.org/en/developer-reference#block-versions))

Activated Block Height 227,931 ([Github Reference](https://github.com/bitcoin/bitcoin/blob/c90a9e6fffa73707b6fcd4c39c39b2fc5aaf8398/src/chainparams.cpp#L64))

**BIP66**

Activated Block Height 363,724 ([Previous Question](https://bitcoin.stackexchange.com/questions/38436/when-did-bip66-switch-from-activation-to-enforcement))

Activated Block Height 363,725 ([Github Reference](https://github.com/bitcoin/bitcoin/blob/c90a9e6fffa73707b6fcd4c39c39b2fc5aaf8398/src/chainparams.cpp#L64))

Activated Block Height 363,731 ([BitMEX Reference](https://blog.bitmex.com/bitcoins-consensus-forks/))

**BIP65**

Activated Block Height 388,380 ([BitMEX Reference](https://blog.bitmex.com/bitcoins-consensus-forks/))

Activated Block Height 388,381 ([Github Reference](https://github.com/bitcoin/bitcoin/blob/c90a9e6fffa73707b6fcd4c39c39b2fc5aaf8398/src/chainparams.cpp#L64))

**Confusing Documentation**

BIP34 says it activates when 950 out of 1000 blocks signal for Version 2. It is not clear if this includes the current block or refers to previous blocks

[BIP66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki) says it activates when 950 of the previous 1000 blocks signal for Version 3. However, the [client notes](https://bitcoin.org/en/release/v0.10.0) say 951 of the previous 1001 blocks. Then BIP66 says it activates using the protocol of BIP34. Now we have three possible methods. They do not match up.

Any advice on what is going on here?

**Tags:** mining-theory, protocol, consensus, bip, soft-fork


---

## 1 answers

### Answer by username_1 on 2020-04-22. Score: 2 | Accepted answer

I'll start with explaining the confusing documentation.

> BIP34 says it activates when 950 out of 1000 blocks signal for Version 2. It is not clear if this includes the current block or refers to previous blocks

It refers to previous blocks. To determine whether the rules are active for the block at height `n`, we check whether 950 of the blocks from `n-1001` to `n-1` signal version 2 or greater.

> BIP66 says it activates when 950 of the previous 1000 blocks signal for Version 3. However, the client notes say 951 of the previous 1001 blocks. Then BIP66 says it activates using the protocol of BIP34. Now we have three possible methods. They do not match up.

There are only two possible methods, and they're actually the same thing. 950 of the previous 1000 block is the same as the BIP 34 method. And this is actually the same thing as the 951 out of the previous 1001 if you consider a slightly different perspective. Either way, BIP 66 uses the same mechanism as BIP 34. Specifically, they use a function called IsSuperMajority to determine whether they are active. So both use the same mechanism. The issue is with how we describe this mechanism.

The "950 out of the previous 1000 blocks" wording used in BIPs is as I described earlier. It is determining whether the rules are being enforced for block `n` by looking at the 1000 blocks that precede it. So here `n` is not included in the count or in the sequence.

The "951/1001" wording includes block `n`. It looks at the blocks from `n-1001` to block `n` (inclusive) and checks whether 951 of those blocks have the right version number. These two wordings are identical because the 1001 one includes the activation block while the 1000 one does not.

One way to think of the 950/1000 is: after seeing a sequence of 1000 blocks where 950 blocks signal the new version, the next block to be mined must follow the new rules. The new rules are about to begin enforcement.

One way to think of the 951/1001 is: after seeing a sequence of 1001 blocks where 951 blocks signal the new version, the 1001st block in that sequence already enforced the new rules and enforcement has already begun.

Basically humans suck at describing things with words. It's all much clearer when you look at the code.

---

Now onto the discrepancies. I've written a python script that does the IsSuperMajority check to verify these numbers.

### BIP 34

I'm not sure where BitMex got their block height from. Checking that height, and ones before and after it do not result in activation. So I believe this is just incorrect.

Now for 277930 vs 277931, this is an interpretation issue. Like I talked about previously with the 950/100 vs 951/1001, this depends on inclusivity and perspective. At height 277930, a sequence of 1000 blocks was found where 950 had block version 2. So this means that at height 277930, the rules were not enforced for that block, but would be for the next one, i.e. 277931. Bitcoin Core uses 277931 because that is the first block that the BIP 34 rules are being enforced for so that is the value that is in the source code.

### BIP 66

The 363724 vs 363725 discrepancy is the same thing as the 277930 vs 277931 in BIP 34.

BitMex's number is a little more confusing. The only way that this makes sense is if they are looking at the slightly difficult activation BIP 66 had. Due to miners spy mining, there was an inadvertent chain fork when BIP 66 activated. Block 363725 was the first block where the new rules were to be enforced. However a miner who had not upgraded found a block 363725. Because he was not upgraded, this block was invalid under the new rules and most of the network rejected it. But a many miners did not fully validate that block and mined on top of it. This turned out to be a significant portion of the hashrate and they ended up producing a fork 6 blocks in length before the valid main chain caught up and overtook them. This happened with block 363731. So one could say that is when BIP 66 activated.

But that's not the end of that story. The next day, there was a 3 block fork due to the same issue. So you could also say that BIP 66 activated a day later.

Either way, BIP 66 began being enforced with block 363725 being the first block under the new rules.

### BIP 65

The 388380 vs 388381 discrepancy is the same thing as the 277930 vs 277931 in BIP 34.

> **Comments:**
> **username_2**: I don't follow your argument regarding the BIP 66 activation. There were two chain tips that got extincted due to not following activated rules. They are not part of the best chain. How does that change that the rules were enforced starting with block 363,725?  
> **username_1**: I was more trying to find something that makes sense for their number, but I agree that it doesn't make that much sense.  
> **username_0**: That was a superb answer. Thanks. Can I cite you in my study?  

---

