- Blockchain By Example
- Bellaj Badr Richard Horrocks Xun (Brian) Wu
- 262字
- 2021-06-10 18:53:45
BIPs: Bitcoin Improvement Proposals
In the previous chapter, we introduced BIPs as a way to bring new features to the Bitcoin protocol. Each new improvement (BIP) is activated at a future block height to give Bitcoin users time to update their software. In chainparams.cpp, you'll find some old important BIPs ( BIP34/65/66) defined as the following checkpoints:
For checkpoints, we can use either a block height or hash.
As you are creating a new chain from scratch, you can just use the genesis block height or hash to have these BIPs activated from the start:
consensus.BIP34Height = 0;
consensus.BIP34Hash =
uint256S("000001a9bbae8bb141c6941838bdacdbcf474b6ed28a0b18b2120b60a68f00ee");
consensus.BIP65Height = 0;
consensus.BIP66Height = 0;
Alongside the BIP activation time, the next 11 lines describe the activation rules (retargeting period, requisite activation threshold, version bit, fork start, and ending time) for deploying soft forks:
As we have edited the consensus.nMinerConfirmationWindow = 576;earlier,we can therefore deduce the nRuleChangeActivationThreshold value by multiplying the confirmation window by 95% to get the following:
nRuleChangeActivationThreshold=574;
For the rest of the rules, you can keep the bit element as it is and set the nStartTime and ntimeout as follows:
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = "your genesis time stamp";
Or you can just keep the original values. Just afterwards, you'll find the following assumption:
consensus.defaultAssumeValid = uint256S("0x0000000000000000003b9ce759c2a087d52abc4266f8f4ebd6d768b89defa50a");
This assumes that the signatures in the ancestors of this block are valid. We'll need to set this hash to zero:
consensus.defaultAssumeValid = uint256S("0x00");
The preceding modifications should be performed for mainnet and testnet as well.
All right. Now our Readercoin is ready to be compiled and tested.