Builder 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

Experience DeFi's Pro Trading Platform

Get Started

dYdX

July 3, 2025
Last Update:
July 3, 2025

Disclaimer

© 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 other Restricted Persons. All use of dYdX software is subject to the dYdX Software Terms of Use. 

dYdX International Ltd ("DI"), dYdX Trading Inc. dba dYdX Labs (“dYdX Labs”) and their affiliates do not develop, control or participate in the operation of any component of the dYdX protocol for public use.

To the extent this content describes anticipated features in the open source dYdX software, the implementation of these features in any live deployment of dYdX software will be decided by the relevant deployer community. 

The information provided herein 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 staking, 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. The inclusion of any launchable market on dYdX does not represent endorsement of the projects and all listings are community-driven. You should perform your own research and due diligence before engaging in any activity involving crypto-assets. In no event will DI, dYdX Labs or their affiliates 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 content. By continuing to access this content, you agree to the above and accept the possibility of changes in the information provided.

About dYdX

At dYdX, we’re reimagining what DeFi and perpetual trading can be. Combining the freedom of decentralization with deep liquidity, advanced order types, a high-performance API, and instant market listings, dYdX empowers you to trade boldly and confidently.

Get Started

Get Involved

dYdX is a decentralised, disintermediated and permissionless protocol, and is not available in the U.S. or to other Restricted Persons. All use of dYdX software is subject to the dYdX Software Terms of Use.

dYdX International Ltd ("DI"), dYdX Trading Inc. dba dYdX Labs (“dYdX Labs”) and their affiliates do not develop, control or participate in the operation of any component of the dYdX protocol for public use.

To the extent this content describes anticipated features in the open source dYdX software, the implementation of these features in any live deployment of dYdX software will be decided by the relevant deployer community.

The information provided herein 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 staking, 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. The inclusion of any launchable market on dYdX does not represent endorsement of the projects and all listings are community-driven. You should perform your own research and due diligence before engaging in any activity involving crypto-assets. In no event will DI, dYdX Labs or their affiliates 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 content. By continuing to access this content, you agree to the above and accept the possibility of changes in the information provided.

Leaving site