Special thanks to Vitalik Buterin and Ameen Soleimani for feedback and review.

# RAI – one of the coolest experiments in crypto

I think RAI is one of the coolest experiments in crypto right now. So I thought I’d write my version of an explainer for it, from the perspective that I have introduced in my previous article on Supply and demand for stablecoins. Back when I wrote it, my understanding of RAI was poor. The version of DAI it describes (single-collateral DAI, before the introduction of custodial stablecoins as collateral) is actually very close to RAI, however there is an interesting difference: Instead of applying an interest rate to balances, like DAI does, RAI directly manipulates the redemption price (which is always 1 USD for DAI). I think it’s nice to directly describe this mechanism. If you want to understand more on how Collateralized Debt Positions (CDPs) work to maintain stability, then I still recommend reading my previous article!

# Why is RAI floating, and not tracking one currency?

In the past, the goal of creating stablecoins was seen as creating an asset that is always worth 1 USD (or some other currency). But as Vitalik remarked in his thought experiments on automated stablecoins, if you can create a coin that is always worth 1 USD, why can’t you use the same mechanism to create one that is worth 1 USD plus 20% interest per year (i.e. 1.00 USD in year 1, 1.20 USD in year 2, 1.44 USD in year 3, and so on)? After all, the only way the blockchain knows about prices is through oracles, and it’s an easy change to the oracle to make it return the value of the coin priced in this new unit (USD appreciating by 20% per year) instead of USD.

Clearly there is something missing in the picture. As we will see below, in order to balance supply and demand, a fully decentralized stablecoin needs to be able to give incentives to those going long (using the stablecoin) and going short (supplying the stablecoin) in some form. This is true whether it tracks USD, USD+20% interest or USD-5% interest.

One way of doing this is to add a mechanism rate that charges interest on debt (the suppliers of the stablecoin) and credits it to the holders (the users of the stablecoin). The interest rate can however be negative when there is more demand for holding than there is for stablecoin debt.

In March 2020, DAI first depegged upward (the market price increased to more than 1 USD) and only repegged after USDC (a custodial, centralized stablecoin pegged to 1 USD) was added as one of the forms of collateral to mint DAI, otherwise it would have required a negative interest rate. Since its inception, RAI has mostly had negative interest rates. For now, it seems like decentralized stablecoin require negative interest rates most of the time.

When interest rates are negative, instead of having your balance change from 1 to 0.99 to 0.98, RAI keeps the balance the same and changes the actual price target of the stablecoin instead. This means that RAI looks like a floating currency, but with the property that it is much less volatile than cryptos like Ether and Bitcoin.

## The stablecoin problem

Cryptocurrencies are volatile. Apart from scaling, this is probably still the largest barrier to adoption. This is why there have been many attempts to create a coin that is less volatile.

Like any commodity, the price of a stablecoin is determined by supply and demand. At any instant, some people want to buy and sell the coin, and these inflows and outflows must be matched, so the price will adjust until they do (the price where they match is the market price). Market makers will try to cover short term spikes in supply or demand, but will adjust their quote prices if they see consistent pressure in one direction.

So if you want to keep a coin stable, you have to be able to somehow manipulate supply and demand such that they cross at a desired price. If the current price is too high, it’s easy to create more supply and push the price down. The trouble comes when the coin falls below the desired price (more outflows than inflows): We need to either decrease supply or increase demand, but how do we do that if the supply comes from independent holders wanting to sell?

There is only one decentralized and sustainable option that I know of. It requires saving during the good times in order to be able to create demand in the bad times: In order for new stablecoins to be created, enough collateral for has to be added to the protocol, so that when demand decreases, this collateral can be used to generate new demand.

### Collateralized debt positions

