Appearance
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.
| Capability | Available |
|---|---|
| Register an Orderly account from a Blazpay wallet | Yes |
| Deposit / withdraw collateral | Yes |
| Market and limit orders | Yes |
| Take-profit / stop-loss orders | Yes |
| Set leverage per account | Yes |
| Live positions and PnL | Yes |
| Funding rates | Yes |
| Order history | Yes — /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.
| Action | Endpoint |
|---|---|
| Create a limit order | POST /defi/orderly/limit-order |
| Create a TP/SL order | POST /defi/orderly/tp-sl-order |
| Edit an order | PUT /defi/orderly/limit-order |
| Cancel an order | POST /defi/orderly/limit-order/delete |
| Close a position | POST /defi/orderly/close-position |
| Set leverage | POST /defi/orderly/set-leverage |
| List a user's orders | GET /defi/orderly/orders, GET /defi/orderly/getOrders |
| List positions | GET /defi/orderly/getPositions/:walletAddress |
| Withdrawable balance | GET /defi/orderly/get-available-withdraw/:walletAddress |
| Request withdrawal | POST /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
| Concern | Where |
|---|---|
| Controller | bz-backend/controllers/defi/orderlyController.js |
| Request signing | bz-backend/utils/orderlySigner.js |
| Key encryption | bz-backend/utils/kms.js |
| Account model | bz-backend/models/orderlyAccount.js |
| Order model | bz-backend/models/limitOrder.js (shared with the unshipped spot limit product) |
| Endpoint config | Orderly in bz-backend/utils/constants.js |
| Frontend | defi-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.jsis 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.