**Author**: Eray Sabancilar **Last updated**: 12.02.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 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 and 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 are 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} - **Payouts**: The total payout to validator $v$ and the nominators backing that validator given the nominal interest rate, $r(x(t))$, is \begin{align} P_{v,n_v}(x(t),t) = d_v^{\rm Tot}(t)~r(x(t)). \end{align} - 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(x(t),t) = P_{v, n_v}(x(t),t)~fee_v + \frac{d_v(t)}{d_v^{\rm Tot}(t)} P_{v, n_v}(x(t),t) (1-fee_v). \end{align} - The payout to each nominator $n_v$ backing validator $v$ is: \begin{align} P_{n_v}(x(t),t) = \frac{d_{n_v}(t)}{d_v^{\rm Tot}(t)} P_{v, n_v}(x(t),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/14$ and $p_e = 1/60$ so that unresponsiveness occurs once every other week whereas equivocation occurs roughly once every other month. - **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(x(t-1),t-1) - S_i(t-1). \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](images/file.pdf) - **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](images/file.pdf) - **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 setup 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 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 the same validator that is randomly assigned to them all the time. 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 this version of 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? ## 4. Parameters In our simulation, we use the following set of parameter values. | Parameters | Values | | -------- | -------- | | Initial Nominator 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 = 20$ years | | Opportunity Cost of Capital | $R_{\rm opp}^{\rm ann} = 0.05$ | | Staking Adjustment Speed | $\alpha = 100$ | | Stickiness Probability | $p_s = 1/7$ (~once a week) | | Unresponsiveness Probability| $p_u = 1/30$ (~once every other month) | | Equivocation Probability | $p_e = 1/120$ (~once every other 4 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$ | ## 5. Simulation A python jupyter notebook implementation of the model can be found here: https://github.com/w3f/NPoS-Economics/blob/master/Codes/7%20NPoS%20Economics/NPoSEconomics.ipynb The summary figures: ![Figure 3 - Time series of the global variables.](images/file.pdf) ## 6. Results We summarize our main results below: 1. Thanks to the random selection of validators and nonzero commission fees charged by validators, we observe that the Gini coeficient decreases 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 introducing independent validators and nominators improves efficieny in the NPoS economy. We test the model with 20 years of run, and observe that staking rate reaches the steady state value of $x_{\rm steady~state} \approx 0.655$ in the long run. 3. Similar to the staking rate, interest rate reaches the state state value $r_{\rm steady~state} = 0.051$ in the long run ($T\sim 20$ years), and remains slightly above "market" value $R_{\rm opp} = 0.05$. Therefore, with the current set of parameters, the NPoS economy remains slightly competitive compared to the market. 4. We expect the wealth inequality to decrease even further when we relax the assumption that validators are selected once in the beginning and remain to be so, and instead introduce validator selection in every era. This way more validators with small wealth can have a chance to increase their wealth, and hence contribute to decreasing the wealth inequality. This is to be studied in the next version of the model. ## 7. Future Directions A short term research agenda that aims to expand the current understanding of the Polkadot economy includes the following projects. - Project 1: NPoS Economics - Introduce flexibility in selecting validators based on their past performance. - Implement Phragmen algorithm for validator selection. - Model validator operators and the constituent validator correlations. - Project 2: Treasury Model - Model Polkadot treasury. - Analyze DOT exhange rate, treasury assets (crypto and fiat currencies), monetary and fiscal policies. - Obtain the optimal set of parameters for the network to achive the desired policies. - Project 3: Parachain economics - Sample parachain models with and without native tokens. - Parachain slot pricing. - Parachain slot sales/auctions. - Economic incentives for parachains to be deployed in Polkadot.