---
# System prepended metadata

title: 'A Microeconomic Model for Polkadot: NPoS Economics'

---

**Author**: Eray Sabancilar

**Last updated**: 07.04.2020

# A Microeconomic Model for Polkadot: NPoS Economics

## Motivation

Interactions between different agents and components of Polkadot create a rich economic system. It is of paramount interest for the Polkadot community to have economic foreseeability. In particular, we want to keep track of interest & inflation rates and treasury activities in order to achive the desired price stability, DOT exchange rate and parachain slot pricing. 

In this note, we provide an agent based dynamic microeconomic model that aims to address some of these issues. Since Polkadot has various agent types and components with complicated interactions, we split the economic system into semi-independent parts that we can analyze separately and consistently. As a first step towards achiving this goal, we present a model for the Nominated Proof of Stake (NPoS) economics. This economic model is based on the interactions between and the decisions made by validators and nominators. 

We first introduce the agents, economic incentives, local variables, dynamics and global variables of the economic system. We list our simplifying assumptions, research questions that we want to address as well as the parameters of the model. We provide a Jupyter notebook implementation that simulates a time series evolution of this NPoS economic model. We finally discuss our results and highlight future directions.

## 1. Introduction

### 1.1. Economic Incentives

Polkadot has a number of validators and nominators, denoted as $N_n$ and $N_v$, respectively. In every era, $t \sim 1$ day, a new validator set is selected, and nominators can support up to 16 validators by allocating DOTs. As validators complete tasks they are rewarded with DOTs. Validators can charge commission fees, $fee_v$, in order to fund their operations and are incentivized for self staking. In fact, the rewards net of commission fees are distributed among the validator and the nominators backing that validator proportional to the stakes of each agent. Since new DOTs are minted every era, anyone who owns DOTs is incentivized to contribute to the network either by becoming nominators or validators so that their wealth is protected against the inflation. 

Validators are expected to be online all the time and responsible for keeping their infrastructure updated and free of bugs. If validators commit unresponsiveness or equivocation misbehavior, stakes of both these validators and those of nominators backing them may be slashed partially or completely depending on the severity of the misbehavior.

Now that we introduced the agents and their economic incentives, we describe the outcomes of their actions using local (agent specific) variables and dynamic decision mechanisms. We finally translate these into global variables that capture the overall state of the economic system and analyze their evolution in time.

### 1.2. Local Variables

We define the local variables that describe the state and the action of each agent as follows. All values are in nominal terms.

- **Stake**: The total stake backing validator $v$ is the sum of the self stake of validator $v$, $d_v(t)$, and the stakes of nominators $n_v$ backing that validator, $d_{n_v}(t)$:
    \begin{align}
    d_v^{\rm Tot}(t) = d_v(t) + \sum_{n_v} d_{n_v}(t).
    \end{align}
    
    The total stake in a given era is
    \begin{align}
    d^{\rm Tot}(t) = \sum_v d_v^{\rm Tot}(t).
    \end{align}

- **Payouts**: The total payout to validator $v$ and the nominators backing that validator given the nominal interest rate, $r(x(t-1))$, is 
    \begin{align}
    P_{v,n_v}(t) = \frac{d^{\rm Tot}(t-1)}{N_v}~r(x(t-1)), 
    \end{align} where we assume that each validator successfully achieves the tasks within an era and all of the validators are equally paid regardless of the stake backing them.
    - The payout of validator $v$ includes the part from the comission fee, $fee_v$, that is a fixed fraction of the total payout, and rewards proportional to its self stake net of fees: 
    \begin{align}
    P_v(t) = P_{v, n_v}(t)~fee_v + \frac{d_v(t-1)}{d_v^{\rm Tot}(t-1)} P_{v, n_v}(t) (1-fee_v).
    \end{align}
    - The payout to each nominator $n_v$ backing validator $v$ is:
    \begin{align}
    P_{n_v}(t) = \frac{d_{n_v}(t-1)}{d_v^{\rm Tot}(t-1)} P_{v, n_v}(t) (1-fee_v).
    \end{align}

