Skip to content

Perpetuals

Leveraged perpetual futures, powered by Orderly Network. Charts, funding rates, position tracking and PnL in one view, so a user is not stitching tabs together.

Route: /defi/perpetual · Source: defi-dex/src/pages/defi/perpetual.tsx (~710 lines) · Fee: Orderly's schedule

What it does

Blazpay is an Orderly Network front-end. Orderly provides the order book, matching and settlement; Blazpay provides the interface, the account lifecycle and the key custody plumbing.

CapabilityAvailable
Register an Orderly account from a Blazpay walletYes
Deposit / withdraw collateralYes
Market and limit ordersYes
Take-profit / stop-loss ordersYes
Set leverage per accountYes
Live positions and PnLYes
Funding ratesYes
Order historyYes — /defi/perpetual-transaction

Account lifecycle

Orderly requires a registered account and a separate Orderly key (an ed25519 keypair) for signing API requests. Blazpay manages both.

The ed25519 key is generated with @noble/ed25519, base58-encoded with bs58, and the private half is encrypted through bz-backend/utils/kms.js before being written to models/orderlyAccount.js. getOrderlyKey(walletAddress) decrypts on demand; signAndSendRequest in utils/orderlySigner.js signs every outgoing Orderly API call.

This is the one place Blazpay custodies a signing key

It is an API key scoped to Orderly, not a wallet key — it cannot move funds out of the user's wallet, and Orderly's own withdrawal flow requires a fresh wallet signature. But it is still a key the platform holds, encrypted at rest via KMS. Treat models/orderlyAccount.js as sensitive data.

Order placement

All order endpoints live under /defi/orderly/* and are documented in the perps API reference.

ActionEndpoint
Create a limit orderPOST /defi/orderly/limit-order
Create a TP/SL orderPOST /defi/orderly/tp-sl-order
Edit an orderPUT /defi/orderly/limit-order
Cancel an orderPOST /defi/orderly/limit-order/delete
Close a positionPOST /defi/orderly/close-position
Set leveragePOST /defi/orderly/set-leverage
List a user's ordersGET /defi/orderly/orders, GET /defi/orderly/getOrders
List positionsGET /defi/orderly/getPositions/:walletAddress
Withdrawable balanceGET /defi/orderly/get-available-withdraw/:walletAddress
Request withdrawalPOST /defi/orderly/request-withdraw

Tick-size handling

Before submitting, createLimitOrder fetches https://api-evm.orderly.org/v1/public/info/{symbol} and derives decimal places from base_tick, then rounds quantity to that precision. Orderly rejects orders that violate tick size, so this is not optional.

Leverage is applied to the account (setLeverageAccount) before the order is placed, not per-order — Orderly's model is account-level leverage.

Under the hood

ConcernWhere
Controllerbz-backend/controllers/defi/orderlyController.js
Request signingbz-backend/utils/orderlySigner.js
Key encryptionbz-backend/utils/kms.js
Account modelbz-backend/models/orderlyAccount.js
Order modelbz-backend/models/limitOrder.js (shared with the unshipped spot limit product)
Endpoint configOrderly in bz-backend/utils/constants.js
Frontenddefi-dex/src/pages/defi/perpetual.tsx, PerpetualTransactions.tsx
SEO landing page/perpetuals via defi-dex/src/data/featureSeo.mjs

Known limits

  • Blazpay does not run the order book. Liquidity, matching, liquidation and insurance are Orderly's. An Orderly outage is a Blazpay outage for this product.
  • models/limitOrder.js is shared between perp orders and the unshipped spot limit-order product. Reading rows without filtering by source is misleading.
  • No cross-margin view across products. Perp collateral sits inside Orderly and does not appear in the Zerion-backed portfolio totals.
  • No BlazAI intent for perpetuals. The agent cannot open or manage a perp position; users must use the trading app. This is a deliberate scope decision, not an oversight.

Internal + developer documentation. Usage figures are point-in-time snapshots — re-verify before publishing them.