Browse Source

Exactly simulate the Hush block reward until it hits zero at halving 31

pull/131/head
Duke Leto 4 years ago
parent
commit
0a96fdc63f
  1. 109
      contrib/hush_supply

109
contrib/hush_supply

@ -53,24 +53,38 @@ printf "# block, supply, reward, subsidy, fr, totalfr, halvings\n";
# 12.5 * 100000000 / 32768 = 38146.97265625
# 12.5 * 100000000 / 65536 = 19073.486328125
# Halving Block Heights
# 340000 + 1680000 = 2020000
# 340000 + 1680000*2 = 3700000
# 340000 + 1680000*3 = 5380000
# 340000 + 1680000*4 = 7060000
# 340000 + 1680000*5 = 8740000
# 340000 + 1680000*6 = 10420000
# 340000 + 1680000*7 = 12100000
# 340000 + 1680000*8 = 13780000
# 340000 + 1680000*9 = 15460000
# 340000 + 1680000*10 = 17140000
# 340000 + 1680000*11 = 18820000
# 340000 + 1680000*12 = 20500000
# 340000 + 1680000*13 = 22180000
# 340000 + 1680000*14 = 23860000
# 340000 + 1680000*15 = 25540000
# Hush Halving Heights and Block Rewards
# 1,12500000000,340000
# 2,312500000,2020000
# 3,156250000,3700000
# 4,78125000,5380000
# 5,39062500,7060000
# 6,19531250,8740000
# 7,9765625,10420000
# 8,4882812,12100000
# 9,2441406,13780000
# 10,1220703,15460000
# 11,610351,17140000
# 12,305175,18820000
# 13,152587,20500000
# 14,76293,22180000
# 15,38146,23860000
# 16,19073,25540000
# 17,9536,27220000
# 18,4768,28900000
# 19,2384,30580000
# 20,1192,32260000
# 21,596,33940000
# 22,298,35620000
# 23,149,37300000
# 24,74,38980000
# 25,37,40660000
# 26,18,42340000
# 27,9,44020000
# 28,4,45700000
# 29,2,47380000
# 30,1,49060000
# 31,0,50740000
sub hush_block_reward
@ -79,18 +93,65 @@ sub hush_block_reward
my $height = shift;
my $halvings = 0;
# TODO: Cover all halvings until BR=0
if ($height >= 23860000) {
if ($height >= 50740000) {
$reward = 0;
$halvings = 31;
} elsif ($height >= 49060000) {
$reward = 1;
$halvings = 30;
} elsif ($height >= 47380000) {
$reward = 1;
$halvings = 29;
} elsif ($height >= 45700000) {
$reward = 2;
$halvings = 28;
} elsif ($height >= 44020000) {
$reward = 4;
$halvings = 27;
} elsif ($height >= 42340000) {
$reward = 9;
$halvings = 26;
} elsif ($height >= 40660000) {
$reward = 18;
$halvings = 25;
} elsif ($height >= 38980000) {
$reward = 37;
$halvings = 24;
} elsif ($height >= 37380000) {
$reward = 74;
$halvings = 23;
} elsif ($height >= 35620000) {
$reward = 149;
$halvings = 22;
} elsif ($height >= 33940000) {
$reward = 298;
$halvings = 21;
} elsif ($height >= 32260001) {
$reward = 596;
$halvings = 20;
} elsif ($height >= 30580000) {
$reward = 1192;
$halvings = 19;
} elsif ($height >= 28900000) {
$reward = 2384;
$halvings = 18;
} elsif ($height >= 27220000) {
$reward = 4768;
$halvings = 17;
} elsif ($height >= 25540000) {
$reward = 9536;
$halvings = 16;
} elsif ($height >= 23860000) {
$reward = 19073; # 0.486328125 deviation
$halvings = 15;
} elsif ($height >= 22180000) {
$reward = 38146; # 0.97265625 deviation
$halvings = 14;
} elsif ($height >= 20500000) {
$reward = 152587; # 0.890625sat deviation
$reward = 76293; # 0.9453125 deviation
$halvings = 13;
} elsif ($height >= 18820000) {
$reward = 305175; # 0.78125sat deviation
$reward = 152587; # 0.890625 deviation
$halvings = 12;
} elsif ($height >= 17140000) {
$reward = 305175; # 0.78125sat deviation
@ -132,8 +193,8 @@ sub hush_block_reward
return ($reward,$halvings);
}
# We know BR will go to zero between 7 and 8th halvings
while ($halvings <= 10) {
# Block reward is 0 at the 31st halving
while ($halvings <= 30) {
$block++;
my ($reward,$halvings) = hush_block_reward($block);
my $fr = int($reward / 10);

Loading…
Cancel
Save