- **Slashing**: Stakes backing validator $v$ are slashed if the validator $v$ commits a misbehavior, namely unresponsiveness or equivocation. We model the total slashing for the validator and the nominators backing it in the era $t$, $S_v(t), S_{n_v}(t)$, respectively, in terms of unresponsiveness and equivocation as
    \begin{align}
    S_{i}(t) = \left(U_v f_u + E_v f_e \right) d_{i}(t),
    \end{align} where $i = {v,n_v}$, and for unresponsiveness and equivocation, we respectively have
    \begin{align}
    U_v &\sim Bernoulli(p_u), \qquad f_u = 0.05 \min\left[\frac{3(k_u-1)}{N_v},1 \right] ,
    \\
    E_v &\sim Bernoulli(p_e), \qquad f_e = \min\left[\left(\frac{3k_e}{N_v}\right)^2,1 \right]. 
    \end{align} Here, $N_v$ is the total number of validators, $k_u$ and $k_e$ are the total number of unreponsiveness and equivocation acts in a given era, respectively, and we assume that $p_e < p_u \ll 1$ since we expect equivocation misbehavior to be rare. In what follows, we set $p_u = 1/60$ and $p_e = 1/240$ so that unresponsiveness occurs once every other month whereas equivocation occurs roughly once every other 8 months.

- **Wealth**: We assume that there is no injection of external funds. Therefore, the nominal wealth process of a validator, $W_v(x(t),t)$ and nominators backing it, $W_{n_v}(x(t),t)$ depend only on the wealth and the payout from the previous era as well as the slashing that may have occured. For an agent $i = {v,n_v}$: 
    \begin{align}
    W_i(x(t),t) = W_i(x(t-1),t-1) + P_i(t) - S_i(t).
    \end{align}

### 1.3. Staking Process

We assume that validators and nominators are both rational agents and make their staking decision based solely on their financial state. We introduce a set of parameters that capture the decision process in what follows.

- **Opportunity Cost of Capital**: We assume that nominators and the validators they back make staking decisions based on a comparasion of their return with an opportunity cost of capital, $R_{\rm opp}$, which can be considered as a cost for not investing outside Polkadot. Thus, $R_{\rm opp}$ can be estimated using the market data, e.g., from a return of a diversified cryptocurrency portfolio. Each agent may have a different $R_{\rm opp}$ reflecting their risk aversion and expectation. In this version of the model, however, we consider a generic value assuming all agents have the same $R_{\rm opp}$.

- **Staking Stickiness**: Validator $v$ and its nominators $n_v$ can change their stake at the end of every era. We assume that an agent usually does not make such frequent decisions and is likely to keep its stake the same for a while. We model staking stickiness with a Bernoulli random variable with probability $p_s = 1/7$ so that an agent, $i = {v,n_v}$, updates its stakes roughly once a week:
    \begin{align} Update_i \sim Bernoulli(p_s). \end{align} Thus, a staking decision is made as follows: 
    - Update stakes if $Update_i = 1$.
    - Keep the stakes same if $Update_i = 0$.

- **Staking Decision**: We assume that if $Update_i = 1$ then agents $i = {v, n_v}$ make a staking decision as follows:
    - If $r(x(t-1)) = R_{\rm opp}$, keep stakes the same.
    - If $r(x(t-1)) > R_{\rm opp}$, increase stakes.
    - If $r(x(t-1)) < R_{\rm opp}$, decrease stakes.
- **Staking Process** A simple staking process that captures these properties is given by: 
    \begin{align}
    d_i(t) = d_i(t-1) + \alpha~Update_i ~ W_i(x(t),t)~\left[r(x(t-1)) - R_{\rm opp}\right], 
    \end{align} where $\alpha>1$ is a parameter measuring how fast the staking is adjusted. We impose the following conditions to make sure the staking remains bounded within the total wealth of a nominator:
    \begin{align}
    d_i(t) =
    \begin{cases}
    0, \qquad &{\rm if} ~~ d_i(t) < 0,
     \\
    W_i(x(t),t), \qquad &{\rm if} ~~ d_i(t) >  W_i(x(t),t).
    \end{cases}
    \end{align} 


### 1.4. Global Variables

We identify four main global variables that help us keep track of the evolution of the NPoS economy.

