# Going Deep into Baseline Minting
###### tags: `Articles`
All visualizations and projections are based on public Filecoin data and can be found at https://blockscience.github.io/filecoin-metrics/notebooks/baseline_crossing.html
___
As of 29 April 2021, 25 Million FIL was distributed through Simple Minting, and 36 Million FIL was distributed through Baseline Minting. This gives a combined total of 61 Million FIL that was minted through storage mining.

___
About 59% of the current rewards were distributed through Baseline Minting, and 41% through Simple Minting. Interestingly, this was not always the case, as about 80% of the Rewards of the Mainnet launch were distributed through Simple Minting.

### Consequences of Baseline
Most Blockchains uses a Minting function that halves the rewards after a given amount of time (6 years in the case of Filecoin).
In intuitive terms, Baseline Minting can be easily described as being the usual exponential minting function, but with time slowing down the the network activity is low in regards to a target.
That target is the baseline function, and as of now it is described by:
$$
b(t) = b_0(1+g_0)^\frac{t}{1yr},
$$
Where $b_0$ is the initial baseline (2888 PB) and $g_0$ is the baseline annual growth (currently 100%). The baseline function and parameters can be tweaked in the future for better conforming to the network reality through FIPs.
___
Rather than naively using the actual time, Baseline minting uses the concept of "effective network time", which can be understood as time going slower when the Storage Power of the network is below a moving target.
When the baseline function was crossed on April 2nd, that effective time was lagging 102 days behind the real time. For minting purposes, it was if we were on 21th December 2020!

When it is nearly above the target, then the "effective time" can be a bit faster than the normal time in order to allow the network to rebound.
And when Storage Power is identically zero, then the effective network time gets stopped in time, which will cause to not having any rewards due to Baseline Minting being distributed.
Lastly, when the Storage Power is midway in between, then it gets more complicated. It could be half as slower or not, it really depends on the network history and situation.
The following figure provides a stylized visualization for how quickly the Effective Network Time grows as a fraction of the Real Time when the Network Power is always 50% of the Baseline Function. Initially, it would grow as slow as 35% of the Real Time, and by the end of 10 years, it would grow as 70% as fast as the Real Time.

___
A richer description of what actually happens can be done by simulating what happens near the Baseline Crossing by taking imaginated scenarios of the Network Power trajectory.
For instance, let's assume that the RB Network Power is constantly 10 EiB since launch, and we've waited the Baseline Function cross it.
When this happens, the instantaneous share of the daily block rewards due to the Baseline Function ceases to be 70%, and rather goes down with time. Additionally, the Effective Network Time Lag that was previously zero starts to increase with time.

___
A more complicated example for gaining intuition is to visualize what happens when the network starts below the baseline function (just like in real life), crosses it, and then gets below the baseline after some time.
Notice that the instantaneous share of the block rewards due to Baseline Minting is maximized at the first crossing, and it slowly decays until it crosses below, on which the share of baseline rewards falls quasi-linearly.
Additionally, we can observe the Effective Network Time behaviour with more detail. The Lag between the Effective and Real times starts to decrease just before the crossing, just like in real life!