Creating stablecoins by means of Collateralized Debt Positions (CDPs) is a way in which this can be implemented. A CDP is a position where a holder of a volatile currency, such as Ether, takes out a loan in the stablecoin. The CDP represents this position. It can also be seen as a leverage position in the collateral. For example, this graph represents a CDP that has 200 RAI borrowed against 1 ETH, where the value of 1 ETH is currently 1400 USD and 1 RAI is 3 USD; the holder of the CDP gets the “equity” value of this position (currently 1400-600=800 USD, but it can fluctuate with the price), and the RAI holder the debt (which is independent of the current price of Ether).

How can CDPs create demand? Some protocols do this directly by allowing stablecoin holders to redeem against the collateral, this is for example how Liquity works. However, RAI follows MakerDAO’s original DAI in not integrating such a mechanism. But CDPs can still generate demand:

1. While the CDP is well collateralized, charging an interest rate to the debt holder can incentivize them to take action in relation to their CDP. For example, if the interest rate on debt increases, a CDP holder may decide that holding on to the position is no longer worth it, and that it’s better to repay the debt. When they do this, they have to buy the stablecoin on the market, which creates demand.
2. Once the CDP gets close to the liquidation ratio, the holder is incentivized to close the position to avoid the liquidation penalty, unless they can add more collateral. If the position gets liquidated, the liquidator will also have to buy stablecoins in order to bid for the collateral.

By only ever issuing new stablecoins in the form of debt when a CDP is created, the protocol has all the collateral in the CDPs to prop up the coin when other demand for stablecoin collapses.

This construction comes with a counterintuitive downside: New coins can only be created when someone is willing to take out a CDP. This requires someone who wants to take a leveraged position in the collateral.

This demand is currently the limiting factor for stablecoins based on this construction. In order to stop the stablecoin from increasing in value due to limited supply of willing CDP holders (in other words, demand for leverage), we will have to do one of two things:

1. Make the leveraged position more attractive to the CDP holders
2. Make holding the stablecoin less attractive

What we can do is that we charge the stablecoin holders a negative interest rate, which is paid out to the CDP holders. This actually does both: It increases the attractiveness of leveraged positions, and makes holding the stablecoin less attractive.

Margin exchanges have done this for a while: They too have to find this balance, as every long position has to be matched to a short position, so that the net exposure is equal to the deposited assets. They use the same mechanism to balance the books: The funding rate is paid by the type of position for which there is more demand to the side that for which there is less.

## How RAI balances supply and demand

We have just learned that one mechanism to achieve the balance between CDPs (stablecoin shorts) and holders (stablecoin longs) is an interest rate transfer between the two. DAI implements this mechanism using the DAI savings rate: you can put your DAI into the savings contract and you get paid an interest.

Things become more awkward when the interest rate is negative, i.e. DAI holders are paying to CDP holders. In this regime, DAI balances would have to be slowly decreasing. Implementing it in this way has the advantage that your balance always represents the value in USD, and 1 DAI remains worth 1 USD. It’s less good for smart contract developers who now have to deal with the fact that balances in an account can decrease.

Instead, RAI goes a different way: Adjust the “redemption price” to represent the interest rate. What’s the redemption price? It’s the target value of 1 RAI. In particular it is used

1. To borrow RAI in CDPs and to repay debt, as well as determine whether a position is underwater and should be liquidated
2. As the value at which all debts and deposits are settled when global settlement is triggered.

Since the interest rate is applied to the redemption price, it is called redemption rate. As an example, if the redemption rate is -3% and the redemption price is currently 1.00 USD, then in 1 year the redemption price will be 0.97 USD (RAI actually started with a redemption price of 3.14 USD).

Now when such a negative redemption rate is applied, two things will happen:

1. RAI holders will expect to have 3% less value when compared to holding USD after one year
2. RAI borrowers (who buy RAI back on the market) will expect their debt to decrease in value by 3% after one year

### How does RAI determine the redemption rate

Another cool component of RAI is that the redemption rate is actually automatically computed by the protocol. The protocol detects the supply and demand imbalance by tracking the deviation of the market price from the redemption price. If the market price is higher than the redemption price, it means there is more demand for RAI than there is for CDPs – and so a negative redemption rate has to be applied. Conversely, if the market price is lower than the redemption price, the redemption rate needs to be be positive.

