VORDIUM DOCS
TestnetIntegrate Vordex

Builder codes

How a trader approves an app's fee, how the app places orders with it, and how the app reads and claims what it earned. On the testnet.

TestnetTestnet values read 29 Nov 2026, 16:26 UTC

On testnet

Builder fees are on the testnet. The limits below are read from the testnet when the docs are built.

A builder is the account of an app that sends orders for its users. A builder fee is paid by the trader, on top of the trading fee, to the builder named in the order.

The limits

LimitValue
Highest builder fee on a perpetuals order0.1% of the order's value
Highest builder fee on a spot order0.5% of the order's value
Builders one account can approve at once10
Account value a builder must holdat least 100 USDC

The builder keeps its whole fee. Fees are in cbps, hundredths of a basis point: 1,000 cbps is 0.1% of the order's value.

1. The trader approves your app

The trader signs one ApproveBuilderFee message with their main wallet. A session key or an agent key cannot sign it. The message names your app's address and the highest fee you may charge, in cbps. Nothing is paid when it is signed.

  • One approval per builder. An account can hold at most 10 approvals at once; to approve another builder, revoke one first.
  • The trader can revoke an approval at any time. After that, an order from your app that names a fee for that trader is refused.
  • An account cannot approve itself as its own builder.

2. Your app places orders with a fee

Your app sends orders as PlaceOrderV3. It is the usual order with two more fields:

FieldMeaning
builderYour app's address.
builderFeeCbpsThe fee for this order, in cbps. Above zero, at or below the trader's approval, and at or below the market's cap.
  • A builder fee is accepted on single orders only, not inside a batch.
  • A stop order cannot carry a builder fee.
  • No builder fee is charged on a liquidation, an auto-deleverage, a backstop close, or a take-profit or stop-loss fill.
  • Your app's account must hold at least 100 USDC, or its orders with a fee are refused.

3. Show the fee as its own line

Show the trader the builder fee as a separate line called App fee, next to the trading fee. Never fold it into the trading fee. The network keeps them apart too: a fill's trading fee never includes the builder fee.

4. Read what your app earned

MethodRouteAnswers
GET/builder/stats/{address}Your app's volume, fees, unclaimed and claimed fees, users in the last 30 days, whether its account value is enough, and the caps.
GET/builder/approvals/{address}Which builders an account approved, the highest fee for each, how many it holds and the most it may hold.
Bash
curl -s https://testnet.vordex.xyz/chain/builder/stats/0xYourAppAddress
curl -s https://testnet.vordex.xyz/chain/builder/approvals/0xTraderAddress

The fields of /builder/stats/{address}:

FieldMeaning
volume_6decThe value of the orders that paid your app a fee, in USDC with 6 decimals.
fees_6decEvery builder fee your app earned. Always unclaimed_6dec plus claimed_6dec.
unclaimed_6dec / claimed_6decWhat is waiting to be claimed, and what was claimed.
users_30dTraders who paid your app a fee in the last 30 days.
account_value_ok / min_account_value_6decWhether your app's account holds enough, and how much it must hold.
claim_nonceThe nonce your next claim must carry.
caps_cbpsThe highest fee per market type: perps and spot.
activetrue while builder fees are in force.

Amounts are strings: read them as whole numbers, then divide by 1,000,000 for USDC.

Per fill

A perpetuals fill record carries a builder key only when a builder fee was charged on that fill:

JSON
{
  "builder": {
    "taker_builder": "0xYourAppAddress",
    "taker_fee_6dec": "4000",
    "maker_builder": null,
    "maker_fee_6dec": "0"
  }
}

A side that paid no builder fee shows null and "0". No builder key means no builder fee on that fill. Spot fills are not in the trading records: read your spot fees from the totals of /builder/stats/{address}.

5. Claim

Your app signs one ClaimBuilderFees message with its own key. It moves every unclaimed fee to your app's account. With nothing to claim, the network refuses it.

The signed messages

Both are EIP-712 messages under the testnet's VordCore domain, which names its chain and its genesis (see Genesis-bound signing). validUntil is a time in seconds; the message is refused after it.

Text
ApproveBuilderFee(address user,address builder,uint32 maxFeeCbps,uint64 nonce,uint64 validUntil)
ClaimBuilderFees(address builder,uint64 nonce,uint64 validUntil)

Take nonce for an approval from the trader's /builder/approvals/{address}, and for a claim from your app's claim_nonce.

In the SDKs

The Python SDK (pip install vordium==2.0.0) and the JavaScript / TypeScript SDK (@vordium/[email protected]) sign and send every step on this page. They read the network's caps, the trader's approval and your app's account value first, and refuse before signing when a check fails, with the network's own code.