___
Lastly, it is also possible to estimate the share of Filecoin participation on Storage Markets by taking known studies, like the 'The Digitization of the World: From Edge to Core' white paper by Seagate. (https://www.seagate.com/files/www-content/our-story/trends/files/idc-seagate-dataage-whitepaper.pdf)
As of the Baseline Crossing, the Filecoin Raw-Bytes network power is circa 0.021% of the entire World Storage available on Public Clouds.

### Baseline Growth versus Network Growth
A interesting projection is to estimate how the current RB Network Power growth trends compare to the baseline growth function over the future.
If we assume that there's a **logistic growth trend**, which is equivalent to assume **an constant growth rate over time over the rate of added capacity**, then we can expect that the RB Network Power will remaining above the baseline for the remaining of the year. The below figure show a projection over the next 6 months.

## References
- Minting Model, Filecoin Spec: https://spec.filecoin.io/#section-systems.filecoin_token.minting_model
- Filecoin CryptoEconomics, Filecoin Spec: https://spec.filecoin.io/algorithms/cryptoecon/
- Understanding Filecoin's Economy, Part I: https://blog.textile.io/understanding-filecoins-economy-part-i/
___
## Left-overs
>I'm not sure about this? If $R(t) = 0.5*b(t)$, then
>$$
>\bar{R}_\Sigma(t) := \int_0^t dx \ \bar{R}(x) = \int_0^t dx (0.5b(x)) = \\
>0.5b_0\int_0^t dx (1 + g_0)^x = \frac{0.5b_0}{\ln(1 + g_0)} \left ( (1 + g_0)^t - 1 \right ).
>$$
>This means
>$$
>\int_0^{\theta(t)} dx \ b(x) = \bar{R}_\Sigma(t) \Leftrightarrow \\
>\frac{b_0}{\ln(1 + g_0)} \left ( (1 + g_0)^{\theta(t)} - 1 \right ) = \frac{0.5b_0}{\ln(1 + g_0)} \left ( (1 + g_0)^t - 1 \right ) \Rightarrow \\
> (1+g_0)^{\theta(t)} = 0.5((1+g_0)^{t} + 1),
>$$
>or
>$$
>\theta(t) = \frac{1}{\ln(1 + g_0)} \left ( \ln \left ( (1+g_0)^t + 1 \right ) + \ln(0.5) \right )
>$$
>So in particular when network power is half the baseline there's a _shift_ in $t$---we know $\theta(t)$ is less than $t$, but it's not smaller by a multiple of 0.5.
>[name=jshorish]
>Yes, this is wrong. But maybe the intuition Danilo had in mind is that if we take a derivative w.r.t t in both sides of the equation defining $\theta(t)$, we would get something like $b(\theta(t)) \dot{\theta}(t) = \bar{R}(t)$. If we have then $R(t) = \frac{1}{2} b(t)$, $\dot{\theta}(t) = \frac{1}{2} \frac{b(t)}{b(\theta(t))} \geq \frac{1}{2}$. Then, if $\theta(t)$ is sufficiently close to $t$, $\dot{\theta}(t) \sim \frac{1}{2}$.
>[name=Gabriel]
### But what is actually Baseline Minting?
:::info
Describe how Block Reward is calculated from Minting here. Maybe it's better to move this section to the end?
:::
Let $M_\infty$ be the total number of tokens to be distributed as Block Rewards. The number of tokens to be distributed through Simple Minting up to a time $t$ is given by
$$
M_S(t) = M_{S,\infty} \left(1 - e^{-\lambda t}\right)
$$
where $\lambda = \frac{\ln 2}{6 \ \text{years}}$ and $M_{S,\infty} \equiv (1-\gamma) M_\infty$ is the total number of tokens to be distributed via Simple Minting, where $\gamma$ is between $0$ and $1$. The interpretation using $\lambda$ is simple: at each time, we will distribute half of the tokens available over the next 6 years. Mathematically this 'half-life' statement is equivalent to
$$
\frac{M_{S,\infty} - M_S(t)}{M_{S,\infty} - M_S(t + 6 \ \text{years})} = 2,
$$
which can be easily verified.
Simple minting alone distributes far too many tokens in the early stages of the network, thereby incentivizing early participants to reap early rewards while not contributing to the stability of the network in the long term.
That's why we only use such a mechanism to distribute a fraction of the Block Rewards. The remaining rewards are distributed through Baseline Minting.
Baseline and Simple Minting have a very similar shape. The number of tokens distributed via Baseline Minting up to a time $t$ is given by
$$
M_B(t) = M_{B,\infty} \left(1-e^{-\lambda \theta(t)}\right)
$$
where, again, $M_{B, \infty} \equiv \gamma M_\infty$ is the total number of tokens to be distributed via Baseline Minting. Note that the only difference from the previous case is that now we have an "effective network time" $\theta(t)$ which is given by the actual time and the state of the network, as we will see below.
###
Before we dig into details, let's discuss three properties of this "effective network time".
- The first one is that $\theta(t) < t$ for all times. This fact implies that the tokens are distributed _more slowly_ than they are via Simple Minting: with Baseline Minting, it will take more than 6 years to distribute half of the remaining tokens.
- The second property is that the more time we have the Network Power above a particluar _target_ (described below), the more $\theta(t)$ gets closer to $t$.
- Finally, $\theta(t)$ is monotonically increasing.
The intuition one should have in mind is that time "slows down" whenever the Network Power is below the target. (Another name used for the target is "baseline", hence the name "Baseline Minting".)
Let's go back to the details. We need two ingredients to calculate $\theta(t)$:
- We need to know the _instantaneous Network Power_. This state-dependent quantity measures the number of bytes within active sectors, and we will call it $R(t)$.
- As the name of the mechanism suggests, we also need to have a _baseline function_ $b(t)$. In our case, the baseline starts at some value $b_0$ and grows at an annual rate $g_0$. In other words, the baseline function is given by
$$
b(t) = b_0(1+g_0)^\frac{t}{y_s},
$$
where $y_s = 1 \ \text{year}$.
To help with this let's first define the auxiliary variable
$$
\bar{R}(t) \equiv \min(R(t),b(t)),
$$
giving us always the _smaller_ of instantaneous Network Power and the baseline function at $t$.
Using $\bar{R}(t)$ we calculate $\theta(t)$, the effective network time, to be _the time that **would** be needed for the cumulative baseline function to equal $\bar{R}_{\Sigma}(t)$, the cumulative minimum of Network Power and the baseline function_):
$$
\int_0^{\theta(t)} dx \ b(x) = \int_0^t dx \ \bar{R}(x) \equiv \bar{R}_\Sigma(t)
$$
Why compute $\theta(t)$ this way? It encodes the three properties discussed above: first, notice that if $R(t)$ were _always_ above $b(t)$, then $\theta(t) = t$ (the two integrals are exactly the same). So the degree to which $R(t)$ is less than the baseline function $b(t)$ is expressed by how different $\theta(t)$ and $t$ are. Second, if $R(t)$ is sometimes strictly smaller than the baseline $b(t)$, then the second integral is strictly less than the first when $\theta(t) = t$. This means that the second integral has _less mass_, and so $\theta(t) < t$ in the first integral. Finally, the latter property also implies the monotonicity of $\theta(t)$ in $t$, since the mass of the first integral must increase with the mass of the second when $t$ increases.
We can solve for $\theta(t)$ by plugging in the explicit expression for $b(t)$ and get its closed form (although as we've seen, it's much easier to derive the properties we listed directly from the equation above). The solution reads
$$
\theta(t) = \frac{1}{g} \ln\left(1 + \frac{g \bar{R}_{\Sigma}(t) }{b_0}\right)
$$
where $g \equiv \frac{\ln(1+g_0)}{y_s}$.
___