So a very simple design could look like this: Find the current difference from between the redemption price and the market price, multiply it by some number – for simplicitly say 1, and make that the redemption rate. Say the current redemption price is 4% under market, then the redemption rate will be -4%. If it is 10% above, the redemption rate will be +10%.

If we did this, it would constitute a P controller (P for proportional), which is actually what RAI did initially. RAI’s adjustment mechanism was later updated to use a PI controller that takes the difference between market and redemption prices (the error) as an input. A PI controller, in addition to the current value, also uses the integral (I), so takes into consideration how much the value has deviated in the past. This makes the system more stable and means interest rates fluctuate a bit less with short term price changes.

The RAI website shows the history of RAI redemption price and market price, as well as the interest rates, which can be a nice demonstration of how this mechanism works

On top, you can see the market (red) and redemption prices (grey). The market price is typically above the redemption price, representing excess demand for RAI over CDPs, which the protocol compensates by applying a negative redemption rate – this is why the redemption price is slowly decreasing.

The lower graph shows how the redemption rate is computed. the blue curve (p_rate) is the P part of the PI controller. It is proportional to the error and indeed, the graph looks like the inverted difference between the red and grey curves in the upper graph. The orange curve (i_rate) is much smoother and represents the I part (integral) of the controller, which reacts to past deviations. The sum of the p_rate and the i_rate is the redemption rate and is how fast the redemption price is going down at any given time.

The higher the market price is above the redemption price, the faster the redemption price thus decreases – rebalancing supply and demand as the expected value of holding RAI decreases (and RAI debt becomes more attractive).

## But what pulls RAI back to the redemption price

There’s one thing we skipped over. The redemption price represents the target value of RAI in the protocol, and we’ve just been taking it for granted that lowering the price will make long RAI positions less attractive and short positions more attractive. But this assumes that market participants have some expectation of being able to use RAI at or near the redemption price – which requires some force that pulls the market at least in the direction of the redemption price, so that lowering the redemption price has a meaning.

Of course, we can expect “global settlement” will solve this: There is a mechanism in the protocol, which can be triggered by governance, that settles all deposits and debts according to the current redemption price. It is expected that this mechanism will be triggered when the deviations become too extreme. So maybe that’s the reason why the redemption price matters?

Actually, the global settlement is a cool emergency feature, but it is not necessary to explain why the market price will track the redemption price, assuming (some) rational market participants (with enough capital).

Let’s assume that market participants just ignore the redemption price entirely. What would happen?

1. The current minimal collateralization for CDPs is 135%. What that means is that if the market price is more than 35% above the redemption price, anyone can just mint RAI for Ether and “forget” about their CDP – just sell the RAI, buy more Ether with it and take the arbitrage profit. RAI can’t trade significantly more than 35% above redemption price for this reason.
2. There is no strict bound like this from below – but we can do a thought experiment: Let’s say that RAI trades consistently 10% below redemption price. Note that this would lead to an enormous redemption rate of something like 240% per year (in the long term, when the integral term has had enough time to accumulate). CDP holders have to take this redemption rate into account – eventually they will get liquidated, when their collateralization ratio (which is computed using redemption price) reaches 135%. They thus have a strong incentive to buy RAI before this happens.
3. Similarly, we can find that if RAI trades 10% above the redemption price, the negative interest rate will reach something crazy like -70% (again in the long term, when the integral term has had enough time to accumulate this), which means there is a very strong incentive for RAI holders to get out before this happens. If they don’t, lots of newly minted RAI from new CDPs will eventually be available at the much lower redemption price.

Combined, these forces mean that while the market price can deviate, it cannot deviate too far and too long from the redemption price.

## How does tracking another currency change RAI?

An interesting question is: How would RAI be different if instead of tracking USD, it had been set up to track the Euro, the Chinese Yuan, or maybe the 6 months moving average of the Ether price?

