dYdX (DYDX): Trading Spot, Margin and Perpetuals on the Ethereum Blockchain | Deep Dive
Review Date: February 18, 2021
dYdX is a non-custodial decentralised trading platform that offers spot trading, margin trading and perpetual markets plus traditional borrowing and lending all powered by the Ethereum blockchain. The exchange unlike many other derivative protocols adopts the central limit order book model instead of an automated market maker which allows Institutional grade liquidity for low slippage trading.
Beyond its current architecture, the team is actively integrating Starkware’s layer-2 scalability solution utilising zero-knowledge proof cryptography to vastly reduce the gas costs per trade and offers instant transaction execution which is imperative for any derivatives protocol. Backed by the likes of Andreessen Horowitz and 3 Arrows Capital the most prominent venture capital funds in both Silicon Valley and the cryptocurrency asset class dYdX is positioned to be a true powerhouse in decentralizing derivative products.
dYdX Exchange Architecture
The dYdX exchange adopts an off-chain order book model which allows market makers and traders to sign and transmit orders on an off-blockchain platform and then use the Ethereum blockchain as a settlement layer.
This model does have its advantages when it comes to providing Institutional grade liquidity for low slippage trading as orders can be matched off-chain using a low-latency matching engine and then settled on-chain.
Since liquidity providers are market-making firms such as Wintermute and not a two asset pool as used in automated market makers; there is no impermanent loss when supplying liquidity for margin and perpetual trading. The protocol is also non-custodial meaning that a traditional regulated clearinghouse is not needed to execute trades as required by centralised exchanges.
A margin trader on dYdX automatically borrows funds from lenders who have deposited their liquidity into one of the dYdX lending pools. After a margin trade is executed the trader’s collateral earns interest whilst the trade is open by utilising the lending pools available on dYdX which in turn will maximise yield. Additionally, any deposited funds into a margin account will earn interest via the same mechanism. This passive utilization of crypto-assets on a decentralised exchange is an incentive for traders to transfer their capital from centralized exchanges where their assets remain unproductive.
Starkware & Starkex Layer-2 Integration
Starkware is a team of advanced cryptography researchers who are laying the foundations for new cryptographic schemes in the area of zero-knowledge proofs and implementing such schemes into code that can be leveraged to scale public blockchains and provide on-chain privacy for blockchain users.
Their main focus is zk-STARK’s which are very similar to zk-SNARK’s a type of zero-knowledge cryptography that is the foundation of the zero-knowledge rollup layer-2 scalability solution. Beyond their cryptography research, the team is actively solving complex problems such as layer-2 interoperability, post-quantum cryptography (security against quantum computers) and improving the migration between layer-1 and layer-2.
StarkEx is Starkware’s scalability engine which utilises zk-STARK’s to batch transactions off-chain which then produces a STARK proof proving the validity of the batch of transactions and then submits these cryptographic proof on-chain. Submitting STARK proofs on-chain costs substantially less gas than submitting a traditional transaction with the information-dense digital signature which is responsible for the majority of the gas cost in an on-chain transaction. StarkEx currently supports ETH, ERC-20’s and ERC-721’s plus can support any EVM compatible blockchain (blockchains that use the same virtual machine as Ethereum).
StarkEx is a production-ready layer-2 scalability solution that has been live on mainnet since June 2020 and has processed over 50m transactions on both public and private Ethereum networks. At this present time, StarkEx is upgrading to StarkEx 2.0 which introduces some impressive functionality such as the new general-purpose programming language Cairo that can produce STARK proofs for any general computation. The new functionality of StarkEx 2.0 is the following [4]:
- Cairo – A general purpose programming language for generating STARK proofs. dYdX integration will be directly powered by the Cairo programming language.
- Fast L1-L2 Connectivity – Allowing L1 transactions to be validated without having to sync up with the state on L2. This ultimately means faster deposits and withdrawals from L1 to L2 and vice versa.
- Flexibility – Allowing the withdrawal and deposit to any L1 wallet whether it be a browser wallet or a hardware wallet. Integrating this following layer-2 architecture in February 2021 offers the following benefits to the dYdX exchange:
- Reduced gas costs and trading fees
- Reduced minimum trade size
- Cross-margin (multiple perpetual positions open on a single account)
- Instant Trade Settlement (off-chain matching until on-chain submission of zkp)
- Performant Price Oracles (reduces oracle latency)
On-Chain Data Overview
The growth of dYdX in 2020 has been staggering with a huge increase in total cumulative volume, volume in perpetual markets and simply the number of unique users utilizing the decentralized exchange to facilitate their crypto-asset trading. 2020 was a huge year for dYdX which can be expressed by the following statistics [5]:
- Total Cumulative Trade Volume:
$63m in 2019 to $2.5B in 2020.
- Spot and Margin Trade Volume:
$1.9B in 2020.
- Perpetual Market Trade Volume:
$563m in 2020.
- Unique wallets depositing funds:
8,000 to 38,588 in 2020.
These statistics are certainly impressive in terms of protocol growth but one must take into account the number of traders that are currently impaired by the gas fees associated with executing trades on a decentralized exchange. As the end of Q1 2021 approaches and dYdX successfully integrates the StarkEx layer-2 scalability solution into its perpetual markets; the exchange will see huge growth in the perpetual market trading volume.
Essentially the gas costs users will incur when trading is the migration from their layer-1 account to their layer-2 account on dYdX.
There are several metrics commonly used in the valuation of equities that can also be applied to DeFi protocol. In the last 30-day period the Total value locked (TVL) in the last 30-day period increased by $163m (+113.75%), Gross Merchandise Volume has increased by $1.18bn and Revenue has increased by $4.17m [6]. The definitions and diagrams for the above-mentioned statistics can be found in the appendices.
Series A & B Investment Rounds
dYdX series A investment round was led by venture capital funds such as Andreesen Horowtiz, Polychain Capital, Dragonfly Capital and prominent angel investors such as Naval Ravikant. Recently dYdX raised a $10m series B investment round this time led by 3 Arrows Capital and DeFiance Capital along with the likes of Wintermute a UK-based crypto market-making firm, the Spartan Group and RockTree Capital [7].
Tokenomics Speculation
DeFi token models are designed in a way that the holders of the token benefit proportionally to the network’s growth and usage. So far three distinct token models have emerged in which users are able to govern the protocol and directly benefit from the revenue it produces:
- Fee token: The revenue generated by the protocol is distributed back to the token holder often in the form of stablecoins.
- Governance Token: Token holders have the right to govern the protocol via protocol proposals which can modify the behaviour of the protocols smart contracts.
- Collateral of last-resort: Tokens can be used as a means of providing a backstop for the protocol to maintain a peg at a specified price. Token is used as liquidity to purchase/sell pegged assets on the market.
dYdX tokenomics will most likely involve a governance token that allows the community of holders to govern the direction of the protocol. Since dYdX is expanding its derivative trading, especially in the form of L2 perpetual markets it could be safe to assume that the derivative trading fees captured from these markets are distributed to the dYdX token holders by combining the governance and fee token model. The question to address here is if this is true how will protocol revenue be distributed?
A common model is staking the token which will allow both the capture of token inflation and distributing of trading fees very similar to the Perpetual protocols token model. However, staking is known to have a negative impact on liquidity for the governance token in the open market which can create price instability so it remains to be seen if and how dYdX will distribute its revenue to token holders.
Summary
dYdX is a multi-purpose decentralized exchange that offers spot trading, margin trading and perpetual contracts to traders with Institutional grade liquidity via their off-chain order book model and partnerships with crypto market-making firms such as Wintermute.
The major obstacle to the adoption of derivatives on decentralized exchanges is the current cost to executing transactions on the Ethereum blockchain due to its current scalability limitations. An imminent layer-2 integration is set to launch for dYdX’s perpetual markets which will significantly reduce gas costs for traders, oracle latency for pricing and reduce the amount of capital needed to trade on the exchange. A successful integration could bootstrap volume and make dYdX one of the largest derivatives exchanges in DeFi by a significant margin.
Backed by major firms in Silicon Valley and the DeFi ecosystem with a successful $10m Series B investment round this is certainly a protocol that is coming to maturity and will most likely launch a governance token and distribute it based on those who have traded on dYdX and those who have participated in lending/ borrowing crypto assets to facilitate margin trading on their DEX.
Reference
- https://trade.dydx.exchange/perpetual/ETH-USD
- https://trade.dydx.exchange/markets/overview
- https://medium.com/starkware/starks-over-mainnet-b83e63db04c0
- https://medium.com/starkware/starkex-2-0-is-now-live-on-mainnet-d8768b860bd4
- https://integral.dydx.exchange/2020-review/
- https://terminal.tokenterminal.com/dashboard/dYdX
- https://integral.dydx.exchange/dydx-closes-10m-series-b-investment/
- https://docs.tokenterminal.com/our-metrics