How DAI Stablecoin works?
Dai is a decentralized stablecoin pegged to the value of the U.S dollar. It is designed as a solution to deal with the price volatility problem in the crypto space.
Stability is a holy grail for the crypto market. However, reality has told a different story.
Although cryptocurrency has progressively become more mainstream over the years, there is a few critical problems that make its adoption as a real-world currency quite challenging. One that has remained a constant and inevitable issue is its price volatility. Cryptocurrency prices can fluctuate drastically in a day, let alone an hour. Imagine having an amount of $2,000 U.S Dollar for rent, then suddenly it drops down to $800 U.S Dollar in an hour.
As a response to this problem, stablecoin exists as a potential solution. A stablecoin is a cryptocurrency which is pegged to a stable asset, such as fiat currencies, collateral, or gold, etc.
Stablecoins can be built either centralized or decentralized. Centralized stablecoins are typically backed by fiat currencies (USD, EUR, JP¥, etc.) or commodities and are dependent on governments or third-party custodians.
On the other hand, decentralized stablecoins are backed by other cryptocurrencies, making them more secure, permission-less and transparent. Some stablecoin projects even use algorithms to fix a steady value. In general, a stablecoin is a crypto asset which isn’t susceptible to extreme volatility.
Once joining the crypto space, you must have known at least one of these popular stablecoins such as Tether (USDT), TrueUSD (TUSD), Paxos Standard Token (PAX), USD Coin (USDC), Gemini Dollar (GUSD), and especially Dai (DAI). However, there are fundamental factors that make Dai different from other counterparts.
What is DAI?
Dai is a stablecoin launched by MakerDAO in December, 2017, which is pegged to the U.S Dollar. This means that every Dai is worth $1, and will always be worth $1 USD.
Unlike Tether and other stablecoins which are backed by fiat reserves held in a bank, Dai is built entirely in the Ethereum network as an ERC20 token and backed by Ether, making it completely decentralized.
Anyone with an Ethereum wallet can own, accept, and transfer Dai freely like any other ERC20 token, regardless of middlemen. Its value stability is sustained within the Ethereum blockchain using smart contracts.
The important question is how Dai maintains stability when it is backed by a cryptocurrency which can be very volatile. This requires more explanation.
How does DAI remain stable?
Dai uses game theory and balanced economic incentives to sustain its value of $1. In more technical terms, it all boils down to margin trading using Collateralized Debt Position (CDP).
CDP is a smart contract which supports users to receive DAI. It effectively operates as a debt instrument with an interest rate. The CDP user has posted collateral in excess of the value of the loan in order to guarantee their debt position.
When a single Dai falls below $1, the smart contract pricing mechanisms incentivize users to increase the price. When one Dai is worth more than $1, the incentives work the other way around. In any of these occasions, rational actors can make money due to the price swings. The further Dai deviates from the mean, the better incentives there are to fetch the price back to $1.
Assume you deposit 2 ETH (at the time of this writing, ETH is worth $193 USD) into a CDP and borrow 193 Dai. In order to get back your full 2 ETH, you must pay back the amount of Dai you borrowed which is 193 Dai, plus a stability fee.
If the value of Dai drops below $1, the stability fee will increase in order to make Dai loans more expensive. If Dai loans are more expensive, less loans will be generated and supply of Dai will retract, driving up the price. Likewise, if the value of Dai surpasses $1 USD, the stability fee is lowered in order to make Dai loans cheaper, leading to increased supply in the market and lower prices.
Rather than being determined and manipulated by any centralized financial institution, company, or government like Tether, Dai is completely decentralized. The Stability Fee of Dai is voted on by the community of people who hold MKR tokens - the governance token for the MakerDAO system.
The Stability Fee is a fee that has to be paid by the CDP owners. It is an annual percentage yield that is calculated on top of the existing debt of the CDP. The Stability Fee is denominated in Dai, but can only be paid by using the MKR token. The amount of MKR token that you have to pay is calculated based on a Price Feed of the MKR market price. Once paid, the MKR is burned, permanently removing it from the supply.
CDPs have varying degrees of debt. When you open a CDP, you can draw up to 60% of the value in Dai. This means if you deposit $1,000 of ETH, you can take out 600 Dai. However, not every CDP owner takes 100% of the amount. The more you draw, the riskier it is.
As ETH fluctuates in price comparative to USD, the debt ratio of each CDP also shifts. As ETH rises in price, CDP user becomes safer as they are less indebted. As ETH falls in price, every CDP becomes riskier and more indebted. More risky CDP’s have higher debt ratios.
As ETH falls in value, each CDP gets closer to the debt limit. If a CDP crosses this threshold, the Maker system will automatically buy the collateral of the CDP and subsequently sell it off. The CDP owner will receive the value of the leftover collateral minus the debt, Stability Fee and Liquidation Penalty.
Keepers are incentivized to remove risky debt from the Dai system by paying it off. CDP owners who let the debt get so risky are penalized for doing so, which incentivizes them not to have risky debt.
CDP owners can make their debt safer by paying down debt as the CDP gets more risky. Astute CDP owners will observe their CDP getting more risky, then pay down Dai early to avoid a penalty. Those who neglect their CDP will get penalized by the system if they cross the debt threshold.
In addition to the smart contract infrastructure, there are certain external actors to keep Dai’s price stable:
Oracles and Global Settlers are Key External Actors with special permissions in the system assigned to them by MKR voters. In order to protect the system from an attacker who gains control of a majority of the Oracles, all Oracle inputs go through the Oracle Security Module, which imposes a 1 hour delay on the data, leaving enough time for the MKR governance community and the Emergency Oracles to analyze the data and react. A Global Settlement (also known as Emergency Shutdown) is a final resort to enforce the Target Price to the holders of Dai. When a Global Settlement is triggered, it immediately shuts down the system to protect Maker Platform against attacks. This means that holders of Dai and CDP users receive the net value of assets that they are entitled to. The process is fully decentralized and Maker voters govern the access to it in the case of an emergency.
Keepers are independent (usually automated) actors that are incentivized by profit opportunities to contribute to decentralized systems. Keepers can also make profits by trading Dai. When the market price of Dai is higher than $1 USD, keepers sell to increase supply and decrease demand, which lowers the price of Dai back to its Target Price. Keepers also buy Dai when the price is below $1 USD to lower supply, which increases demand for the coin, in turn helping push Dai’s price back up to where it needs to be.
In order to go into further details of the mechanism behind Dai creation and price stability, which gets a bit more complex, you can read the Whitepaper of the Dai Stablecoin System.
How is Dai created?
Users can withdraw Dai as a loan against their ETH holdings in Maker Platform.
To create DAI, at first users have to lock up their ETH in CDPs in the form of Pooled Ether (PETH). In return for depositing ETH as collateral, the CDP then generates Dai for the users while calculating interest on the Pooled Ether over time.
First, ETH is converted into Wrapped ETH (WETH), which “tokenizes” ETH so it can be used like any other ERC-20 token.
Next, WETH is turned into Pooled ETH (PETH), which means it joins a large pool of Ethereum that is the collateral for all Dai created.
Once you have PETH, you can create a Collateralized Debt Position (CDP), which locks up your PETH and allows you to draw Dai against your collateral, which is PETH.
As you draw out Dai, the ratio of debt (Collateralization Ratio) in the CDP increases. CDP owners should keep their Collateralization Ratio well above the 150% minimum ratio to avoid their CDPs from being liquidated.
Aforementioned, if there is a sudden market crash in ETH, and a CDP ends up containing more debt than the value of its collateral, the Maker Platform automatically dilutes the PETH to recapitalize the system. This means that the proportional claim of each PETH token goes down relative to the total pooled ETH. After the Maker Platform is upgraded to support multiple collateral types, PETH will be removed and and instead regular ETH will be usable as collateral alongside other new collateral types.
Why do I need to create Dai?
Since Dai is pegged into US Dollar, you can deposit your ETH into a CDP and will always owe back what you initially borrowed in addition to a small amount of interest.
Assume you want to invest in a very high-risk ICO A, but you don’t want to send in your ETH because you could end up owing twice as much as your initial investment, or could possibly lose all of your ETH. You could deposit 10 ETH into a CDP (means $1,979 at the time of this writing), generate the equivalent in Dai, and then send that amount of Dai to the ICO A. If, unfortunately, the ICO A crashes and you want to cut your losses, so you sell your tokens from the ICO back into Dai, but now you only have $1,580 worth of Dai. The good news is your 10 ETH is still safe in a CDP.
However, to retrieve your ETH, you would have to find a way to recover the $399 USD short to pay back your loan plus interest. At the same time, the price of ETH has been booming, so now your 10 ETH is worth $2,380! That was more than enough to offset your losses in the ICO.
On the other hand, instead of setting up a CDP, if you actually sent your ETH to the ICO A, you could have lost 2 ETH, which would be $476 when the value of ETH increased.
Setting up a CDP and using Dai as your method of investment can create a huge difference between either doubling your losses or doubling your profits. Investments will always come with risks, so it’s crucial to be diligent in your researches and strategies.
Thus, if you believe ETH is going up in value, you can use your CDP to buy ETH on margin. You could lock up your ETH in a CDP, generate Dai and use the Dai to buy more ETH on an exchange, then use that ETH to further increase the size of your CDP. Margin trading can be accomplished entirely on the blockchain, regardless of any third-party or centralized authority.
When Dai is worth more than $1 USD, you can sell it on an exchange for greater than $1 USD.
History has proved that Dai succeeds even in a falling ETH environment. When the value of ETH fell from $1,400 USD in January 2018 to $400 in April 2018, the Dai system’s incentive structure successfully kept the value of Dai pegged to $1 USD.
As Dai continues to successfully maintain its USD peg, faith in Dai will increase.
The creation of Dai allows the ability to transfer USD in any amount, instantly, across borders, without fees, without any interference.
Furthermore, Maker addresses a crucial problem in cryptocurrency - the price of cryptocurrency is too volatile to be today’s everyday currency - and shows off the properties of Ethereum by providing a solution that was impossible until blockchain technology.
We hope this article did a good job at giving you a basic background about Dai and the technology behind. This is only the beginning. You will be hearing much more about Dai and the importance of this stablecoin in DeFi (Decentralized Finance) in the next article, so stay tuned!
Don't hesitate to leave a comment letting us know if you have any questions or thoughts.