dYdX V4 - The dYdX Chain - By dYdX Team

This covers dYdX's path toward V4 a full dYdX blockchain in Cosmos.

dYdX V4 - The dYdX Chain - By dYdX Team

Disclaimer - This is part of our outside perspective series. Curious Cosmonaut Research is not the author we are simply highlighting some good threads and perspectives on the Cosmos ecosystem with their permission. We also, therefore, do not guarantee their accuracy.

Author:  dYdX Team

Source: Blog

dYdX V4 - The dYdX Chain

tldr;

🔗 dYdX V4 will be developed as a standalone blockchain based on the Cosmos SDK and Tendermint Proof-of-stake consensus protocol

🚀 dYdX V4 will feature a fully decentralized, off-chain, orderbook and matching engine capable of scaling to orders of magnitude more throughput than any blockchain can support

✅ $DYDX appears to be the most natural fit for use as the L1 token of dYdX V4

We’re excited to announce that dYdX V4 will be developed as a standalone blockchain based on Tendermint consensus and built using Cosmos SDK!

dYdX V4 marks the full decentralization of the dYdX protocol, and we’re excited about the unique combination of decentralization, scalability, and customizability that Cosmos offers.

What is Cosmos?

Cosmos is a technology that makes it relatively easy to create a standalone blockchain with strong cross-chain capabilities. Cosmos chains are based on the Tendermint proof-of-stake consensus system. Cosmos offers high throughput, decentralization, and customizability. Each Cosmos chain traditionally has its own validators and Layer 1 staking token.

Why a standalone Cosmos blockchain?

At dYdX we embrace radical changes in technology that have the potential to dramatically improve the protocol. After exploring the landscape of current and upcoming blockchain technologies, we decided that Cosmos would allow us to build the best fully decentralized protocol.

The main requirement for the V4 protocol is full decentralization. The decentralization of a system is equal to the decentralization of its least decentralized component. This means that every part of V4 needs to be decentralized while also remaining performant.

Off-chain, decentralized, orderbook + matching

The fundamental problem with every L1 or L2 we could develop on is that none can handle even close to the throughput needed to run a first class orderbook and matching engine. For reference, the existing dYdX product processes about 10 trades per second and 1,000 order places/cancellations per second, with the goal to scale up orders of magnitude higher.

We considered pivoting to developing another trading model, such as an AMM or RFQ system, but ultimately decided that an orderbook based protocol was critical to the trading experience pro traders and institutions demand. We also were not satisfied with existing off-chain orderbook systems that either did not include matching (huge problems with frontrunning and trade collisions) or were based on centralized matching (there can be no central systems in dYdX V4). This left us with the realization that we needed to build a decentralized off-chain network to run the orderbook.

This is where Cosmos comes in. A massive benefit of developing a blockchain dedicated to dYdX V4 is that it offers full customizability over how the blockchain itself works, as well as the jobs that validators perform.

In dYdX V4, each validator will run an in-memory orderbook that is never committed to consensus (i.e., off-chain). Orders placed and cancellations will be propagated through the network similar to normal blockchain transactions, ensuring that orders placed and cancellations will always make their way through the network. The orderbook that each validator stores is eventually consistent with one another. On a real time basis, orders will be matched together by the network. The resulting trades are then committed on-chain each block.

This allows dYdX V4 to have extremely high throughput for the orderbook (which remember requires 100x the throughput of trades!) while remaining decentralized.

No trading gas fees

As mentioned, a major benefit of Cosmos is that the chain can be developed to suit the exact needs of the dYdX network. One application of this is that traders would not pay gas fees to trade, but rather pay fees based on trades executed similar to dYdX V3 and centralized exchanges. These fees would accrue to validators and their stakers.

Ideal platform to build on

dYdX V4 is a fully sovereign blockchain, meaning the chain is not reliant on any external blockchain or system. This is a great platform for the dYdX community to continue to build in a vertically integrated way with the protocol token holders fully controlling the system. Whether it’s building additional features like spot trading, options, or multi-collateral or improving core underlying technology the dYdX community will now control every aspect of the stack and can build the best possible product experience.

DYDX

$DYDX, the protocol token of the dYdX protocol, is governed by its holders. We at dYdX Trading Inc. do not have control over how it is used.

With that said, the V4 protocol is designed with a need for a layer 1 protocol token. This protocol token will be used for staking to validators, as well as ongoing governance of the chain. The $DYDX token would seem to be a natural fit to be used as the layer 1 token of the V4 network, but we look forward to understanding the perspective of the dYdX community.

What are we building?

All dYdX V4 code will be open source. Everything will run on permissionless networks, and no services will be run by dYdX Trading Inc.

Our goal is to build open source code that can power a first class product and trading experience. There are a few major technical components of this:

Core node

