How Djed stablecoin works (extended Djed)
Today we will learn how the stable coin Djed works. There are two models: minimal and extended Djed.
In this article I will try to explain the most robust and complete model: the extended Djed. So, let’s understand some important concepts to avoid confusion.
First, it is important to understand the difference between buying stablecoins from other users on exchanges and buying stablecoins directly from the autonomous bank that manages the stablecoin.
When you buy stablecoins on exchanges, you are just exchanging one token for another, For example, you sell ADAs in exchange for Djeds.
What is the difference of buying stablecoins from the autonomous bank?
When you buy from a autonomous bank, you don’t sell your ADAs you just leave them locked up as collateral to issue Djeds.
The logic is the same as we saw in the article about the DAI cryptocurrency. It is a loan. You deposit a guarantee and borrow stablecoins.
That way, when you return the stablecoins to the bank, your ADAs will return to you. For those who need dollars today and don’t want to have to sell their ADAs borrowing Djed might be a good idea.
The ADAs deposited as collateral form the bank’s reserve. The Djed coins have value in the market because at any time you can go to the bank and return these Djeds to get your ADAs back.
By establishing that 1 Djed is equivalent to 1 dollar, the amount of Djeds you can issue at the bank depends on the current value of the ADA coin. If 1 ADA is worth 2 dollars, theoretically 1 ADA would allow you to issue 2 Djeds.
But this would be very risky for the protocol, because if the market value of ADA fell below $2, the bank would not have enough reserves to pay the user who returned their 2 Djeds, implying that the market value of Djed would be less than $1 in this scenario.
To avoid this situation and not suffer from ADA price fluctuations the dollar value of the bank’s total reserve needs to be greater than the total value of Djeds issued.
If the dollar value of the total reserve of ADAs is 1,5 times the total value of issued Djeds.
It means that the price of ADA can be 0,67 times lower in the market without compromising the parity of the Djed.
After all, 0,67 * 1,5 = 1. Note that the more reserves, the more secure parity becomes.
Now consider this, if the dollar equivalent value of the bank’s reserve is decreasing,
users should ideally be encouraged to deposit more reserves without issuing new Djeds. The protocol allows this by buying “Reserve Coins”.
It works like this: Imagine that the dollar value of the bank’s total reserve is 1 million and there are 700.000 Djeds in circulation. This means that the bank has a surplus of $300.000,00 at the moment.
Now consider that there is a coin called RC and that there are 1.000 such coins in circulation. This coin will represent the surplus of the bank, because its value depends on the surplus the bank has. If the surplus is $300.000,00 and there are 1.000 RCs in circulation, each RC is worth approximately $300,00.
In practice it is not exactly that as there are more fees and parameters involved, but we will talk about them later. You can buy RCs directly from the autonomous bank. The bank sets the price of the RC and you provide ADAs in exchange.
Consider also that RC gets cheaper and cheaper as the surplus approaches zero. But RC is never worth zero.
I put on the image some exaggerated values just to illustrate, but in practice the reference point is not the surplus reaching zero but the surplus reaching a limit value considered safe by the protocol. This safe value is defined by a parameter that we will discuss later.
Back to our example, let’s look at the implications.
If the bank surplus has decreased, it means that the price of RC has decreased. So users may want to buy RC because it is cheap and may increase in price later. The lower the bank’s surplus value, the more attractive it will be for users to buy RCs, which counterbalances and increases the surplus.
Similarly, if there is too much surplus in the bank, the value of the RC will be high, which will encourage users to sell their RCs to realize profits.
Note that every time a user buys or sells RCs with the bank, the bank is issuing or burning RCs.
Since the value of RC depends on the bank’s surplus and the total number of RCs in circulation, a purchase or sale of RCs should not have much impact on the RC price. After all each transaction changes both the value of the surplus and the amount of RCs in circulation, and the price of RC coin is somehow proportional to this ratio.
On the other hand, fluctuations in the value of ADA change the value of RC as they directly impact the value of the surplus.
If there are too many RCs in circulation, increases in the surplus will represent a very small gain for RC holders.
Therefore, to avoid this dilution, there is a disincentive to buy RCs after a certain threshold through a fee that makes these purchases more expensive.
Similarly, this dynamic fee makes RCs cheaper and cheaper as the surplus approaches a threshold value. This threshold is a parameter that determines how much surplus the autonomous bank should have in reserves.
The buying and selling prices of RCs are determined by two equations that basically try to make the system converge to this optimal point where the amount of reserves the autonomous bank should have is optimal considering all factors.
Ok, but what would happen in very adverse scenarios?
If the value of reserves falls so low that there is no longer a surplus and the stable coin loses parity, users can still sell stable coins to the autonomous bank.
But instead of receiving the equivalent value of 1 dollar per Djed, they will receive the proportional value of the amount of reserves in relation to the total number of Djeds in circulation. The difference in this amount relative to $1 is made up by giving users RCs, increasing the number of RCs in circulation.
The lower the reserves, the more discouraged users are from selling RCs, according to the RC selling equation, and more encouraged to buy, according to the RC buying equation.
In summary, one of the key ideas for maintaining Djed parity with 1 dollar is to counterbalance a possible loss in value of reserves with an increasingly interesting opportunity to buy RCs, representing high profits should the system stabilize again.
I have omitted several aspects of the protocol in this article trying to bring a generic and simplified explanation, but all the details and equations can be checked in the official paper. This is the first stable coin protocol that has gone through formal verification.
In this example I used ADA as a reserve and dollar as parity, but the concept can be applied to any asset that you want to hold parity or reserves allowing the most diverse types of stable coins.
If we think about the DAI stable coin, it is managed by the Maker project within the Ethereum platform.
In the case of Djed, the COTI project will be responsible for managing the protocol within the Cardano platform. A small portion of the fees from these protocols goes to the project that manages them.
In the case of COTI, the project has pursued several partnerships and licenses with financial solutions, and will be able to use this expertise to drive the adoption of Djed.
Cardano, on the other hand, benefits from having a robust stablecoin running under its architecture similar to what happens with Ethereum in relation to DAI. But the integration of Djed into the Cardano ecosystem will be even deeper.
One of the goals is to use Djed as a reference for charging fees on the platform, making predictability easier for pool operators and users by introducing the concept of stable fees.
- Oficial paper: https://eprint.iacr.org/2021/1069.pdf
- IOHKs post: https://iohk.io/en/blog/posts/2021/08/18/djed-implementing-algorithmic-stablecoins-for-proven-price-stability/
- Presentation by Bruno Paleo: https://www.youtube.com/watch?v=zG-rxMCDIa0&t=8366s
- Stable fees concept: https://iohk.io/en/blog/posts/2021/06/10/stablefees-and-the-decentralized-reserve-system/
- Coti blog: https://medium.com/cotinetwork/why-being-the-issuer-of-djed-cardanos-official-stablecoin-is-a-game-changer-for-coti-f4945494fc40
- Djed website: https://djed.xyz/