mirror of
https://github.com/jwinterm/blockchain-emission-analysis.git
synced 2026-10-17 05:41:36 +02:00
fix bitcoin calculated data
This commit is contained in:
+3
-5
@@ -7,13 +7,13 @@ class Bitcoin(blockchain.Blockchain):
|
||||
# First generate fully calculated date and reward data
|
||||
self.blocks = np.arange(0, self.number_of_blocks, self.block_skip)
|
||||
self.launch_time = 1231006505
|
||||
self.time = self.blocks*600*self.block_skip + self.launch_time
|
||||
self.time = self.blocks*600 + self.launch_time
|
||||
self.date = np.array(self.time, dtype='datetime64[s]')
|
||||
self.reward = np.zeros(len(self.blocks))
|
||||
self.cum_reward = np.zeros(len(self.blocks))
|
||||
for i in range(len(self.blocks)):
|
||||
self.reward[i] = ((np.uint(50e8)//2**((i*self.block_skip)//210000))*1e-8) * self.block_skip
|
||||
self.cum_reward[i] += self.reward[i]
|
||||
self.cum_reward[i] = self.cum_reward[i-1] + self.reward[i] if i > 0 else self.reward[i]
|
||||
|
||||
# Historical data for bitcoin emission
|
||||
self.date_historical = [np.datetime64('2009-01-03'), np.datetime64('2012-11-28'), np.datetime64('2016-07-09'), np.datetime64('2024-04-20')]
|
||||
@@ -25,6 +25,4 @@ class Bitcoin(blockchain.Blockchain):
|
||||
for i in range(len(self.date_historical)):
|
||||
self.reward_historical[i] = 210000*(np.uint(50e8)//2**i)*1e-8
|
||||
if i < len(self.date_historical)-1:
|
||||
self.cum_reward_historical[i+1] = self.cum_reward_historical[i] + self.reward_historical[i]
|
||||
print(i, self.date_historical[i], self.reward_historical[i], self.cum_reward_historical[i])
|
||||
print(self.date_historical, self.cum_reward_historical)
|
||||
self.cum_reward_historical[i+1] = self.cum_reward_historical[i] + self.reward_historical[i]
|
||||
@@ -12,21 +12,22 @@ xmr = monero.Monero(40e6, 100)
|
||||
wow = wownero.Wownero(15e6, 100)
|
||||
|
||||
# Adjusting the date to start at the same time
|
||||
xmr.date = xmr.date - (xmr.date[0] - btc.date_historical[0])
|
||||
wow.date = wow.date - (wow.date[0] - btc.date_historical[0])
|
||||
btc.time = (btc.time - btc.time[0])/60/60/24/365
|
||||
xmr.time = (xmr.time - xmr.time[0])/60/60/24/365
|
||||
wow.time = (wow.time - wow.time[0])/60/60/24/365
|
||||
# Normalizing the data by the total number of coins (or 18.132e6 for Monero)
|
||||
btc.cum_reward_historical = btc.cum_reward_historical / btc.cum_reward_historical[-1]
|
||||
btc.cum_reward = btc.cum_reward / btc.cum_reward[-1]
|
||||
xmr.cum_reward = xmr.cum_reward / 18.132e6
|
||||
wow.cum_reward = wow.cum_reward / wow.cum_reward[-1]
|
||||
|
||||
# Plotting the data
|
||||
plt.plot(btc.date_historical, btc.cum_reward_historical, '-', color='orange', label='Bitcoin')
|
||||
plt.plot(xmr.date, xmr.cum_reward, '--', color='grey', label='Monero')
|
||||
plt.plot(wow.date, wow.cum_reward, '-.', color='pink', label='Wownero')
|
||||
plt.plot(btc.time, btc.cum_reward, '-', color='orange', label='Bitcoin')
|
||||
plt.plot(xmr.time, xmr.cum_reward, '--', color='grey', label='Monero')
|
||||
plt.plot(wow.time, wow.cum_reward, '-.', color='pink', label='Wownero')
|
||||
|
||||
# Adding labels, grid, legend, etc
|
||||
plt.xlabel('Time (years)')
|
||||
plt.ylabel('% total coins emitted (pre-tail emission)')
|
||||
plt.xlabel('Time since launch (years)')
|
||||
plt.ylabel('Total coins emitted (pre-tail emission)')
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user