The core node is the core software that validators and node providers will run. This is built on top of the Cosmos SDK - the standard framework for building Tendermint blockchains. The core node will run: consensus, off-chain orderbook & matching, all transaction types (deposit, transfer, withdraw, etc), price oracles, and other core systems.

Indexer

The indexer is open source software that powers the APIs and websockets, which would serve web, mobile, and programmatic traders. The indexer would take the data that exists on the core blockchain and store it in a much more efficient format, allowing dYdX V4 to serve performant REST & WebSocket APIs. The indexer software would also be run by a distributed network, ensuring that the data will always be available to traders.

Clients

TypeScript and potentially other language clients to simplify interacting with the network. Clients connect to both indexers and core nodes, and would be used by programmatic traders as well as the website.

Web App

A full-featured, open source version of the dYdX web frontend.

Mobile apps

iOS and Android mobile apps for dYdX V4. We’re still researching the best way to develop these for them to be available in an open source, decentralized way. If you have ideas, we’d love to hear from you!

Thinking 10x bigger

One of dYdX’s core values is to think 10x bigger. dYdX should focus on what it could achieve, rather than protecting what has been built so far.

Our goal is to see dYdX eventually become one of the largest exchanges in all of crypto. We realize this is an extremely difficult and ambitious goal, but believe dYdX should make choices to maximize the chance of achieving that goal, rather than settling for a lower definition of success.

We were not satisfied with any of the existing approaches to developing a fully decentralized exchange. While we have confidence we could develop a leading protocol using any of these tested approaches, we did not believe they could support an experience that would get us close to seeing the goal be achieved.

Developing a decentralized, off-chain orderbook and matching engine and moving from Ethereum to a dYdX-specific chain as a major DeFi protocol is very much untested, but we believe this gives dYdX the best shot at developing a network that could offer a long term competitive product experience with centralized exchanges. There is a huge amount to develop and many question marks, but we are excited for dYdX to continue to be leaders in adopting new technologies that give the opportunity to develop the best possible product experience.

We’re excited about the opportunity of what can be built, and the chance to ultimately hit our goal.

Our next year

We’re still planning to open source dYdX V4 by the end of 2022. dYdX V4 represents a large and critical improvement to the dYdX protocol, so will require months of heads down development. We are excited to continue to release more information about dYdX V4 over the next year.

In the meantime:

If you’re excited about helping us build the future of DeFi with dYdX V4, check out our open roles!

FAQs

Isn’t bridging assets across chains a challenge? Will this limit the number of markets available to trade on dYdX?

Yes, bridging assets across blockchains has proved to be challenging. Most existing bridges suffer issues with user experience and/or security. One benefit of dYdX focusing on synthetic trading is that only one collateral asset (e.g. a stablecoin) must exist to enable synthetic trading of any asset.

The top priorities (ordered) are to support the best experience for:

  1. Transfers from/to CEXs
  2. Transfers from/to Ethereum
  3. Transfers from/to other chains / rollups

Cosmos also supports IBC, a protocol for decentralized and secure bridging of assets between two IBC (cosmos) enabled chains. This means that dYdX only needs one stablecoin to exist on any secure Cosmos chain, which can then be easily bridged to the dYdX chain using IBC.

We’re in conversations with several bridges and stablecoins to build the best collateral and deposit/withdrawal experience for the dYdX chain.

Will multi-collateral be supported?

Yes, though probably not at the initial launch. We’re focused on developing the best experience for the main collateral asset.

I thought Ethereum & Ethereum based L2s are more decentralized than Cosmos. Do you not care about decentralization?

We do care about decentralization! It’s the entire purpose of dYdX V4. We believe the dYdX Chain to be the best and most decentralized possible option for the dYdX protocol.

The goal for V4 is to enable the *entire product* maximally decentralized and performant. The decentralization of a system is defined by its least decentralized component.

Ethereum L1 likely is more decentralized than Cosmos (at least for the time being), but not even close to performant enough to power dYdX. Ethereum based L2s have two issues: both they are not close to performant enough to power dYdX (see “Off-chain, decentralized, orderbook + matching”), and also currently they operate through central sequencers* which have the ability to censor transactions**.

* There are solid plans for many L2s to decentralize their sequencer network, but likely they would only be decentralized to a point more comparable to what could be achieved with the dYdX chain than to Ethereum L1. ** Censorship normally can be avoided by bypassing the sequencer and going directly to L1, but this does not satisfy the entire product experience being decentralized because L1 is way too expensive/slow to power the core product experience.

So is Cosmos better than Starknet, Solana, Optimism, and everything else?

No, not in all cases!

Developing our own Cosmos based chain just happened to be the best fit based on the unique product tradeoffs for dYdX and the mission to build the best professional trading product experience.

While we are thrilled for dYdX to be a leader in the Cosmos ecosystem, we continue to be excited about what could be possible in the future with other chains or L2s! We will continue to keep an open mind about always building on the best technology for us at each given time.