Sub topic 7
Crypto-backed stablecoins and on-chain collateral
This chapter assumes you know what a smart contract is, how a wallet signs a transaction, and what a stablecoin peg is. It also assumes you have seen how redemption and arbitrage pull a price back to the peg. Collateral ratios and liquidations get their own chapters next. Here we cover the structure that makes them necessary.
The core idea
A fiat-backed stablecoin holds dollars or Treasury bills at a bank or custodian. A crypto-backed stablecoin holds other crypto assets, such as ETH, in smart contracts on a blockchain. Nobody has to trust a bank account to see what backs the token, because anyone can read the contract's balances.
The problem is that the collateral is volatile and the stablecoin is not. If a token is meant to be worth 1 USD and is backed by ETH, a 40% drop in ETH could leave less than 1 USD of value behind each token. Crypto-backed designs therefore lock up more value than they issue. This is called overcollateralization. Someone who locks 150 USD of ETH can mint at most 100 USD of stablecoin.
How a vault works
Most crypto-backed systems use a vault (also called a collateralized debt position, or CDP). A vault is a smart-contract account that holds one user's collateral and records that user's debt. The flow is:
- The user deposits collateral, for example 5 ETH, into a vault.
- The user mints newly created stablecoins against it. The contract creates them and records them as the user's debt.
- The user spends or trades the stablecoins and keeps the vault open.
- To get the collateral back, the user repays the debt (plus fees) and the contract burns the returned stablecoins. The collateral is released.
The stablecoins in circulation are therefore backed by many separate vaults. Each vault is its own small loan, and the total supply equals the sum of all vault debts.
Why the collateral must be on-chain
Putting collateral in a smart contract has three consequences.
- Transparency. Anyone can query a vault's collateral and debt at any block. There is no quarterly report to wait for.
- Automatic rules. The contract enforces minimum ratios and fees in code. No human has to approve a liquidation.
- Permissionless access. Anyone with a wallet and collateral can open a vault. No bank approves the account.
The cost is that the system cannot hold off-chain assets such as bank deposits without extra trust. It also depends on the blockchain itself. If the network is congested, the system's safety mechanisms may not run on time.
Minting limits in code
The following script models one vault. It computes how much a user can still mint, the current collateral ratio, and the price at which the vault becomes eligible for liquidation. The numbers are the 5 ETH example from the diagram.
from dataclasses import dataclass
@dataclass
class Vault:
collateral_amount: float # units of collateral, e.g. ETH
debt: float = 0.0 # stablecoins owed
min_ratio: float = 1.5 # 150% minimum
def ratio(self, price):
if self.debt == 0:
return float("inf")
return self.collateral_amount * price / self.debt
def max_mint(self, price):
"""Additional stablecoins that can be minted right now."""
return self.collateral_amount * price / self.min_ratio - self.debt
def mint(self, amount, price):
if amount > self.max_mint(price):
raise ValueError("mint would drop the vault below the minimum ratio")
self.debt += amount
def liquidation_price(self):
return self.debt * self.min_ratio / self.collateral_amount
def is_liquidatable(self, price):
return self.ratio(price) < self.min_ratio
vault = Vault(collateral_amount=5)
print(vault.max_mint(3000)) # 10000.0
vault.mint(6000, 3000)
print(vault.ratio(3000)) # 2.5
print(vault.max_mint(3000)) # 4000.0
try:
vault.mint(5000, 3000)
except ValueError as err:
print("rejected:", err)
print(vault.liquidation_price()) # 1800.0
print(vault.is_liquidatable(1700)) # TrueThe vault can mint up to 10,000 at 3,000 USD per ETH, but the user mints only 6,000. The gap between the debt and the maximum is a safety buffer. A user who mints the maximum has no room for any price drop.
Oracles: how the contract learns the price
A smart contract cannot look up the ETH price by itself. It relies on an oracle, a service or contract that publishes external data on-chain. Every vault check, whether a new mint or a liquidation trigger, depends on that number.
This makes the oracle a central point of failure.
- Manipulation. If an oracle reads the spot price from one thinly traded pool, an attacker can briefly push that price and trigger bad liquidations or mint too much. Production systems aggregate many sources or use time-averaged prices.
- Staleness. If the oracle stops updating during a crash, the contract keeps using an old, high price. Vaults that should be liquidated stay open.
- Delay by design. Some systems apply a price update with an hour's delay so that governance can react to an oracle attack. During a fast crash this delay also postpones liquidations.
Keeping the price near 1 USD
Overcollateralization makes sure the system can pay off debt. It does not by itself make the market price equal 1 USD. Crypto-backed systems rely on the redemption and arbitrage logic from the earlier chapter, plus tools of their own.
- Debt repayment as a floor. If the token trades at 0.97, a vault owner can buy tokens cheaply to repay a 1.00 debt and reclaim collateral. That demand pushes the price up.
- Minting as a ceiling. If the token trades at 1.03, users can open vaults, mint at 1.00 of debt, and sell at 1.03. The new supply pushes the price down.
- Stability fees. The protocol charges interest on debt. Raising the fee discourages minting and shrinks supply. Lowering it does the opposite.
- Peg stability modules. Some systems let users swap another stablecoin one-for-one with a small fee. This is a strong peg tool, but it imports the risk of the other stablecoin, as discussed below.
Notice that the floor works only because vaults are over-collateralized. A user repays a debt of 1.00 per token and can only gain if the collateral is worth more than the debt.
Governance and collateral choice
Someone decides which assets count as collateral, what minimum ratio each needs, and what fees apply. In many protocols this is done by token holders voting. That adds a human layer to an otherwise automatic system.
| Decision | What it controls | Risk if chosen badly |
|---|---|---|
| Accepted collateral | Which assets back the supply | Illiquid or correlated assets can fail together |
| Minimum ratio per asset | Buffer against price drops | Too low means bad debt in a crash |
| Stability fee | Cost of holding debt | Too high drives users away, too low allows excess minting |
| Oracle source | How prices reach the contract | Manipulation or stale prices |
| Debt ceiling per asset | Cap on exposure to one asset | Too high concentrates risk |
Riskier collateral gets a higher minimum ratio. For example, a volatile small token may need 200% or more, while ETH may need 145–170%.
Comparing the two designs
| Property | Fiat-backed | Crypto-backed |
|---|---|---|
| Backing | Bank deposits, Treasury bills | On-chain crypto in vaults |
| Backing per token | About 1:1 | Above 1:1, often 1.5x or more |
| Who can verify | Attestation reports | Anyone, in real time |
| Main risk | Issuer, custodian, reserve quality | Collateral crash, oracle, contract bugs |
| Capital efficiency | High | Low, because collateral is locked |
| Censorship | Issuer can freeze addresses | Depends on the collateral and the protocol |
What goes wrong in practice
A fast crash. On 12 March 2020 (often called "Black Thursday"), ETH lost a large share of its value in a day, and Ethereum was heavily congested. Liquidators' transactions failed or were delayed. Some collateral auctions finished with winning bids of zero, because nobody else could bid. The MakerDAO system ended up with bad debt and had to cover the gap by creating and selling new governance tokens. The lesson is that liquidation works only if liquidators can actually transact.
Imported centralization. After 2020, Maker added large amounts of USDC as collateral to make the peg easier to defend. In March 2023, when USDC briefly fell to about 0.87 because Circle had funds at Silicon Valley Bank, DAI also dropped, to roughly 0.89. A "decentralized" stablecoin was exposed to a fiat-backed one. The more a crypto-backed system leans on another stablecoin, the more it inherits that coin's risks.
Correlated collateral. If most vaults hold ETH, a single ETH crash puts every vault under pressure at the same time. Liquidators then all sell ETH together, which pushes the price down further.
Smart contract bugs. A flaw in the vault contract can let someone mint without collateral or withdraw someone else's. Audits reduce this risk but do not remove it.
User error. Many losses come from users who mint close to the limit. A normal price swing then costs them the collateral, plus a liquidation penalty.
Common mistakes to avoid
- Treating the minimum ratio as a target. It is the point of forced sale, not a comfortable level.
- Assuming "on-chain" means "risk-free". The risk moves from a bank to code, oracles, governance, and the collateral market.
- Ignoring the liquidation penalty. Liquidators receive collateral at a discount, which the vault owner pays for.
- Forgetting fees. The stability fee increases the debt over time, so the ratio drops even if the collateral price is flat.
Exercise
A user deposits 20 ETH when ETH costs 2,500 USD and mints 20,000 stablecoins. The protocol's minimum ratio is 160%. (a) What is the collateral ratio? (b) At what ETH price does the vault become liquidatable? (c) Name one reason the real price at liquidation might differ from the price you computed.
Show answer
(a) Collateral value is 20 × 2,500 = 50,000 USD, so the ratio is 50,000 / 20,000 = 2.5, or 250%. (b) The liquidation price is debt × minimum ratio / collateral amount = 20,000 × 1.6 / 20 = 1,600 USD per ETH. (c) Any of these: the oracle price lags the market, the stability fee has increased the debt so the trigger price is higher than 1,600, or network congestion delays the liquidation so the vault is closed at a worse price.
Exercise
Why does a crypto-backed stablecoin hold more than 1 USD of collateral per token, while a fiat-backed one can hold about 1 USD?
Show answer
Fiat reserves such as cash and Treasury bills are stable in dollar terms, so 1 USD of reserve covers 1 token. Crypto collateral can fall sharply in minutes, so the system needs a buffer. Extra collateral absorbs the drop and lets liquidations repay the debt before the collateral is worth less than the debt.