To start with, we will do a thought experiment (one proposed by Vitalik): What if RAI was set up to track USD + 20% (a version of the USD that comes with a 20% interest rate)? Let’s call this asset RAI-PONZI.

Obviously holding this asset seems really attractive and having debt in that asset much less so. The price of RAI-PONZI will keep rising as buyers want the high interest rates and there are few people available wanting to take out CDPs in RAI-PONZI.

As RAI-PONZI rises above the redemption price, the redemption rate will get more and more negative. It will reach -20%, which makes RAI-PONZI equivalent to USD. From there, it will likely go even further: Currently RAI’s redemption rate is about -10%, so I would expect RAI-PONZI to settle at -30% in current market conditions. At that point, it becomes equivalent to current RAI, so it makes sense that market participants would behave in this way, assuming the same risk tolerance of market participants.

This is actually nothing else than creating an “offset” in the redemption rate of +20%, and an equivalent price offset.

What can we learn from this? The long-term expected gains or losses of a currency do not impact how RAI behaves. If RAI were pegged to Turkish Lira, which seems to lose about 25% of its value compared to the USD every year, it would probably not behave too differently on long timescales. Let’s call this asset RAI-TRY.

Where RAI-TRY is different is on short timescales and unexpected shocks. If the Lira suddenly drops 20%, due to a black swan, then RAI-TRY will do so, too. The same goes for a sudden increase.

What exact currency is used as an input to the RAI oracles therefore probably does not matter that much. It is likely that most major currencies like EUR or GBP will result in a very similar asset, except that it will react slightly differently under market shocks. This is because any expectation in different performance will just be corrected by market particpiants (so if they expect that GBP will lose 1% per year vs USD, they will just correct for it by picking a different redemption rate).

## Why do I think RAI is such a cool experiment?

There have been many attempts to solve the decentralized stablecoin problem. MakerDAO with DAI was probably the first that solved a major part of the puzzle – how to stop it from crashing to zero in a confidence crisis. However, it turned out that they had still missed one part, which is how to stop it from going up.

Finally, RAI came and added this missing piece in a slightly unexpected way – whilst many had been expecting a DAI with negative interest rate, doing it via the redemption rate adjustment is much more elegant. And at the same time, it allows us to learn a lot:

First and foremost, the point of a stablecoin is not to be pegged to USD. It is to provide an asset with low volatility. RAI does indeed solve this task, and has much lower volatility than the underlying collateral, Ether.

RAI therefore is something like a new currency, which is underlined by the fact that it doesn’t really matter that much which fiat currency is used for the oracles, as long as it is reasonably stable. In fact you can change the reference asset while the system is working without much of a problem.

Secondly, the current market structure dictates that if users want a decentralized stablecoin, they have to pay a “price for stability”, in the form of a slowly decaying price of RAI (vs the USD). This is because there is a lot of demand for stablecoins, and limited demand for leverage on decentralized assets like Ether. While it currently feels like this might be an eternal truth, it does not have to be. It could be that this balance tips in the favour of stablecoins again in a bull market, as demand for leverage increases. However, before that happens, it is likely that we would have to see MakerDAO shrug off all of its custodial stablecoin exposure (in order to get their funding rates off zero), which currently seems a long way off.

What I love about RAI is that it is a completely fair way to determine the “price of stability”, and also much cleaner than others. I have posited in my past article on stablecoins that the price of stability isn’t currently fairly determined – and that if it were, it may well be a negative interest rate. Many see inflation as a scourge, but the reality is that having a “guaranteed stable asset” as we implicitly expect currencies to be has to be paid for by someone. If that price were determined using a market like it is in RAI, what would it be?

At least in the decentralized world, we now have an answer, that the price is typically higher than the 2% inflation allowed for by many central banks. Obviously, the number of assets that can be used as collateral in decentralized stablecoins is small, and the result in the real world may well be different. After all, there are 100s of trillions of collateral available, compared to currently less than one trillion in crypto assets.

RAI is, in many ways, central banking in a pure form. We will probably learn many things from this experiment, and that already makes it a worthwhile project.