What it doesPythonJavaScript / TypeScript
Approve a builder and its highest feeBuilderOps.approve_builder_feeapproveBuilderFee
Revoke a builderBuilderOps.revoke_builder_feerevokeBuilderFee
Place an order with a builder feeVordex.place_order(builder=…, worst_price=…)placeOrder({ builder, worstPrice })
Read an account's approvalsVordex.builder_approvalsbuilderApprovals
Read a builder's totalsVordex.builder_statsbuilderStats
Claim builder feesBuilderOps.claim_builder_feesclaimBuilderFees

Read (Python)

Python
from vordium import Vordex, use_network

use_network("testnet")                                   # builder fees are on the testnet
dx = Vordex()
app = "0xYourAccount"                                    # your app's address: the builder
stats = dx.builder_stats(app)
print(stats["caps_cbps"], stats["unclaimed_6dec"], stats["account_value_ok"])
print(dx.builder_approvals("0xYourTradingAccount")["approvals"])   # the builders one trader approved

The trader approves and revokes (Python)

Before you run this: this signs on the testnet with the trader's main wallet key, kept in a file only they can read (~/.vordium/owner.key, mode 0600, written by vordium init). A session key or an agent key is refused.

Python
from vordium import BuilderOps, use_network
from vordium.wallet import read_key_file                 # a key file only you can read (vordium init)

use_network("testnet")
trader = BuilderOps(read_key_file("~/.vordium/owner.key")[1])
print(trader.approve_builder_fee("0xYourAppAddress", 500))   # up to 500 cbps (0.05%) per order
print(trader.approvals()["approvals"])

print(trader.revoke_builder_fee("0xYourAppAddress"))         # at any time

An order with a builder fee (Python)

Before you run this: the trader's testnet account holds test USDC and approved your app at or above the fee, and ~/.vordium/session.key (mode 0600) holds a session key the trader authorised — see Session keys.

Python
from vordium import Vordex, use_network
from vordium.caps import Side, PlaceOrderType
from vordium.wallet import read_key_file

use_network("testnet")
dx = Vordex()
session_key = read_key_file("~/.vordium/session.key")[1]
app_fee = {"address": "0xYourAppAddress", "fee_cbps": 500}

print(dx.place_order(session_key=session_key, owner="0xYourTradingAccount", pair_id=1, side=Side.BUY,
                     size=0.01, price=2500.0, leverage=1.0, order_type=PlaceOrderType.LIMIT, builder=app_fee))

# a market order that names a builder can carry the worst price it may fill at
print(dx.place_order(session_key=session_key, owner="0xYourTradingAccount", pair_id=1, side=Side.BUY,
                     size=0.01, price=0, leverage=1.0, order_type=PlaceOrderType.MARKET, builder=app_fee,
                     worst_price=2600.0))

Your app claims (Python)

Before you run this: this signs on the testnet with your app's own key, kept in a file only you can read (~/.vordium/app.key, mode 0600).

Python
from vordium import BuilderOps, use_network
from vordium.wallet import read_key_file

use_network("testnet")
app = BuilderOps(read_key_file("~/.vordium/app.key")[1])
print(app.stats()["unclaimed_6dec"])
print(app.claim_builder_fees())

The same in JavaScript / TypeScript

Before you run this: these sign on the testnet. Keep each key in a file only its owner can read (vordium init --out ~/.vordium/owner.key, mode 0600): the trader's main wallet key for the approval and the order, your app's key for the claim.

JavaScript
import { Vordium } from "@vordium/sdk";
import { Wallet } from "ethers";
import { readFileSync, statSync } from "node:fs";
import { homedir } from "node:os";

// the key from a file only you can read: never in code, an environment variable or a command line
function readKey(path) {
  if (statSync(path).mode & 0o077) throw new Error(`${path} can be read by other users: chmod 600 ${path}`);
  const text = readFileSync(path, "utf8").trim();
  return text.startsWith("{") ? JSON.parse(text).private_key : text;
}

const v = await Vordium.connect({ network: "testnet" });
const appAddress = "0xYourAppAddress";

// the trader: approve once, then trade with the app fee
const trader = await v.account(new Wallet(readKey(`${homedir()}/.vordium/owner.key`)));
console.log(await trader.approveBuilderFee(appAddress, 500));          // up to 500 cbps (0.05%) per order
const order = await trader.placeOrder({ pairId: 1, side: "buy", size: "0.01", orderType: "Limit", price: "2500",
  builder: { address: appAddress, feeCbps: 500 } });
console.log(order.submitted ? order.clientNonce : order.refusal);
console.log(await trader.builderApprovals());
// await trader.revokeBuilderFee(appAddress);                         // at any time

// your app: read its totals and claim
const app = await v.account(new Wallet(readKey(`${homedir()}/.vordium/app.key`)));
console.log(await v.builderStats(appAddress));
console.log(await app.claimBuilderFees());

A market order that names a builder takes worstPrice the same way: placeOrder({ …, orderType: "Market", builder, worstPrice: "2600" }).

Every refusal is listed on Refusal codes.

Facts from network-spec v30

On this page