Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token emission models #594

Open
tieubao opened this issue Sep 25, 2024 · 2 comments
Open

Token emission models #594

tieubao opened this issue Sep 25, 2024 · 2 comments

Comments

@tieubao
Copy link
Owner

tieubao commented Sep 25, 2024

Common token emission models are based on a few key factors, such as time, initial supply, emission rate, and decay over time.

output

  • Fixed Supply with Halving: The emission rate halves after each halving period (similar to Bitcoin).
  • Exponential Decay Emission: The emission decreases exponentially over time, following a decay curve.
  • Linear Decay Emission: The emission decreases linearly over time until it reaches zero.
  • Fixed Supply with No Emission: After an initial distribution, there is no further emission.
  • Constant Emission: A flat, constant rate of token emission over time.
  • Bonding Curve: A relationship between supply and price, showing how token price might change as supply increases.
@tieubao
Copy link
Owner Author

tieubao commented Sep 25, 2024

import numpy as np
import matplotlib.pyplot as plt

# Time period for analysis (in years or arbitrary units)
time = np.arange(0, 20, 0.1)

# 1. Fixed Supply with Halving (Bitcoin-style)
initial_supply_bitcoin = 50
halving_period = 4
emission_bitcoin = initial_supply_bitcoin / (2 ** (time // halving_period))

# 2. Exponential Decay Emission
initial_rate_exponential = 50
lambda_decay = 0.3
emission_exponential = initial_rate_exponential * np.exp(-lambda_decay * time)

# 3. Linear Decay Emission
initial_rate_linear = 50
alpha = 2  # Linear decrease per unit time
emission_linear = np.maximum(0, initial_rate_linear - alpha * time)

# 4. Fixed Supply with No Emission After Initial Distribution
emission_fixed = np.zeros_like(time)

# 5. Constant Emission (Flat Rate)
fixed_rate = 10
emission_flat = np.full_like(time, fixed_rate)

# 6. Bonding Curve (Price varies with supply, a simplified model)
A = 1
B = 0.5
supply_bonding = np.arange(1, len(time)+1)  # assuming supply grows over time
price_bonding = A * np.power(supply_bonding, B)

# Plot the results
fig, ax = plt.subplots(3, 2, figsize=(12, 10))

# 1. Fixed Supply with Halving
ax[0, 0].plot(time, emission_bitcoin, label="Bitcoin-style Halving")
ax[0, 0].set_title("Fixed Supply with Halving")
ax[0, 0].set_xlabel("Time")
ax[0, 0].set_ylabel("Emission")

# 2. Exponential Decay Emission
ax[0, 1].plot(time, emission_exponential, label="Exponential Decay", color='orange')
ax[0, 1].set_title("Exponential Decay Emission")
ax[0, 1].set_xlabel("Time")
ax[0, 1].set_ylabel("Emission")

# 3. Linear Decay Emission
ax[1, 0].plot(time, emission_linear, label="Linear Decay", color='green')
ax[1, 0].set_title("Linear Decay Emission")
ax[1, 0].set_xlabel("Time")
ax[1, 0].set_ylabel("Emission")

# 4. Fixed Supply with No Emission After Initial Distribution
ax[1, 1].plot(time, emission_fixed, label="No Emission After Distribution", color='red')
ax[1, 1].set_title("Fixed Supply (No Emission After Initial)")
ax[1, 1].set_xlabel("Time")
ax[1, 1].set_ylabel("Emission")

# 5. Constant Emission (Flat Rate)
ax[2, 0].plot(time, emission_flat, label="Flat Emission", color='purple')
ax[2, 0].set_title("Constant Emission (Flat Rate)")
ax[2, 0].set_xlabel("Time")
ax[2, 0].set_ylabel("Emission")

# 6. Bonding Curve Emission
ax[2, 1].plot(time, price_bonding, label="Bonding Curve", color='brown')
ax[2, 1].set_title("Bonding Curve (Supply-Price Relationship)")
ax[2, 1].set_xlabel("Time")
ax[2, 1].set_ylabel("Price")

# Adjust layout
plt.tight_layout()

# Show the plots
plt.show()

@tieubao
Copy link
Owner Author

tieubao commented Sep 25, 2024

1. Fixed Supply with Halving (Bitcoin-style Emission)

  • Formula:

$$ \text{Emission} = \frac{\text{Initial Supply}}{2^{\text{Halving Period}}} $$

  • Example: Every four years, the number of tokens emitted per block is halved. This is used to ensure scarcity over time.

2. Exponential Decay Emission

  • Formula:

$$ \text{Emission}(t) = \text{Initial Rate} \times e^{-\lambda t} $$

Where:

  • λ is the decay rate (constant),
  • t is time,
  • Initial Rate is the initial emission rate at t=0

This model gradually reduces the emission rate over time. It's typically used to ensure that the supply growth decreases as the network matures.

3. Linear Decay Emission

  • Formula:

$$ \text{Emission}(t) = \text{Initial Rate} - \alpha t $$

Where:

  • α is the rate of decrease per time unit,
  • t is time.

The emission decreases at a constant rate until it reaches a minimum or predetermined supply.

4. Fixed Supply with No Emission After Initial Distribution

  • Formula:

$$ \text{Emission} = 0 $$

In this case, the entire token supply is pre-mined or distributed at launch, and there are no further emissions.

5. Constant Emission (Flat Rate)

  • Formula:

$$ \text{Emission} = \text{Fixed Rate} $$

A fixed number of tokens are emitted per block or time interval. This is typically seen in inflationary models where the supply grows indefinitely at a constant rate.

6. Bonding Curves for Dynamic Supply

  • Formula:

$$ \text{Price} = \text{A} \times \text{Supply}^B $$

Where:

  • A and B are constants based on the bonding curve design,
  • Supply is the current token supply.

Bonding curves are used in some protocols to dynamically adjust token prices based on demand and supply, effectively managing token emission.

7. Custom Emission Models (e.g., Liquidity Mining)

Some protocols like DeFi projects use liquidity mining programs with complex reward structures that combine different elements:

  • Emission based on user participation,
  • Time-based rewards,
  • Bonus emissions for early participants, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant