Decentralized Finance (DeFi) has revolutionized the way users interact with financial services on blockchain networks. At the forefront of this movement stands MakerDAO, one of the earliest and most influential DeFi protocols built on the Ethereum blockchain. Central to its ecosystem is the Collateralized Debt Position (CDP) — a smart contract mechanism that allows users to lock up crypto assets and generate the stablecoin Dai.
This guide dives deep into how MakerDAO’s CDP system works, the tokenomics behind it, key smart contracts, and the step-by-step process for borrowing Dai. Whether you're new to DeFi or looking to deepen your understanding of decentralized lending, this article provides a clear, structured breakdown.
How MakerDAO CDP Works: The Core Concept
MakerDAO is a decentralized autonomous organization that powers a two-token system: Dai, a USD-pegged stablecoin, and MKR, a governance token. The protocol enables users to borrow Dai by locking collateral — historically Ether (ETH) — into non-custodial smart contracts known as CDPs.
The CDP system ensures Dai remains stable through over-collateralization. This means users must deposit more in value than the amount of Dai they wish to borrow, typically at ratios exceeding 150%. If the value of the collateral drops too low, the system automatically liquidates part of it to maintain stability.
All operations are executed via transparent, tamper-proof smart contracts on Ethereum, eliminating intermediaries and enabling global access.
Step-by-Step: Borrowing Dai Through a CDP
Borrowing Dai using a CDP involves several critical stages, each governed by smart contract logic. Here's how it works:
1. Create a CDP and Deposit Collateral
To begin, a user initiates a transaction to open a new CDP within the MakerDAO system. While ETH is the original collateral asset, it must first be wrapped into WETH (Wrapped ETH), an ERC-20 equivalent of ETH.
Once converted, WETH is deposited into MakerDAO’s system and transformed into PETH (Pooled ETH), representing a share of the total ETH pool. This conversion rate fluctuates based on supply and demand dynamics within the protocol.
At this stage, the CDP is created and linked to the user’s wallet address.
👉 Discover how to securely manage your crypto assets while engaging with DeFi protocols like MakerDAO.
2. Generate Dai Against Your Collateral
After locking PETH into the CDP, the user can draw Dai from their position. The amount available depends on the current collateralization ratio and system-wide risk parameters.
When Dai is generated, the CDP records an equivalent debt denominated in art (internal accounting unit). This debt accrues interest over time in the form of stability fees, which are paid in MKR tokens upon repayment.
The newly minted Dai is sent directly to the user’s wallet and can be used freely — traded, saved, or reinvested across other DeFi platforms.
3. Repay Debt and Stability Fees
To reclaim collateral, users must repay both the borrowed Dai and the accrued stability fee. The stability fee is burned upon payment, reducing the total MKR supply — a deflationary mechanism incentivizing long-term token holders.
Repayment requires sending Dai back to the CDP and burning an equivalent amount of art. Simultaneously, MKR is transferred to cover the fee component.
4. Withdraw Collateral and Close the CDP
Once all debt and fees are settled, the user can unlock and withdraw their PETH. Optionally, they may close the CDP entirely. The withdrawn PETH can later be exchanged back into WETH and then unwrapped into ETH.
This full cycle ensures trustless, permissionless access to liquidity without selling underlying assets.
Key Tokens in the MakerDAO Ecosystem
Understanding the roles of various tokens is essential for navigating MakerDAO effectively:
- WETH (Wrapped ETH): An ERC-20 version of ETH, enabling compatibility with DeFi applications. Used as initial input for collateral.
- PETH (Pooled ETH): Represents a pro-rata share of the ETH pool in MakerDAO. Its value changes relative to WETH based on minting and burning activity.
- Dai: A decentralized stablecoin soft-pegged to $1 USD. Generated when users open CDPs and used globally across DeFi platforms.
- MKR: The governance and utility token. Used to pay stability fees and participate in protocol upgrades through voting.
- SIN: A legacy token representing defaulted debt during liquidation events. No longer actively used in current versions.
These tokens work together to maintain system solvency, incentivize participation, and ensure price stability.
Smart Contracts Powering CDP Functionality
MakerDAO operates through a suite of interconnected smart contracts. Two of the most critical ones during the early Sai (single-collateral Dai) era were:
Sai Tub Contract
Address: 0x448a5065aebb8e423f0896e6c5d525c040f59af3
This was the core CDP contract responsible for managing collateral deposits, Dai generation, and debt tracking. It handled interactions between WETH, PETH, and Dai.
Sai Tap Contract
Address: 0xbda109309f9fafa6dd6a9cb9f1df4085b27ee8ef
Responsible for converting surplus Dai into MKR during settlement phases, helping rebalance the system after periods of high stability fee accumulation.
While newer versions of MakerDAO (such as Multi-Collateral Dai) have evolved beyond these specific contracts, studying them offers valuable insight into DeFi’s foundational architecture.
Core Code Logic Behind CDP Operations
Let’s examine simplified snippets from the original Solidity implementation:
Open a New CDP
function open() public note returns (bytes32 cup) {
require(!off);
cupi = add(cupi, 1);
cup = bytes32(cupi);
cups[cup].lad = msg.sender;
LogNewCup(msg.sender, cup);
}This function increments the global counter (cupi) and assigns ownership (lad) of the new CDP (cup) to the caller.
Lock PETH as Collateral
function lock(bytes32 cup, uint wad) public note {
require(!off);
cups[cup].ink = add(cups[cup].ink, wad);
skr.pull(msg.sender, wad);
require(cups[cup].ink == 0 || cups[cup].ink > 0.005 ether);
}The ink variable tracks collateral amount. skr.pull() transfers PETH from the user to the contract.
Draw Dai Against Debt
function draw(bytes32 cup, uint wad) public note {
require(!off);
require(msg.sender == cups[cup].lad);
cups[cup].art = add(cups[cup].art, rdiv(wad, chi()));
sai.mint(cups[cup].lad, wad);
require(safe(cup));
}Here, art increases proportionally to newly drawn Dai (wad), adjusted by the accrual rate (chi). New Dai is minted and sent to the user only if safety checks pass.
Frequently Asked Questions (FAQ)
Q: What happens if my collateral value drops suddenly?
A: If your collateral ratio falls below the minimum threshold (e.g., 150%), your position becomes eligible for liquidation. A portion of your collateral is sold off at a discount to repay debt and stabilize the system.
Q: Can I use tokens other than ETH as collateral?
A: Yes. Modern versions of MakerDAO support multiple collateral types including WBTC, USDC, and others — known as Multi-Collateral Dai (MCD).
Q: Is there a time limit for repaying my debt?
A: No fixed deadline exists, but interest (stability fees) accrues continuously. Long-term debt holders should monitor rates and market conditions closely.
Q: How is Dai kept pegged to $1?
A: Through arbitrage mechanisms driven by stability fees and incentives for keepers (automated bots) to rebalance supply and demand.
Q: Do I earn yield on locked collateral?
A: Not directly within MakerDAO. However, some third-party protocols offer yield-enhanced CDP wrappers that stake or lend your position indirectly.
Core Keywords for SEO
- MakerDAO
- CDP
- Borrow Dai
- Ethereum DeFi
- Staking Crypto
- Decentralized Lending
- Stablecoin
- Smart Contracts
These terms reflect high-intent search queries related to decentralized borrowing and are naturally integrated throughout this guide to enhance visibility without compromising readability.
By combining over-collateralization with transparent governance and automated smart contracts, MakerDAO continues to set benchmarks in the DeFi space. As Ethereum evolves with Layer 2 scaling solutions and improved capital efficiency, protocols like MakerDAO will remain central to open financial innovation.
Whether you're borrowing Dai for short-term liquidity or exploring deeper DeFi integrations, understanding CDP mechanics empowers smarter, safer participation in decentralized finance.
👉 Start exploring DeFi opportunities today with secure wallet integration and real-time market data.