Recently, BIP66 switched from activation (miners enforce rules within block) to enforcement (network enforces rules on all blocks).
I'm having trouble figuring out when this happened, or on what block it happened.
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityRecently, BIP66 switched from activation (miners enforce rules within block) to enforcement (network enforces rules on all blocks).
I'm having trouble figuring out when this happened, or on what block it happened.
From BIP66:
The new rules are in effect for every block (at height H) with nVersion = 3 and at least 750 out of 1000 blocks preceding it (with heights H-1000..H-1) also have nVersion = 3. Furthermore, when 950 out of the 1000 blocks preceding a block do have nVersion = 3, nVersion = 2 blocks become invalid, and all further blocks enforce the new rules.
I wrote this script to monitor the number of the last 1000 blocks that have nVersion set to 3.
require_once 'jsonRPCClient.php';
$daemon = new jsonRPCClient('http://{my_user}:{my_password}@127.0.0.1:8332/');
$blkStart = 364136 - (24 * 14 * 6);
$ver3InLast1000 = 0;
for ($i = $blkStart;; $i++) {
try {
$blockHashOld = $daemon->getblockhash($i-1000);
$blockHashNew = $daemon->getblockhash($i);
$blockOld = $daemon->getblock($blockHashOld);
$blockNew = $daemon->getblock($blockHashNew);
} catch(Exception $e) {
break;
}
// Don't want to start subtracting until have processed 1000 blocks
if ($blockOld["version"] == 3 && ($i - $blkStart >= 1000)) {
$ver3InLast1000--;
}
if ($blockNew["version"] == 3) {
$ver3InLast1000++;
}
if ($i - $blkStart >= 1000) {
echo "$i, $ver3InLast1000\n";
}
}
The result can be found in this pastebin.
Block number 363724 is the block that turned on nVersion=3 enforcement for all further blocks.
getblockchaininfo
RPC. See this pull request for details.
Jul 6, 2015 at 20:21