- **Staking rate**: $x(t) = \frac{\rm Total~Staked~DOTs~in~Period~t}{\rm Total~DOT~Supply~in~Period~t}$. In terms of the local staking variables:
    \begin{align}
    x(t) = \frac{\sum_{i=1}^{N} d_i(t)}{\sum_{i=1}^{N} W_i(x(t),t)},
    \end{align} where $N = N_v + N_n$ is the total number of nominators and validators.

- **Inflation Rate**: $I_{\rm NPoS}(x(t)) = \frac{\rm Total~Minted~DOTs~at~the~end~of~Period~t}{\rm Total~DOT~Supply~in~the~Beginning~of~Period~t}$. The inflation rate in terms of the staking rate, $x$, is modeled as:
    \begin{align}
    I_{NPoS}^{\rm ann}(x) = \begin{cases}
    I_0 + x\Big(r_{ideal} - I_0/\chi_{ideal}\Big)
    &\text{for } 0<x\leq \chi_{ideal}\\
    I_0 + (r_{ideal}\cdot \chi_{ideal} - I_0)\cdot 2^{(\chi_{ideal}-x)/d_{shift}}
    &\text{for } \chi_{ideal} < x \leq 1
    \end{cases},
    \end{align} where $I_0=0.025$, $\chi_{ideal}=0.5$, $r_{ideal}=0.2$ and $d_{shift}=0.05$.

