🎊 12th Anniversary Celebration Continues — Limited-Time Revelry Round 3 is On!
Play twice a week to find the hidden anniversary cake and win prizes like iPhone 16 Pro, MacBook Air, exclusive merch, and more
✅ Just Log In to Start Playing: https://www.gate.io/activities/12th-anniversary?pid=APP&ch=s9ZCIeg6
Event Details: https://www.gate.io/announcements/article/44624
Briefly describe dYdX V4 technical architecture
**Written by:**dYdX
Compile: IBCL
dYdX Chain V4 is the latest iteration of the dYdX protocol, which will consist of open source software. The version currently in production is called v3, v3 and past versions of dYdX have at their core smart contracts deployed to existing chains combined with centralized services hosted in the cloud.
v4 will be an independent L1 blockchain with a fully decentralized off-chain order book and matching engine. The dYdX chain will be based on the Cosmos SDK and the CometBFT PoS consensus protocol.
As we get closer to the launch of the v4 mainnet, we wanted to give you a glimpse of what the dYdX team is building. This article provides a high-level overview of the v4 architecture. Given that v4 is still under development there may be changes.
v4 system architecture
dYdX v4 is designed to be fully decentralized end-to-end. The main components broadly include protocols, indexers, and frontends. Each of these components will be provided as open source software. dYdX Trading Inc. will not run any components.
Agreement
The protocol is an L1 blockchain built on CometBFT and using the CosmosSDK. Node software is written in Go and compiled into a single binary. Like all CosmosSDK blockchains, v4 uses a proof-of-stake consensus mechanism.
The protocol will be supported by a network of nodes. There are two types of nodes:
indexer
Indexer is a collection of read-only services whose purpose is to index and serve blockchain data for users in a more efficient and web2-friendly manner. This is done by using real-time data from v4 full nodes, storing it in a database, and making that data available to end users via websocket and REST requests.
While the v4 protocol itself is capable of exposing endpoints to service queries about some basic on-chain data, these queries tend to be slow because validators and full nodes are not optimized to handle them efficiently. Additionally, excessive queries to validators can impair their ability to participate in consensus. For this reason, many Cosmos validators prefer to disable these APIs in production. This is why it is important to build and maintain indexers and full nodes separate from validators.
Indexers will use Postgres database for on-chain data storage, Redis for off-chain data storage, and Kafka for on-chain/off-chain data consumption and streaming to various indexer services.
front end
To build an end-to-end decentralized experience, dYdX is building three open-source frontends: a web application, an iOS application, and an Android application.
Order Lifecycle
Now that we have a better understanding of each component of the dYdX v4, let's take a look at how it all fits together when placing an order. When placing an order in v4, it will follow the following process:
The flow above is a high-level overview of how orders/data move through v4. As the v4 mainnet launch approaches, we will delve further into the protocol, indexers, and various front-end infrastructure in subsequent blog posts.