This is the current GetBlockValue, providing a total money supply of 2099'9999'9769'0000 satoshis, halving the subsidy every 21'0000 blocks:
CAmount GetBlockValue(int nHeight, const CAmount &nFees) {
int64_t nSubsidy = 50 * COIN;
int halvings = nHeight / Params().SubsidyHalvingInterval();
// Force block reward to zero when right shift is undefined.
if (halvings >= 64)
return nFees;
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
nSubsidy >>= halvings;
return nSubsidy + nFees;
}
This is a proposed GetBlockValue, providing a total money supply of 2099'9999'9769'0000 satoshis, halving the subsidy every 21'0000 blocks, smoothly:
CAmount GetBlockValue(int nHeight, const CAmount &nFees) {
int nHalvingInterval = Params().SubsidyHalvingInterval();
int nHalvings = nHeight / nHalvingInterval;
// Force subsidy to zero when right shift is undefined.
if (nHalvings >= 64)
return nFees;
// Subsidy is cut in half every 210000 blocks which will occur approximately every 4 years.
int64_t nSubsidy = COIN * 50 >> nHalvings;
// Subsidy decreases linearily, beginning with 4/3, ending with 2/3 of the nominal value.
nSubsidy *= nHalvingInterval * 4 - nHeight % nHalvingInterval * 2 - 1;
nSubsidy += nHeight * 2 / nHalvingInterval % 2 * (nHalvingInterval * 3 - 1);
nSubsidy /= nHalvingInterval * 3;
return nSubsidy + nFees;
}
This is the corresponding hard fork proposal, with switchover scheduled for block 42'0000:
CAmount GetBlockValue(int nHeight, const CAmount &nFees) {
int nHalvingInterval = Params().SubsidyHalvingInterval();
int nHalvings = nHeight / nHalvingInterval;
// Force subsidy to zero when right shift is undefined.
if (nHalvings >= 64)
return nFees;
// Subsidy is cut in half every 210000 blocks which will occur approximately every 4 years.
int64_t nSubsidy = COIN * 50 >> nHalvings;
// Smoothened subsidy commences after the second halving, i.e. at block 420000.
if (nHalvings >= 2) {
// Subsidy decreases linearily, beginning with 4/3, ending with 2/3 of the nominal value.
nSubsidy *= nHalvingInterval * 4 - nHeight % nHalvingInterval * 2 - 1;
nSubsidy += nHeight * 2 / nHalvingInterval % 2 * (nHalvingInterval * 3 - 1);
nSubsidy /= nHalvingInterval * 3;
}
return nSubsidy + nFees;
}
Edit: This is the final version.