This is the formula I have been using:
var COINS_PER_BLOCK_PHASE1 = 8,
BLOCK_PHASE2 = 263708,
COINS_PER_BLOCK_PHASE2 = 4,
BLOCK_PHASE3 = 334000,
COINS_PER_BLOCK_PHASE3 = 1,
// uncles rewards
// but NOT counted into supply yet in v0.2.7 !
// ignorant devs, see https://github.com/ethereum/go-ethereum/issues/2088
COINS_PER_UNCLE0_PHASE1 = 7,
COINS_PER_UNCLE1_PHASE1 = 6,
COINS_PER_UNCLE0_PHASE2 = 3.5,
COINS_PER_UNCLE1_PHASE2 = 3,
COINS_PER_UNCLE0_PHASE3 = 0.875,
COINS_PER_UNCLE1_PHASE3 = 0.75,
...
var mined = function(blockNumber){
var coins = 0;
// blocks until 263707, reward 8
if (blockNumber < BLOCK_PHASE2) {
coins += COINS_PER_BLOCK_PHASE1 * blockNumber;
}
else{
coins += COINS_PER_BLOCK_PHASE1 * (BLOCK_PHASE2 - 1)
// blocks until 333999, reward 4
if (blockNumber < BLOCK_PHASE3) {
coins += COINS_PER_BLOCK_PHASE2 * (blockNumber - BLOCK_PHASE2 + 1);
}
else{
coins += COINS_PER_BLOCK_PHASE2 * (BLOCK_PHASE3 - BLOCK_PHASE2)
// blocks since 334000, reward 1
coins += COINS_PER_BLOCK_PHASE3 * (blockNumber - BLOCK_PHASE3 + 1)
}
}
// TODO: There have been later changes, please someone extend this.
return coins;
}
// block rewards:
// see
https://bitcointalk.org/index.php?topic=1176709.msg13207211#msg13207211 // and
https://bitcointalk.org/index.php?topic=1176709.msg13290036#msg13290036 // and
https://bitcointalk.org/index.php?topic=1176709.msg16635478#msg16635478but ... I think there is a "phase 4". When? How?