# A Fundamentally Stable Coin

*“I have, for many years, been in favor of replacing the Fed with a computer.” (Milton Friedman, 1998)*

Stablecoins have become an important application of blockchains. But most of them are stabilized against an unstable asset. This article introduces a mechanism to stabilize the value of a coin named “*X*”. To this end, this mechanism controls the supply of coin *X* such that its value is always (moving towards) the median of *2n+1* items including *X*. The *2n* items can be gold, crude oil, water, bitcoin, ether, USD, EUR, corn, or anything of homogeneous value.

I would suggest *n > 10* for more stability. But here I provide an example with *n=3* for simplicity.

Let’s assume at time* t=0*, we have:

1 USD = $1

1 EUR = $1.11

1 gram gold = $47

1 gram silver = $.54

1 barrel crude oil = $59.2

1 Ether = $151

Therefore, at this time, these items have the same value:

*1X = 1 USD = .9 EUR = 0.0212 gram gold = 1.852 gram silver = 0.0169 barrel crude oil = 0.0066 Ether*

This means they have the same value and markets are indifferent between them. However, as time passes their relative values change. Here, we define this vector as the benchmarks for all times:

*V =* (*1 USD, .9 EUR, 0.0212 gram gold, 1.852 gram silver, 0.0169 barrel crude oil, 0.0066 Ether***)**

All the components have the same value at time *t=0* but later on, they can have different values and can be sorted based on market preferences. We don’t need to sort them though. The only thing that we need is that *1X* should be more valuable than three of them and less valuable than three of them so *1X* is always the median. To this end, we design an optimal control mechanism that determines the supply of *X* based on the rank of *X*. If four items are preferred to *1X* (i.e. two are less valuable), the algorithm cuts the supply until *X* becomes more valuable than three and becomes the median. If four items are less valuable than X, the mechanism increases the supply so to lower the value of *X *becoming the median again. There can also be a reserve pool so that when the value of *X* goes too low (e.g. ranked sixth), the system buys back and burns* X* to increase its value. It is all about designing and optimizing a controller.

Such a stabilized coin has numerous advantages and desirable properties:

1. It is not sensitive to any one item, because it uses median, not average. So for example, if Ether becomes useless due to quantum supremacy, the last item will become less valuable than *1X* and it does not matter how much less valuable. Or if crude oil becomes very expensive, it is always more valuable than *1X* and it does not matter how much more valuable. Essentially they each have one unweighted “vote” in calculating the median.

2. We do not need the exact values of the items. We only need to know how many items are more or less valued than *1X*. A simple oracle can detect it in a Blockchain. There are also some on-chain mechanisms that can detect it without oracles. The important thing to detect is when the rank of *1X* changes, like when an item that was less valuable than *1X* becomes more valuable than *1X*. That is the only information the controller needs.

3. The traders and arbitrators know that this mechanism moves *1X* to become the median eventually, so they buy and sell X when it moves in either direction away from the median and essentially they absorb most of the shocks even before the supply controller is triggered. In fact, the prospect of *1X* becoming the median is a strong force in the markets that pushes the value of *1X* towards the median at all times.

An interesting extension to this controller would be a time-variant multiplier for *X*. This multiplier can be *(1+b)t *so that the controller pushes *(1+b)t.X* instead of *1X* toward the median. If *b > 0*, it imposes inflation and *b < 0* will impose deflation. For example, if *b = +.1*, the controller makes the values of *1.1X *and *1.21X* the median value at times *t = 1* and *2* respectively. This inflation can allow for a higher supply of currency which can be used as a reward. On the other hand, if *b = -.01 , *the controller makes the value of *.99X *and *.98X* the median value at times *t = 1* and *2* respectively. This is a risk-free interest rate for the coin holders. Because the value of their coins increases according to a precise formula.

One can try to implement such a stable coin as an ERC-20 token on the Ethereum Blockchain. Or, one may try to design a blockchain protocol that controls the supply of its native cryptocurrency using such a mechanism.

The values of items with respect to X change over time, but of course 1X is a straight line. When it falls in the green region, it means 1X is the median. When this line is above the green region, the controller should increase the supply and when it is below the green region, the controller should decrease or cut the supply of X.