Why did dYdX choose to launch its own chain instead of continuing with a Layer 2 solution?

CoinVoiceMar 20, 2024
Why did dYdX choose to launch its own chain instead of continuing with a Layer 2 solution?

This article was written with a research grant from the dYdX Foundation. I extend my thanks to the dYdX Foundation.

1. Introduction and Background

1.1 Purpose of This Article: Why dYdX?

Many people think of dYdX as the most successful Decentralized Exchange (DEX), and while this is true, from a researcher's perspective, dYdX is an intriguing project for two main reasons: 1) It serves as a practical counterexample to the current blockchain industry trend of building 'its own rollups', and 2) It provides a significant case study in the fiercely debated infrastructure vs. application debate within the industry. Let's explore these reasons in detail.

1.1.1 A Direct Counterexample to Rollup Maximalism

The blockchain industry in 2023 can be aptly described as the 'era of rollups,' with numerous rollup chains emerging. After the fall of Terra, once considered a strong competitor to Ethereum, and Solana's substantial setbacks due to the FTX crisis, the narrative that 'Ethereum has triumphed' dominated the blockchain sector. Consequently, many projects abandoned building their own Layer 1 blockchains in favor of becoming Ethereum rollups, which offered inherited security from Ethereum while allowing for some degree of autonomy.

However, this did not mean the end of Layer 1 chains. Many projects derived from Meta's blockchain project, Diem, introduced new concepts in various fields, including Consensus(Bullshark, Narwal, and etc). What's truly fascinating are projects that transitioned from being a rollup to launching their own Layer 1 chains. It's intriguing why a project, particularly successful as a Layer 2, would abandon all that to launch its chain. This is exactly what dYdX did, making it a direct counterexample to the 'rollup maximalism'. dYdX wasn’t initially a Layer 1 chain nor was it an unpopular project as a Layer 2. Its transition to a self-sovereign chain raises questions about why Layer 2 solutions might not be the answer to every problem.

1.1.2 A Significant Case in the Infrastructure vs. Application Debate

Secondly, dYdX presents a substantial example in the ongoing debate about whether infrastructure or applications should come first. As we'll discuss later, dYdX experienced improvements in product quality concurrent with advancements in the infrastructure on which it was built. Essentially, the argument that 'robust infrastructure is necessary for product development' finds concrete support in dYdX's journey. The project evolved its product through two significant changes in its infrastructure, ultimately benefitting from better scalability and user-friendliness. Therefore, dYdX stands as a pertinent example supporting the importance of infrastructure in this debate.

1.1.3 Let’s Delve into dYdX

Beyond the aforementioned reasons, dYdX is a fascinating project in many ways. It had previously migrated from the Ethereum main-chain to Layer 2 and, paradoxically, faced existential challenges during the bloom of DeFi. The crises dYdX faced and how it overcame them are not only interesting but also provide valuable lessons for those creating on-chain products.

Thus, through this article, I aim to provide an overview of dYdX's history and a detailed explanation of why it launched its own chain. I will compare the original and new versions of dYdX and finally discuss the implications of dYdX's trajectory for the industry. This analysis should be beneficial for those contemplating launching or pivoting products in this space.

1.2 Explanation of Crypto Perpetual DEX Protocols

First and foremost, dYdX is a decentralized exchange (DEX) that currently specializes in derivatives, particularly perpetual futures contracts (though it initially started with margin trading and covered options). To understand dYdX, one must first grasp the concept of a Crypto Perpetual DEX. A decentralized exchange operates differently from traditional centralized exchanges. Instead of a centralized entity processing transactions, decentralized exchanges use blockchain and smart contracts to manage trades in a decentralized manner. Perpetual futures, similar to regular futures contracts (which involve trading an asset or commodity at a predetermined price at a specific time in the future), operate in a similar manner but with no set expiry date. This lack of maturity means traders can maintain their positions indefinitely.

Therefore, dYdX, as a Crypto Perpetual DEX, handles perpetual futures contracts involving crypto assets in a way that is distinct from traditional exchanges. It uses blockchain and smart contracts to facilitate transactions in a highly decentralized manner.

With an understanding of decentralized perpetual futures exchanges, let's delve deeper into dYdX and its history.