![Figure 1 - Inflation Rate](https://i.imgur.com/wJCq4ck.png)
**Figure 1:** Annual NPoS inflation rate against the staking rate.

- **Interest Rate**: $r(x(t)) = \frac{\rm Total~Minted~DOTs~at~the~end~of~Period~t}{\rm Total~Staked~DOTs~in~Period~t}$. It is also convenient to express the interest rate in terms of the inflation and staking rates as $r(x(t)) = I_{\rm NPoS}(x(t))/x(t)$.

![Figure 2 - Nominal Interest Rate](https://i.imgur.com/hrfEbjv.png)
**Figure 2:** Nominal annual interest rate against the staking rate.

- **Gini Coefficient**: We use the Gini coefficient $G \in [0,1]$ to assess the wealth inequality in the network. Smaller the Gini coefficient is, more equally distributed the wealth is. A computationally efficient version for a ranked wealth vector $W_i(x(t),t)$ is defined as:
    \begin{align} 
    G(t) =  \frac{\sum_{i=1}^{N}(2i - N - 1)W_i(x(t),t)}{N\sum_{i=1}^{N} W_i(x(t),t)},
    \end{align} where $N = N_v + N_n$ is the total number of validators and nominators.


## 2. Model Assumptions

We make the following simplifying assumptions to set the ground for our microeconomic NPoS model.

1. The smallest time scale is an era, which is assumed to be a day long. Hence, time is discrete, $t = 0,1,2,...$, and is measured in units of an era.
2. We add $N_{\rm new} = 1000$ new accounts with $W_{\rm new} = 50$ KSM each to the set of Kusama genesis accounts. We use these account balances to set the initial wealth and staking distributions.
3. All validators are independent. $N_v = 300$ validators are randomly bootstrapped from the Kusama accounts and remain to be so all the time. 
4. The remaining Kusama accounts are all assumed to be nominators.
5. All nominators are independent, and support upto 16 of their candidate validators that are randomly assigned to them every era, and are elected via a Phragmen algorithm.
6. The half of the balances of the each validator and nominator accounts at $t = 0$ is assumed to be staked initially. Therefore, the initial staking rate is $x(t=0) \equiv x_0 = 0.5$, and the distribution of validator and nominator stakes are bootstrapped from the Kusama account balances.
7. All validators charge the same commission fee, $fee_v = 20\%$. 
8. The wealth is assumed to be not compounded since payouts are not automatically staked. 
9. We assume that NPoS economy is a closed system, i.e., no external funds are injected into the economy.


## 3. Research Questions
Some of the questions we want to answer with the NPoS economic model are as follows.

1. Does the staking rate, $x$, maintain a reasonable value over time, e.g., $x \sim 0.5$?
2. How do inflation, interest and staking rates of DOTs evolve? 
3. How do validator payouts evolve? 
4. How is the wealth distributed over time? Do we observe accumulation of wealth?
5. Does the staking stickiness affect the overall dynamics? Does it lead to a slower equilibrium of the state variables into their steady state values? Does it affect the wealth distribution?
6. How does slashing affect the evolution of the state variables? Does the system reach equilibrium? Does it affect the time scale to reach the equilibrium state?
7. How does having indepent validators and nominators affect NPoS economy?
8. How does introducing equally paid validators affect the wealth distribution?
9. Does backing different validators every era improve the wealth inequality?
10. How does the sequential Phragmen algorithm perform? Does it help improve wealth inequality?

## 4. Parameters

In our simulation, we use the following set of parameter values.

| Parameters                  | Values                                        |
| --------                    | --------                                      | 
| Initial Nominator & Validator Wealths   | $w_0$: Taken from Kusama Accounts              | 
| Fraction of Initial Stakes  | $f_0 = 0.5$                                   |
| Inflation Parameters        | $I_0 = 0.025$, $\chi_{\rm ideal} = 0.5$, $r_{\rm ideal} = 0.2$, $d_{\rm shift} = 0.05$| 
| Era                         | $t=1$ day                              |
| Total Time                  | $T = 10$ years                         |
| Opportunity Cost of Capital | $R_{\rm opp}^{\rm ann} = 0.2$         |
| Staking Adjustment Speed    | $\alpha = 100$                         | 
| Stickiness Probability      | $p_s = 1/7$ (~once a week)             |
| Unresponsiveness Probability| $p_u = 1/60$ (~once every other 2 months)  |
| Equivocation Probability    | $p_e = 1/240$ (~once every other 8 months) |
| Number of New Accounts | $N_{\rm new} = 1000$ |
| Amount in New Accounts | $W_{\rm new}  = 50$ KSM |
| Validator Commission Fee | $fee_v = 0.2$|
| Number of Validators | $N_v = 300$ |
| Maximum Number of Validators per Nominator| $N_{v_{max}}$ = 16|
**Table 1:** Parameters of the microeonomic model for Polkadot's NPoS.

## 5. Simulation

A python jupyter notebook implementation of the model can be found [here.](https://github.com/w3f/NPoS-Economics/blob/master/Codes/10%20NPoS%20Economics/NPoSEconomicsV7.ipynb)

In the figures below, we compare our NPoS model with validator assignment in each era using an implementation of [Alistair's sequential Phragmen python code](https://github.com/w3f/consensus/blob/master/NPoS/simplePhragm%C3%A9n.py) with the same economic model with randomly assigned validators at the end of each era.

![Staking Rate](https://i.imgur.com/1rX9pOe.png)
**Figure 3:** The time series evolution of the staking rate.

![Interest Rate](https://i.imgur.com/jInCqAi.png)
**Figure 4:** The time series evolution of the annual nominal interest rate.

![Inflation Rate](https://i.imgur.com/rixaGcv.png)
**Figure 5:** The time series evolution of the annual inflation rate.

![Gini Coefficient](https://i.imgur.com/XIEAVCV.png)
**Figure 6:** The time series evolution of the Gini coeefficient for wealth inequality.

The summary figures in the pdf format can be found [here.](https://github.com/w3f/NPoS-Economics/blob/master/Codes/10%20NPoS%20Economics/SummaryPlotsNPoSEconomicsV7.pdf)

## 6. Results

We summarize our main results below:
1. Thanks to the sequential Phragmen algorithm that minimizes the maximum stake backing the validators, and nonzero commission fees charged by validators, we observe that the Gini coeficient decreases from 0.951 to 0.884 over time. The descrease in wealth inequality in time can be attributed to the fact that validators with small wealth have a chance to collect fees and increase their wealth, which improves the wealth inequality in time. 
2. The staking rate, $x(t)$, evolves to a steady state value fast, hence Phragmen method works as expected. We test the model with 10 years of run, and observe that staking rate reaches the steady state value of $x_{\rm steady~state} \approx 0.487$ in the long run. 
3. Similar to the staking rate, interest rate reaches the state state value $r_{\rm steady~state} = 0.201$ in the long run, and remains about 10 basis points above "market" value $R_{\rm opp} = 0.2$. 
4. The inflation rate also stabilizes around its steady-state value of $I_{\rm steady~state} = 0.098$.