forked from pharesim/hz-blockexplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodebountyprojection.py
131 lines (98 loc) · 4.97 KB
/
nodebountyprojection.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
license="""
##############################################################
## ##
## Remaining HZ distribution ##
## Version v01 "indepence" ##
## (4th of July 2015) ##
## ##
##############################################################
## To be take with a grain of salt! ##
## ##
## Very unclear: future number of hallmarked nodes ##
## Unknown: regular bounties for other-than-node-bounties ##
## ##
## All this is open for discussion. Not truth, but maths. ##
##############################################################
## ##
## Done by: altsheets ##
## License: giveback license v04 ##
## http://altsheets.ddns.net/give/ ##
## Donate to: NHZ-Q675-SGBG-LQ43-D38L6 - thx ##
## ##
##############################################################
"""
## TODO: get this from https://explorer.horizonplatform.io/api.php?page=distributed
## 4/July/2015 13:15 UTC: 851306829.88887 HZ
undistributed = 1000000000 - 851306829.88887
dateToday = "4 July 2015"
## new rule was announced in
## https://bitcointalk.org/index.php?topic=823785.msg11784831#msg11784831
dailyRatePercent = 0.5
## choosable parameters:
## node bounty payment of the past 7 days were:
## 458.0852039, 495.5401388, 510.2040816, 571.1022273, 570.1254276, 591.7159763, 479.8464491
## --> average 525 HZ --> 10^6 / 525 = 1905
numberOfPaidNodes = 1905
## please give suggestions how that number might change with payout.
# starting values, they get changed once per table,
# table ends when the threshold is crossed:
stopAt = 100 # threshold: daily payout per node minimum HZ
HZdigits = 0 # digits for the last column (per node bounty)
printEveryXdays=15
## Not only hallmarked nodes get bounties.
## There are all kinds of other bounties, e.g. for the team;
## this is the starting value, later it might reduced?
otherBountiesPerDay = 0
## TODO: set to 0 until (e.g. an average value for the past 3 months) has been said.
## constants
dateformat = "%d %B %Y"
line = "%18s: left = %9d HZ -> per day --> other: %d HZ; nodes: %d HZ = %d * %s HZ"
import datetime
oneDay = datetime.timedelta(days=1)
def extrapolateNodeBounties(stopAt, printEveryXdays, firstDay,
ud, otherBountiesPerDay, HZdigits):
"it would be nice to have a comment which explains this *lol*"
day = datetime.datetime.strptime(firstDay, dateformat)
dayCount = 0 # for printEveryXdays
stopNow = False # flag for one more print if threshold crossed
while (True):
nodeBountiesThatDay = ud * dailyRatePercent / 100
dTD_perNode = nodeBountiesThatDay / numberOfPaidNodes
if (dayCount % printEveryXdays==0
or stopNow):
perNode = ("%." + "%d" % (HZdigits) + "f") % dTD_perNode
print line % (datetime.datetime.strftime(day, dateformat),
ud, otherBountiesPerDay,
nodeBountiesThatDay, numberOfPaidNodes, perNode)
ud = ud - nodeBountiesThatDay - otherBountiesPerDay
day = day + oneDay
dayCount += 1
if stopNow: break
if (dTD_perNode<stopAt): stopNow = True
return datetime.datetime.strftime(day, dateformat), ud
def successionOfTables(firstDay = dateToday, ud = undistributed):
# the 2 starting values get reduced in each iteration.
# print several successive tables:
global stopAt, printEveryXdays, otherBountiesPerDay, HZdigits
firstDay, ud = extrapolateNodeBounties(stopAt, printEveryXdays, firstDay,
ud, otherBountiesPerDay, HZdigits)
print "daily node bounty threshold crossed. Remaining: %d HZ for %s" % (ud, firstDay)
print
printEveryXdays *= 2
stopAt /= 10
HZdigits += 1
otherBountiesPerDay /= 5
firstDay, ud = extrapolateNodeBounties(stopAt, printEveryXdays, firstDay,
ud, otherBountiesPerDay, HZdigits)
print "daily node bounty threshold crossed. Remaining: %d HZ for %s" % (ud, firstDay)
print
printEveryXdays *= 2
stopAt /= 5
HZdigits += 1
otherBountiesPerDay /= 5
firstDay, ud = extrapolateNodeBounties(stopAt, printEveryXdays, firstDay,
ud, otherBountiesPerDay, HZdigits)
print "daily node bounty threshold crossed. Remaining: %d HZ for %s" % (ud, firstDay)
if __name__ == "__main__":
print license
successionOfTables()