Decentralized "short" agreement dYdX's hope and hope

If you are concerned about the DeFi field, you may be familiar with a name. It is dYdX, a decentralized financial derivatives agreement built on the Ethereum blockchain.

At the end of December 2017, the dYdX project announced that it had received $10 million in seed round financing from Andreessen Horowitz and Polychain Capital. Other well-known investors include Fred Ehrsam (former partner of Coinbase) and Brian Armstrong ( Coinbase CEO) and so on.

According to dYdX's original design, it allowed users to perform "no-trust" peer-to-peer E-Payment token trading and options trading, and it has now expanded its lending business.

On May 1 this year, dYdX officially opened the Ethereum main online line, and the public is free to use this open source agreement.

As of now, the operations that can be performed on the dYdX platform are still very limited, mainly divided into two types:

  1. Decentralized margin trading (the leverage ratio is up to 4x, supporting ETH-DAI, ETH-USDC, DAI-USDC three trading pairs)
  2. Decentralized lending (currently supports three assets: ETH, DAI, and USDC)

Relationship between dYdX and existing decentralized transaction agreements

In order for decentralized derivatives or leveraged trading agreements to work, dYdX needs a way to trade assets without trust and determine the price of asset exchanges, which is where decentralized trading agreements come into play. In theory, dYdX can work with any standard decentralized transaction protocol based on Ethereum, and at the beginning, dYdX used the 0x protocol .

Two major agreements for dYdX design

According to the white paper, dYdX will consist of multiple protocols that specify different types of financial products. Here is a brief mention:

1. Margin Trading Agreement

The dYdX Margin Trading Agreement uses a major Ethereum Smart Contract to facilitate decentralized margin trading of ERC20 tokens. The lender can provide a loan for the margin transaction by signing a message containing the loan information (such as the amount, the token involved, and the interest rate). This information can be spread out of the chain and then found by the demand side (ie the trader).

The trader opens a margin position by sending the transaction to the dYdX Margin Smart Contract, which includes information such as the loan offer, the purchase order to borrow the token, and the amount of the loan. Upon receipt of this transaction, the Smart Contract transfers the margin deposit from the trader to itself, then uses the external decentralized exchange (currently 0x) and sells the loan token with the specified purchase order.

When a trader sends a trade to a smart contract that contains a sell order, the margin position is closed.

Upon receipt of this transaction, the contract uses an external decentralized exchange to execute the relevant transaction. The contract then sends the arrears of the borrowed token to the lender, including the interest fee, and the trader receives all remaining tokens (equivalent to deposit + profit). Note that if the direction of the trade is wrong, the profit is negative and there may even be a situation of a short position.

For margin trading, the first version of dYdX uses three types of contracts:

(1) Margin contract: Margin contract provides the function of enabling margin trading, which includes all business logic and public functions. It also includes the status of the storage location. The design of the margin contract makes the existing position not be modified by any external party.

(2) Agency contract: agency contract is used to transfer user funds;

(3) Vault contract: as a vault, responsible for the assets in the custody of the margin trading;

In the V2 version of the margin trading agreement, it is subdivided into the following contracts:

1 (Source:

These smart contracts were audited by Zeppelin Solutions and the audit firm of Bramah Systems. The relevant reports are as follows:

  1. Https://

2. Option Agreement (Note: Not yet implemented, just planning)

According to the design of the white paper, the dYdX option agreement uses an Ethereum smart contract for each type of option.

Type is a given set of input parameters, including base tokens, quote tokens, execution price, and expiration date.

The base token refers to the asset to which the option is directed, and the quote token refers to the token that is valued at the premium and the execution price.

These contracts can be used as put or call options by simply converting the base token and the quote token and counteracting the strike price.

Unlike traditional options, the process involved is done through smart contracts rather than centralized exchanges.

Actual experience: margin trading is less liquid, more as a lending platform

As of now, dydx only offers a limited number of trading pairs, including its own ETH-DAI (dYdX) trading pair, as well as other markets such as ETH-DAI (Eth2dai), ETH-USDC (Radar), and DAI-USDC (Radar). ) The transaction is right.

In the past 24 hours, the total transaction volume of these trading pairs was only 760,000 US dollars. Compared with the trading volume of hundreds of millions of dollars in mainstream centralized trading, dydx is very bleak, and this is the overall situation of the DEX market. It is consistent.


(Data from:

There is a heart to plant flowers and flowers, and there is no intention to insert a willow. The dydx white paper describes less lending business but the market is bigger:


Currently, on the dydx platform, the lending funds of the stable currency DAI are 1,254,351,5.9,311 DAI (about US$21.67 million), and the borrowed funds reach 915,668,4.0657 DAI (about US$ 9.25 million). The high demand leads to DAI's annual interest rate of 8.86%. The annual interest rate for lending is 6.16%.

In contrast, ETH's lending funds reached 115627.5642ETH (worth about 19.19 million US dollars), borrowed funds only 10687.2799ETH (worth about 1.774 million US dollars), borrowing and lending ratio is only about 1:11, obviously the current market is right Unsteady currency borrowing demand is relatively small, so its interest rate is also much lower. ETH borrows an annual interest rate of 0.92% and lends an annual interest rate of only 0.08%.

In operation, dydx is similar to another loan application, you need to prepare a MetaMask wallet and a number of ETH or DAI in advance. Then you can interact with the smart contract via the graphical buttons on the dydx platform. (If you are not familiar with the process, you can refer to this guide )

Risk tips and some opinions

Although some of dYdX's contracts have been audited by third-party security companies, this does not guarantee that their contracts are secure. For example, the 0x protocol on which the Margin Trading protocol relies has been found to have serious security vulnerabilities not long ago.

In addition, the dydx project party also stated that its agreement governance will be completed in the future through DAO (Decentralized Autonomous Organization), which is undoubtedly an exciting goal, but at the same time it will inevitably bring more challenges and may even introduce security. Hidden dangers.

But I also want to say that despite these security risks, dYdX's innovation is indeed visible, adding more possibilities for decentralized transactions (DEX).

At the moment, DEX may not be able to compete with CEX, but they are growing step by step, aren't they?

Reference materials: