Hirocoin 0.8.6.5 - Dynamic Block Reward
Hard Fork on Block 224,000
Hard Fork on Block 224,000
It has been a long time in development but we have now released 0.8.6.5 with dynamic block reward. This is a variable block reward based on the history of the difficulty from the last 100 blocks. When the difficulty rises compared against the history the reward drops and when the difficulty drops compared to the history the reward rises. This will restore market confidence over the long term and will improve Hirocoin's standing in time for the impact of Scrypt ASICs being release from some of the more major hardware vendors.
For those that are interested the new code for GetBlockValue looks like the following. Normally the first argument is simply nHeight sometimes with +1, I added an argument for when the plus one is required and pass in CBlockIndex rather than just its nHeight value. We need the CBlockIndex to be able to reference the last 100 difficulty values.
The code is simple enough, we get the average of the last 100 difficulty values and then divide that into the current difficulty to get the weight to apply to the coin reward. The new coin reward can go from 40 to 400 depending on whether the diffuclty is going up, down or remains static.
I know what some of you are thinking, there is float maths in here and that will cause trouble. Wrong. I have tested this on Linux and Windows and can see the difference between platforms. It cannot effect the final coin value per block. The difference is six decimals deep on the diffTotal and has no impact
Code:
int64 static GetBlockValue(const CBlockIndex* pindexLast, int64 nFees, bool addOne)
{
int nHeight = pindexLast->nHeight;
if (addOne) {nHeight += 1;}
int mockSubsidy = 400;
if (nHeight > 224000) {
const CBlockIndex* pindexFirst = pindexLast;
mockSubsidy = 200; // Average reward
double diffTotal = 0;
double lastDiff = GetDifficulty(pindexLast);
for (int i = 0; pindexFirst && i < 100; i++) {
pindexFirst = pindexFirst->pprev;
diffTotal += GetDifficulty(pindexFirst);
}
double weight = (diffTotal / 100) / lastDiff;
if (weight > 2) weight = 2; // Max 400 reward
if (weight < 0.2) weight = 0.2; // Min 40 reward
mockSubsidy *= weight;
}
int64 nSubsidy = mockSubsidy * COIN;
// Subsidy is cut in half every 840000 blocks, which will occur approximately every ~1.6 years
nSubsidy >>= (nHeight / 840000);
return nSubsidy + nFees;
}
I have not gone anywhere, I will remain as Lead Developer on Hirocoin and I do not intend to leave. Hirocoin launched without any further maintenance required, many other coins look very busy after launch fixing all the loose ends. Hirocoin never needed to do that and perhaps the lack of activity got some people concerned rather than reassured by the lack of required maintenance.
I am always open to new ideas. Reducing the block reward was something I was never a fan of however a dynamic block reward seemed a much more interesting prospect as where this has been tried before it has been set to static values which max out and then never change after a certain point. The solution here will always remain dynamic and relevant. There is every chance that we will refine and improve on this solution in the future and hope that others will take this work on board in their own coins.
If you have any killer ideas that you want to see implemented then please give me a shout. I am always on the look out for good ideas to implement in Hirocoin. Send me a PM and I can meet up with you on Skype or somewhere of your choice.
Glad to see you back, after not buy cheap coins, with some regret。