July 3, 2025
July 3, 2025

Builder Codes: How to Monetize Orders and Tap into 200+ Perp Markets

dYdX
Builder Codes: How to Monetize Orders and Tap into 200+ Perp MarketsBuilder Codes: How to Monetize Orders and Tap into 200+ Perp Markets

In the evolving landscape of decentralized trading, the ability to integrate directly with exchange infrastructure is rapidly becoming essential for developers building next-gen trading applications. Builder Codes on dYdX unlock this capability, enabling any application, from wallets and bots to frontends and trading terminals, to not only access perpetual markets but also earn revenue through seamless, onchain order routing.

What Are Builder Codes?

Builder Codes introduce a programmable pathway for monetizing onchain order flow. When an order is submitted to dYdX via the exchange’s APIs, a builder can attach metadata that includes a payout address and a fee, defined in parts per million (ppm). If the order is matched and filled, the builder automatically receives their fee.

This mechanism removes the need for traditional affiliate programs or manual tracking. Instead, monetization is embedded directly into the order message and enforced at the protocol level.

How It Works

At the core of Builder Codes is the BuilderCodeParameters object, an optional addition to the order message. This field includes:

  • Builder Address: The address where earned fees will be routed.

  • Fee (ppm): The fee rate to be charged when the order is filled, up to a maximum of 10,000 ppm (1%).

A simplified example from the protocol’s protobuf schema:

message BuilderCodeParameters {
  string builder_address = 1;
  uint32 fee_ppm = 2;
  }


This metadata is nested inside the order message:

message Order {
  OrderId order_id = 1;
  ...
  BuilderCodeParameters builder_code_params = 12;
}


To ensure valid integration, the builder address must be correctly formatted, and the fee must fall within the allowed range. Orders with invalid builder code metadata will be rejected during validation.

Fully Onchain and Transparent

Every Builder Code interaction is visible onchain. The builder address and fee rate are recorded and retrievable via dYdX’s indexer endpoints:

  • /orders: Shows the fee rate and builder address attached to an order.
  • /fills: Displays the builder address along with the actual fee paid for each fill.

This transparency empowers developers to audit performance, track revenue, and refine routing logic based on precise data.

Why It Matters

Builder Codes represent a shift in how decentralized exchanges reward ecosystem participants. By giving developers a native way to earn from order flow, Builder Codes reduce reliance on centralized intermediaries and open a path toward more sustainable, community-aligned infrastructure.

Key benefits include:

  • Access to 200+ perpetual markets
  • Earnings on every filled order
  • Built-in scalability with app usage
  • No permissions or whitelisting required
  • Clear, onchain attribution and accountability

Use Cases

The flexibility of Builder Codes supports a broad range of integrations:

  • Trading Terminals: Embed direct dYdX access and monetize trades

  • Mobile Wallets: Offer in-app perpetuals with native fee earning

  • Telegram Bots: Automate order routing and generate revenue per fill

  • Regional Frontends: Localize dYdX access and sustainably monetize user flow

Minimal changes are needed to existing routing logic. With a few lines of code, any order flow can be directed through dYdX while earning fees transparently.

Scaling with the Ecosystem

As adoption of onchain trading grows, Builder Codes scale effortlessly. More users and more fills translate directly into higher earnings, without additional infrastructure or maintenance. The fee logic is deterministic, enforced by the exchange, and settled directly onchain.

Builder Codes turn order routing into a revenue-generating component, helping builders capture value from the protocols they support.

Case Study: Crypto.com’s Onchain App

One notable example of Builder Codes in action is the integration by Crypto.com. Through its Onchain App, Crypto.com offers users fast, liquid, and self-custodial perpetuals powered by dYdX. Orders are routed directly onchain, and Builder Codes are used to embed monetization into the trading experience.

This approach enables Crypto.com to maintain full control over its mobile user interface while benefiting from dYdX’s high-performance infrastructure and fee attribution model. The integration highlights a shared commitment to self-custody, decentralization, and scalability, demonstrating how mainstream platforms can offer advanced trading capabilities without compromising user control.

Additional Resources

For implementation details, refer to the Builder Codes guide in the dYdX documentation:

📘 docs.dydx.xyz/interaction/integration/integration-builder-codes

Technical questions, support, and discussions with other builders are actively supported in the dYdX Discord:

💬 discord.com/invite/dydx

Disclaimers

© 2025 dYdX International Ltd. All rights reserved.

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to U.S. persons as well as for Restricted Persons as set out in the dYdX Software Terms of Use, accessible: https://dydx.exchange/v4-terms. dYdX International Ltd (“DI”) does not develop, control or participate in the operation of any component of the dYdX Protocol (including the MegaVault).

The information provided in this website is for general informational purposes only and DI reserves the right to update, modify, or amend any contents herein, at its sole discretion and without prior notice.  Nothing herein 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.

Engaging in any activity involving crypto-assets (including trading crypto assets and depositing into the MegaVault) is risky due to high volatility. Returns are not guaranteed and may fluctuate over time depending on multiple factors, and you may lose your entire investment, particularly when using leverage. Investment into crypto-assets may not be regulated and may not be suitable for retail investors. You should perform your own research and due diligence before engaging in any activity involving crypto-assets.

In no event will DI be liable for any loss or damage, including without limitation, indirect or consequential loss or damage, arising from or in connection with the use of this website. By continuing to access this website, you agree to the above and accept the possibility of changes in the information provided.

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to U.S. persons as well as for Restricted Persons as set out in the dYdX Software Terms of Use, accessible: https://dydx.exchange/v4-terms. dYdX International Ltd (including its affiliates, "DI") does not develop, control or participate in the operation of any component of the dYdX Protocol (including the MegaVault).

The information provided in this website is for general informational purposes only and DI reserves the right to update, modify, or amend any contents herein, at its sole discretion and without prior notice.  Nothing herein 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.

Engaging in any activity involving crypto-assets (including trading crypto assets and depositing into the MegaVault) is risky due to high volatility. Returns are not guaranteed and may fluctuate over time depending on multiple factors, and you may lose your entire investment, particularly when using leverage. Investment into crypto-assets may not be regulated and may not be suitable for retail investors. You should perform your own research and due diligence before engaging in any activity involving crypto-assets.

In no event will DI be liable for any loss or damage, including without limitation, indirect or consequential loss or damage, arising from or in connection with the use of this website. By continuing to access this website, you agree to the above and accept the possibility of changes in the information provided.

Leaving site

By clicking ‘Continue’, you will be leaving https://www.dydx.xyz/ and accessing a website made available by a third party using dYdX v4 open-source software that is independent from and unaffiliated with dYdX International Ltd (“DI”). DI does not deploy or run dYdX v4 open-source software for public use, nor does it operate or control any or all parts of the infrastructure. DI is not responsible for any actions taken by independent third parties or for any codes, materials and contents on any third-party websites, including the one you would access by clicking ‘Continue’.

DI’s contents and services are not available to persons who are residents of, are located or incorporated in, or have a registered office in the U.S., Canada or any Restricted Persons as set out in the dYdX v4 open-source software Terms of Use, accessible here.  More details can be found in our Terms of Use. Learn more about dYdX v4 third-party front end options here.