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

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.

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 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