Skip to content

Instantly share code, notes, and snippets.

@machard
Created June 26, 2025 03:24
Show Gist options
  • Save machard/615995dfc6afa26b1f784da90f53cd42 to your computer and use it in GitHub Desktop.
Save machard/615995dfc6afa26b1f784da90f53cd42 to your computer and use it in GitHub Desktop.
definitive bitcoin model
import numpy as np
import matplotlib.pyplot as plt
# Time vector
t = np.linspace(2000, 2045, 1000)
# --- Total Population (in billions) ---
def total_population(t):
return 6 + 2.2 / (1 + np.exp(-0.05 * (t - 2025))) # asymptotes toward ~8.2B
# --- Internet Penetration (logistic) ---
L = 0.9 # 90% max penetration
k = 0.15
t0 = 2023
penetration = L / (1 + np.exp(-k * (t - t0)))
# --- Online and Offline Minds ---
total_pop = total_population(t)
online_minds = penetration * total_pop
offline_minds = total_pop - online_minds
# --- BTC Price: log-normal shape with noise ---
x = (t - 2025) / 5
log_like = np.exp(-0.5 * x**2)
np.random.seed(42)
noise = np.random.normal(0, 0.15, size=len(t))
btc_raw = log_like * (1 + noise)
# --- Smooth scaling: BTC stays under both curves but with margin ---
btc_ceiling = np.minimum(online_minds, offline_minds) * 0.95
btc_scaled = 0.1 + (btc_raw - btc_raw.min()) / (btc_raw.max() - btc_raw.min()) * (btc_ceiling.max() - 0.1)
btc_price = np.minimum(btc_scaled, btc_ceiling)
# --- Plotting ---
fig, ax1 = plt.subplots(figsize=(11, 6))
# Population curves
ax1.plot(t, total_pop, color='black', linewidth=2.5, label='Total Population (Billions)')
ax1.plot(t, online_minds, color='green', linewidth=2.5, label='Online Minds (Billions)')
ax1.plot(t, offline_minds, color='gray', linewidth=2.5, linestyle='--', label='Offline Minds (Billions)')
ax1.set_ylabel('Population (Billions)', fontsize=12)
ax1.set_xlabel('Year', fontsize=12)
ax1.tick_params(axis='y', labelcolor='black')
ax1.set_ylim(0, 9)
# BTC price on secondary axis
ax2 = ax1.twinx()
ax2.plot(t, btc_price, color='blue', linewidth=2, label='BTC Price (Scaled)')
ax2.set_ylabel('BTC Price (Scaled to Billions)', fontsize=12, color='blue')
ax2.tick_params(axis='y', labelcolor='blue')
ax2.set_ylim(0, 9)
# Vertical marker
ax1.axvline(x=2025, color='red', linestyle=':', linewidth=1)
ax1.text(2025.5, 1, '2025', color='red')
# Legends
lines1, labels1 = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
fig.legend(lines1 + lines2, labels1 + labels2, loc='upper left', fontsize=10)
plt.title('BTC Price vs Global Population Substrates (2000–2045)', fontsize=14)
ax1.grid(True, linestyle='--', alpha=0.5)
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment