May 30, 2023
February 14, 2025

v4 Deep Dive: Front End

Product
v4 Deep Dive: Front Endv4 Deep Dive: Front End

v4 Web Front End Deep Dive

As we approach the release of v4 mainnet open-source software, we want to provide a peek into what the dYdX team is building. We covered the v4 system architecture at a high level in a prior post here. This post dives into how the dYdX v4 open-source chain software’s (“dYdX Chain”) front end will work.

Given that v4 is still under development, please note that what is presented below is subject to change.

What Does the Web Front End Do?

The web front end provides an intuitive and performant UI/UX for traders who do not wish to interact with v4 programmatically. The web front end application will interact with the Indexer via APIs/websockets to fetch and display both on-chain and off-chain information (e.g., orderbook, account balances, etc.). Orders will be placed directly to validators.

__wf_reserved_inherit

dYdX is building three open-source front ends: a web app, an iOS app, and an Android app. We are also building Typescript and Python SDKs for power users/institutions. This post will primarily focus on the web app.

Deploying a Web Front End

dYdX will open source all front end codebases and associated deployment scripts. This will allow for anyone to easily deploy the dYdX front end via their own domain/hosting solution.

While only one deployment of the front end is needed for clients to use the web app, having multiple deployments will make v4 more decentralized. This is a key distinction from past versions of the protocol, and one we are particularly excited about; decentralized hosting will enable access to the v4 trading experience via multiple domains.

All of the web and mobile codebases will be hosted in open source GitHub repos. The web app is written in Typescript using React, while the Android and iOS apps are written in Kotlin and Swift, respectively. Business logic for the front end applications are shared across all platforms using packages written with Kotlin Multiplatform.

The front end deployment will leverage the following technologies and services:

  • IPFS - p2p file sharing protocol for distributed file sharing/storage
  • web3.storage - IPFS pinning service
  • Cloudflare - IPFS gateway and DNS resolution

Any third party wishing to deploy and host a front end (“deployer”) will be able to do so by cloning the codebase from the Github repo, and running the deployment script. The deployment script will:

  1. Send and pin files to IPFS using web3.storage
  2. Retrieve the IPFS hash
  3. Update the DNS record of the domain name to the latest IPFS hash directly in Cloudflare (to ensure the latest content from IPFS is being pulled)

Content stored on IPFS will be accessible using the IPFS hash via any browser with native IPFS support (e.g., Brave or Opera), through a public IPFS gateway such as https://dweb.link or https://w3s.link/.

__wf_reserved_inherit

The deployment script is being built in a way to make hosting and updating the front end as easy as possible for deployers. The responsibilities of a deployer will include:

  • Acquiring and owning web domain
  • Meeting deployment prerequisites:
    • Installing Node.js 16 and npm locally
    • Setting up web3.storage account
    • Setting up Cloudflare account
  • Initial deployment of front end
    • Download of front end codebase and deployment script from dYdX Github
    • Running deployment script to pin the files to IPFS and update the IPFS hash
  • Updating front end
    • Following the dYdX Github repos to get codebase updates
    • Running the deployment script when new codebase updates are available to pin the updated files to IPFS and update the IPFS hash
  • Setup of ancillary accounts

Legitimacy and Disclaimer

Crypto-assets can be highly volatile and trading crypto-assets involves risk of loss, particularly when using leverage. Investment into crypto-assets may not be regulated and may not be adequate for retail investors. Do your own research and due diligence before engaging in any activity involving crypto-assets.

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to U.S. persons as well as in other restricted jurisdictions. The dYdX Foundation does not operate or participate in the operation of any component of the dYdX Chain’s infrastructure.

The dYdX Foundation’s purpose is to support the current implementation and any future implementations of the dYdX protocol and to foster community-driven growth in the dYdX ecosystem.

The dYdX Chain software is open-source software to be used or implemented by any party in accordance with the applicable license. At no time should the dYdX Chain and/or its software or related components be deemed to be a product or service provided or made available in any way by the dYdX Foundation. Interactions with the dYdX Chain software or any implementation thereof are permissionless and disintermediated, subject to the terms of the applicable licenses and code. Users who interact with the dYdX Chain software (or any implementations thereof) will not be interacting with the dYdX Foundation in any way whatsoever. The dYdX Foundation does not make any representations, warranties or covenants in connection with the dYdX Chain software (or any implementations and/or components thereof), including (without limitation) with regard to their technical properties or performance, as well as their actual or potential usefulness or suitability for any particular purpose, and users agree to rely on the dYdX Chain software (or any implementations and/or components thereof) “AS IS, WHERE IS”.

Nothing in this post should be used or considered as legal, financial, tax, or any other advice, nor as an instruction or invitation to act by anyone.  Users should conduct their own research and due diligence before making any decisions. The dYdX Foundation may alter or update any information in this post in the future at its sole discretion and assumes no obligation to publicly disclose any such change. This post is solely based on the information available to the dYdX Foundation at the time it was published and should only be read and taken into consideration at the time it was published and on the basis of the circumstances that surrounded it. The dYdX Foundation makes no guarantees of future performance and is under no obligation to undertake any of the activities contemplated herein.

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to U.S. persons as well as in other restricted jurisdictions. The dYdX Foundation does not operate or participate in the operation of any component of the dYdX Chain's infrastructure.

Nothing in this website should be used or considered as legal, financial, tax, or any other advice, nor as an instruction or invitation to act in any way by anyone. You should perform your own research and due diligence before engaging in any activity involving crypto-assets due to high volatility and risks of loss.

Depositing into the MegaVault carries risks. Do your own research and make sure to understand the risks before depositing funds. MegaVault returns are not guaranteed and may fluctuate over time depending on multiple factors. MegaVault returns may be negative and you may lose your entire investment.

The dYdX Foundation does not operate or has control over the MegaVault and has not been involved in the development, deployment and operation of  any component of the dYdX Unlimited software (including the MegaVault).

Crypto-assets can be highly volatile and trading crypto-assets involves risk of loss, particularly when using leverage. Investment into crypto-assets may not be regulated and may not be adequate for retail investors. Do your own research and due diligence before engaging in any activity involving crypto-assets.