1.3 Brief Background History of dYdX: From CEX to DEX

Antonio Juliano, the founder of dYdX, had been building his career in the blockchain industry before dYdX. Interestingly, his crypto/blockchain career began as a developer at Coinbase, one of the world's largest cryptocurrency exchanges. Working at Coinbase, Antonio gained extensive knowledge about blockchain and cryptocurrencies, which likely played a role in inspiring the concept for dYdX. At the time Antonio was conceptualizing dYdX, margin trading was becoming increasingly popular in the crypto industry, with many investors using leverage for aggressive investment strategies. Antonio envisioned implementing these leverage trades on the blockchain, leading to the creation of dYdX.

Subsequently, dYdX received an investment of approximately $2 million, valuing it at $10 million, from prestigious entities like a16z and Polychain (https://medium.com/dydxderivatives/dydx-raises-10m-series-a-1250b7e0e1df). The project gradually expanded, introducing its product to the world.

The dYdX of that time was quite different from what it is today. It wasn't built on Layer 2 (surprisingly, it was deployed on the Ethereum main chain) and initially didn't have its own trading system (it utilized a third-party DEX). Furthermore, as mentioned earlier, dYdX did not start with supporting perpetual futures trading. So, how did the dYdX that we know today come to be?

1.3.1 Gas, Gas, Gas! The DeFi Summer Catastrophe: From L1 to L2

To understand dYdX's transition from the Ethereum mainnet to Layer 2, we need to revisit the events leading up to early 2020. Contrary to what many might know, dYdX was one of the highest-volume applications among decentralized exchanges at the time, accounting for about half of all decentralized exchange volumes. However, everything changed with the onset of what is known as the DeFi (Decentralized Finance) Summer, triggered by Compound launching its governance token, $COMP, and introducing the concept of liquidity mining.

During the DeFi Summer, there was an explosion of DeFi tokens (many created trivially to encourage liquidity supply, though their prices surged without substantial backing). New DeFi tokens were rapidly listed and traded on Uniswap, leading many traders to shift to using Uniswap. This shift significantly reduced dYdX's trading volume from 50% to a negligible 0.5%.

The DeFi Summer posed more than just a market share challenge for dYdX. Ethereum's transaction fees skyrocketed during this period, posing a near-existential threat to dYdX, which had been covering transaction fees for its users to enhance their experience. Before the DeFi Summer, transaction fees were low enough to be covered by dYdX's trading fees. However, with Ethereum's transaction fees surging by approximately 100 to 1000 times, dYdX faced severe financial losses. Measures such as setting a minimum trade amount (e.g., $10,000) were implemented, but ultimately, dYdX had to introduce trading fees proportional to that of Ethereum, creating a prohibitive barrier for its users (often paying over $100 per transaction).

Ironically, dYdX encountered one of the most difficult challenges during the peak of DeFi's popularity. Few are aware, but at this time, dYdX was on the brink of bankruptcy. With limited runway and existing investors reluctant to double down, dYdX was in a severe financial crisis. Furthermore, the company was struggling to differentiate its product in the market (interestingly, Three Arrows Capital was one of the firms that provided funding during this period).

Ultimately, to navigate out of this precarious situation, dYdX needed a fundamental change, which led to its departure from the Ethereum mainnet. This transition gave birth to the dYdX we know today, based on Starkware's a STARK-powered scalability engine called StarkEx.

2. dYdX Meets Starkware, Things Started to Change

2.1 Why Layer 2?

The adoption of a Layer 2 solution by dYdX was not only a strategic move to counter its difficulty in competing with Uniswap but, more importantly, a necessary response to the unsustainable transaction fees on Ethereum. Layer 2 presented an alternative that could handle dYdX's throughput while imposing much lower fees.

Moreover, at that time, Ethereum's Layer 2 solutions, particularly Starkware(StarkEx), were optimally designed for transferring services from the Ethereum mainnet. Offering significant scalability while leveraging Ethereum's security made Starkware an attractive alternative for dYdX. This scalability also enabled dYdX to experiment with various product innovations, significantly contributing to the overall development of the dYdX platform. (This transition to Layer 2 and the subsequent product enhancements are why I consider dYdX a prime example in the "infrastructure-first or application-first" debate)

As I will elaborate later, the dYdX commonly known before the launch of its independent chain was essentially based on Starkware. By leveraging the Layer 2 solution, dYdX entered its most prosperous phase. Let's analyze in detail how dYdX fared after transitioning to Layer 2.

2.2 Why Starkware(StarkEx) Specifically?

In fact, when dYdX adopted Starkware, the first question that comes to mind is why Starkware, out of the many Layer 2 solutions available? Other Layer 2 solutions also provided highly efficient environments compared to Ethereum, so if Starkware did not have a clear distinguishing feature, there would have been no reason for dYdX to specifically choose Starkware. So, what was different about Starkware compared to other rollups, and other ZK rollups in particular?

Firstly, Starkware is a Layer 2 solution especially optimized for applications like dYdX that need to process a large number of transactions per second. This is because Starkware can batch many transactions into one. However, this feature is not unique to Starkware, as other ZK rollups also possess this capability. The real differentiation of Starkware lies in its ability to handle a wider variety of transaction types. Of course, various methodologies such as zkEVM are emerging now, but when dYdX was exploring Layer 2 solutions, most ZK rollups were primarily optimized for simple transactions (like token transfers). Therefore, dYdX was looking for a solution that could batch transactions and also support its own smart contracts, and at that time, Starkware's StarkEx was the alternative that satisfied both these conditions. Although Starkware is not EVM compatible, meaning building applications on Starkware requires learning its proprietary language (Cairo), this did not seem to be a significant obstacle for dYdX.

Additionally, according to Antonio Juliano, at that time, Starkware provided the most convenient environment for Ethereum-based applications to onboard and was the most prepared in terms of shipping products.

2.3 dYdX After Starkware Implementation, Growth Growth Growth

Leveraging Starkware's infrastructure, dYdX introduced cross margin trading (a margin trading method in which multiple positions could be collateralized by one margin account), based on its enhanced scalability. This change brought more liquidity to dYdX. Moreover, by supporting a wider array of assets, dYdX successfully attracted numerous traders. With its new engine, dYdX experienced a fivefold increase in trading volume compared to its past performance, marking a significant leap in growth.

2.3.1 Introducing $DYDX, A Perfect Consolidation Strategy

Armed with StarkEx, dYdX Foundation launched the $DYDX token in the summer of 2021 to further solidify its position. $DYDX serves as a governance token for the dYdX project. Its ultimate goal is to enable the protocol to be organically operated by the community, but it also aims to provide incentives for more active participation from protocol users. Despite showing remarkable growth post-transition to Layer 2, the launch of the token was an initiative towards 'consolidation'. Let's take a look at the distribution of the $DYDX token.

The $DYDX token has a somewhat different distribution plan compared to other tokens, particularly in the aspects of Retroactive Mining, Trading Rewards, and Liquidity Provider Rewards. Let's examine each of these components.

Retroactive Mining

Since dYdX had been operating without a token, launching one suddenly and offering it as an incentive only to new users would raise equity issues and possibly deter long-standing dYdX users from continued use. To address this, dYdX introduced Retroactive Mining. As implied by the term 'retroactive', this reward system distributes tokens to users who have traded on dYdX in the past. Simply having deposited money and made at least one trade on dYdX qualifies users for token rewards under Retroactive Mining. However, rewards aren't just for past trading; participants also have to engage in trading on the Layer 2 implemented dYdX and achieve specific goals to be eligible. This approach enabled dYdX to reward past users while also attracting those who had only used the platform in the past to the new Layer 2 dYdX. Approximately 5% of the total token supply was allocated for Retroactive Mining rewards.

Trading Rewards

Trading Rewards, as the name suggests, are incentives given to individuals who trade on the Layer 2 dYdX, with around 20% of the total token supply designated for this purpose. The basis for these rewards is the amount of fees paid on dYdX. For more detailed information, refer to dYdX's documentation.

Liquidity Provider Rewards

In addition to trading incentives, liquidity providers were also awarded $DYDX tokens, similar to other DeFi tokens. The aim of this reward is to enrich liquidity on both sides (buy side and sell side), with about 5.2% of the total token supply distributed to liquidity providers. For more on the specific method of incentive distribution, refer to dYdX's documentation.

Impact of $DYDX

The launch of dYdX's token was an enormous success. While the daily trading volume for dYdX's perpetual futures product on Layer 2 initially stood at around $30 million, it surged to $2 billion after the token launch, indicating a tremendous growth trajectory. This signifies the remarkable success of dYdX's token launch.

2.4 Limitations of Layer 2 for dYdX, From L2 to L1.

Ultimately, dYdX’s Layer 2 strategy was highly successful. The transition to Layer 2 not only saved their product from the brink of extinction but also transformed it into one of the most notable products in the market. Subsequently, with the launch of its token, dYdX established itself as a unique project among decentralized exchanges. However, as revealed in the concerns of dYdX’s founder Antonio Juliano, there were significant deliberations about the product's identity.

"This led to an existential question for us: if we never became fully decentralized, what was our competitive advantage over Binance & FTX? What could we do 10x better than them? Honestly, I didn’t really have a good answer at that point."

Antonio Juliano, Founder of dYdX

While Layer 2 based dYdX achieved great success, there were still many ambiguous aspects to it. First, it was not a fully decentralized product (Layer 2 based dYdX was a hybrid type of decentralized exchange. In other words, the order book and matching engine operated in a centralized manner), and despite significant improvements in scalability, dYdX needed to handle even more trades to evolve further (this also suggests that infrastructure still plays a crucial role in the development of the product). Moreover, dYdX required an infrastructure tailored to its product. Although Layer 2 provided an environment for somewhat customizing infrastructure, dYdX needed to go further to align every aspect with its product. For this, relying on existing networks as a Layer 2 solution was not the ideal answer.

For dYdX to become a better product, it had to handle more trades while firmly establishing its identity as a decentralized exchange and adding and modifying features suitable for a decentralized exchange. Therefore, dYdX chose to once again shift its blockchain infrastructure.

3. V4 - The Shift to a Sovereign Chain

3.1 Why Standalone Chain? A Path towards Full Decentralization.

As shared earlier, Antonio Juliano, the founder of dYdX, continuously pondered over what distinguished dYdX from other Centralized Exchanges (CEXs). Eventually, did dYdX, being a decentralized exchange, consider achieving perfect decentralization as its unique selling point? Among the various reasons for launching its own chain, one of the primary goals cited was “attaining full decentralization.” Ethereum enthusiasts might question how departing from Ethereum, the most decentralized Layer 1 network, to launch a proprietary chain could lead to decentralization. However, since dYdX did not process all aspects of its product on-chain, Ethereum’s decentralization becomes somewhat irrelevant in this context. Perhaps, the Ethereum supporters and dYdX had different interpretations of decentralization.

What dYdX truly sought was not to ‘somewhat’ leverage a decentralized network but to resolve every aspect of its product in a fully decentralized manner, which inevitably meant launching its own chain. It implies that being implemented on the most decentralized network does not automatically ensure complete decentralization.

By launching its own chain, dYdX finally succeeded in operating all aspects, including the order book, in a decentralized manner. dYdX Trading, Inc., the corporation behind dYdX, currently does not involve itself in any aspect of the dYdX chain.

Another critical aspect is scalability. Launching its own chain allowed dYdX to not only enable decentralization in all parts of its product but also to secure the scalability that was previously lacking. While dYdX on Layer 2 could process around 100 transactions per second, its proprietary chain has now achieved a performance enhancement allowing around 2,000 transactions per second. This is a 20-fold increase in performance. Such an enhancement in performance is likely to bring about as significant a change in the product as the shift from Ethereum mainnet to Layer 2 did. Going forward, dYdX will likely introduce an even more user-friendly and faster product to the world.

3.2 Why Cosmos Specifically?

For its move to a proprietary chain, dYdX chose the Cosmos SDK as its blockchain framework. Just as it previously utilized Starkware's StarkEx, dYdX preferred to modify a well-constructed framework to fit its needs and characteristics rather than building a blockchain from scratch. Thus, they opted for the Cosmos SDK, one of the most actively used blockchain SDKs in the industry.

So, why specifically the Cosmos SDK? Although dYdX has not explicitly stated their reasoning, it is believed that the choice was influenced by the flexibility of the Cosmos SDK (considering many protocols have adapted and transformed the Cosmos SDK to suit their needs) and the ability to leverage the existing ecosystem built by the Cosmos community. In fact, upon launching its chain, dYdX immediately partnered with Noble, another Cosmos-based chain, for easy USDC transfers. The possibility of organic data transfer between chains through Inter-blockchain Communication (IBC) would also have been a significant advantage for dYdX.

3.3 Architecture Deep Dive

The basic architecture of dYdX, based on the Cosmos SDK, is similar to other Cosmos-based chains. However, there are differences, such as the existence of indexers and front-ends, and validators on dYdX have additional roles compared to those on standard Cosmos-based blockchains. Let's explore these differences.

3.2.1 Validators

While dYdX is built on the Cosmos SDK, the role of validators differs from other Cosmos app chains. Validators from normal Cosmos app-chains primarily engage in propagating transactions, validating blocks, and consensus. In contrast, each validator on dYdX must maintain their own order book and store orders (these orders are not reflected in the consensus). Validators manage the order book off-chain, meaning users are not charged transaction fees for placing or canceling orders.

Proposers among validators suggest contents for the next block. Thus, when a user places an order, the proposer matches it for inclusion in the proposed block and participates in the consensus process.

Furthermore, full nodes play a crucial role in dYdX, supporting indexers, which is vital for the operation of dYdX services (though full nodes are important in traditional chains as well).

3.2.2 Indexer (Indexer)

As shown in the diagram, indexers read and store information from the full nodes of the dYdX chain and deliver this information to end-users in a web2-friendly manner. Although the protocol itself can perform this role, dYdX's validators and full nodes are not optimized for such tasks, resulting in slow and inefficient processing. Additionally, overloading validators with direct queries can hinder their primary role (participating and verifying in the consensus process), making the existence of a dedicated indexer system crucial.

Postgres, Redis, and Kafka on the graph's right side are used to store on-chain data, off-chain data, and deliver data to indexer services, respectively.

3.2.3 Front-end

The front-end is essentially built to facilitate the development of end-to-end applications. The web front-end, created using JavaScript and React, receives order book information via API from the indexer and conveys trade information directly to the chain. dYdX has open-sourced its front-end codebase, allowing anyone to access the dYdX front-end. The mobile front-end, similar to the web front-end, interacts with the indexer to fetch information and directly writes trading transactions on-chain. It is also open-source, enabling anyone to deploy it.

3.2.4 How Are Orders Processed?

Let's see how orders are processed on the dYdX chain, involving the above entities:

  1. Users place orders through the API or front-end.
  2. The order is transmitted to a validator, who then disseminates the transaction to other validators and full nodes, updating it in their order books.
  3. Like other Cosmos SDK-based chains, a proposer (leader) is selected in the consensus process. The proposer matches orders and adds them to the next block.
  4. The proposed block undergoes a consensus process. If confirmed and voted on by over 2/3 of validators, it is committed and stored in the on-chain database (and by full nodes).
  5. If the block isn't verified by over 2/3 of validators, it is rejected.
  6. Once the block is committed, the data is relayed to full nodes and indexers, and the indexer reflects this data to the front-end via API and websockets.

3.4 Changes in Token Utility

Naturally, the launch of a proprietary chain brought changes in token utility. As mentioned earlier, the foremost goal of the dYdX chain is 'full decentralization.' While previously dYdX governance had limited scope, on the dYdX chain, all aspects of the product are determined by bonded token holders. Moreover, unlike before, where all earnings generated by dYdX went to dYdX Trading, Inc., on the dYdX chain, they are distributed to bonded token holders. This is likely to increase demand for the dYdX token (more earnings from a successful protocol lead to higher expected returns, thereby increasing the incentive to stake the asset, ultimately increasing market demand and the asset's value).

3.5 Change in Governance

Governance on the dYdX chain can determine the following:

  • Adding or removing new assets and markets.
  • Changing protocol parameters.
  • Modifying the list of third parties providing price information.
  • Altering the fee schedule.
  • Modifying the trading reward mechanism.
  • Adjusting parameters of the x/distribution module (deciding how rewards from Cosmos are divided).
  • Adjusting parameters of the x/staking module (related to staking settings in Cosmos).
  • Changing the formula for calculating funding rates.
  • Managing insurance funds.

As previously mentioned, dYdX Trading, Inc., the company that created dYdX, or dYdX Foundation, will not lead any governance proposals or discussions. The decision-making power regarding the dYdX service now lies with the bonded token holders. This shift represents a key distinction of the dYdX chain compared to its previous iterations. It also addresses the differentiation that Antonio Juliano contemplated – how dYdX could set itself apart from other Centralized Exchanges (CEXs).

4. Implications of dYdX's Evolution

So far, we have explored the journey of dYdX from its inception to its transformation into a product with its own dYdX chain. Since the dYdX chain has just begun, it's premature to conclusively declare the project's success. However, the five-year trajectory of dYdX reveals several insights:

4.1 Blockchain Infrastructure Development Remains Crucial

dYdX evolved its product through stages: starting on the Ethereum mainnet, transitioning to Layer 2, and finally launching its own chain. Although blockchain infrastructure is continuously evolving and will continue to do so, dYdX's history demonstrates that the development of blockchain infrastructure significantly impacts the quality of a product. The assertion that rollups alone are sufficient for scalability is refutable simply by the fact that dYdX moved from rollups to its own chain. Rollups, as well as Layer 1 integrated chains, still need to evolve to become fully scalable 'general purpose blockchains.' Infrastructure development is still crucial. I often liken infrastructure to the ‘the range of imagination.' Concerning scalability before even building a product is already a handicap compared to existing services (though I believe blockchain doesn’t always have to compete with existing services. For products like dYdX that need to compete, infrastructure development is vital).

4.2 Rollups Are Not the Panacea

Considering the number of rollups that have entered the market in the last year or so, it's fair to say we are in a 'rollup era.'Rollups and Roll-up as a Service (RaaS), which includes Roll-up SDKs, are widely available. Industry experts frequently recommend "building it with rollups" as a solution when someone considers a product. However, rollups are not a catch-all solution. dYdX achieved a truly decentralized exchange only after launching its own chain, indicating the limitations of L2 rollups. Ethereum supporters criticized dYdX's decision to launch its chain as the 'worst move,' but today's article shows that dYdX's decision wasn’t impulsive or irrational (certainly not just to inflate token prices).

Leveraging Ethereum's security might be crucial in justifying a product's legitimacy, but the inability to implement fully decentralized services via rollups means leveraging Ethereum's security may not be universally impactful. Some might prefer leveraging Ethereum even if certain aspects are centralized, while others, like dYdX, might prioritize complete decentralization. The key takeaway is that neither approach can be deemed 'more decentralized.' The choice depends on the nature of the product and individual preference. Remember, rollups are not always the ideal solution.

4.3 Flexibility Is Key

dYdX survived and became a frontrunner in the DEX space by making radical choices in response to market and industry situations. While many view dYdX simply as a successful product, its history, as we have reviewed, shows a product that was once on the brink of bankruptcy. However, dYdX agilely adapted to market and industry conditions, ultimately thriving. Had dYdX stubbornly stuck with the Ethereum mainnet, it might have faded into history. The key lesson is the importance of continually following market trends and making optimal choices for one's circumstances.

Therefore, for those grappling with product development decisions, dYdX serves as a valuable example. Sometimes the issue might not be with the product but with the infrastructure.

5. Conclusion: What Does the Future Hold for dYdX?

As the dYdX chain has been launched less than a month ago, and trading on dYdX V4 has just started, it's premature to judge the success of its independent chain launch. However, dYdX has built trust among numerous traders over approximately five years and has continuously developed its product. I believe there is undoubtedly a strength inherent in the dYdX brand.

I maintain the position that an independent Layer 1 chain is still needed for many products. While many researchers are focusing on rollups and modular blockchains, I continue to advocate for the necessity of Layer 1 chains. Although Cosmos app chains are not entirely antithetical to modular blockchains, the fact that dYdX has become an independent Layer 1 chain is significant, making its independence an important case study for me. The success or failure of the dYdX chain is therefore crucial to me as well. Frankly, I hope it succeeds. Its success would provide a basis for various rollup-based services to launch their independent chains.

Author

This article is for informational purposes only. It is not offered or intended to be used as investment or other advice.

Lastest information

see all