> For the complete documentation index, see [llms.txt](https://docs.aark.digital/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aark.digital/about/integration-docs.md).

# Integration Docs 👈

**Aark White-Label is a white-label perpetual derivatives engine that enables anyone to embed high-leverage trading directly into their product.**

For reference, please see [Rocket Perps by defiapp](https://app.defi.app/rocket), covered in detail by [Tiger Research](https://reports.tiger-research.com/p/defi-app-between-robinhood-and-defi-eng).

Partners integrate Aark’s backend (execution, settlement, and risk management) while retaining full control of their frontend, branding, and user relationships. The result is a plug-and-play infrastructure layer that turns any consumer app into a leveraged trading venue.

***

**Integration Options**

There are two ways to integrate Aark White-Label, depending on how much you want to run yourself:

* **Full Licensing** — Complete engine access for advanced partners who want to operate the full white-label stack (execution, settlement, risk, and oracle infrastructure). The engine and its capabilities are described in the sections below; scope and terms are arranged directly with the Aark team.
* **API Integration** — You build and operate your own frontend/UI and connect to Aark’s backend (REST + WebSocket) with signed on-chain orders — the self-serve path. See **Get Started — Aark 1000x Integration Guide** below to start building.

***

**How It Works**

Aark White-Label operates as a modular backend that partners embed into their existing products.

**What Aark provides:**

* Execution engine with support for up to 1000x leverage
* Zero-liquidity architecture: no LP pools required, minimal capital exposure
* Interval-based settlement that structurally prevents bad debt
* Oracle infrastructure mirroring CEX-grade price feeds
* Smart contract security (audited by Pashov)
* Ongoing maintenance, monitoring, and technical support

**What the partner provides:**

* Frontend and user interface
* Branding and product positioning
* User acquisition, community, and distribution

**Revenue model:**

* Fee profit split

***

**Key Features**

**1. Up to 1000x Leverage**

Despite traditional finance’s FX trading leverage reaching up to 5000x, the industry ceiling for leverage of perpetual DEXs sits at 125x because no continuous settlement system can reliably liquidate within the margin window above that ratio. Aark’s Interval Settlement solves this: every 60 seconds, the engine audits all open positions and rolls back any trade that would have generated bad debt. This removes the technical ceiling on leverage entirely, enabling safe 1000x trading with zero bad debt across $100B+ in cumulative volume.

**2. Zero-Liquidity Engine**

Traditional perp DEXs require $10–50M in LP capital, all of which is attack surface. Aark’s engine operates with less than $30K in counterparty capital, a 99.8% reduction in capital exposure. No TVL to drain, no pool to manipulate, no directional risk to absorb.

**3. Multi-Asset Coverage**

One engine supports crypto perpetuals, global equities, commodities, forex, standard indexes, and custom instruments. Partners can offer their users access to any asset class without building separate infrastructure for each.

***

**Live Reference: Rocket Perps by defiapp**

[defiapp](https://defi.app/) is the first live deployment of Aark White-Label. One of the largest consumer-facing DeFi platforms in the space, defi.app has accumulated **$44B in cumulative trading volume** and **1.06M registered users** since launch.

defi.app integrated Aark’s 1000x engine and branded it [**Rocket Perps**](https://app.defi.app/rocket), now their flagship high-leverage product.

**Soft launch results (May 13–28, 2026):**

* 264 traders generated over **$400M in volume** in two weeks
* Trading volumes reaching **all-time highs** post-integration
* Expanding into **RWA perpetuals** including SpaceX

**Coverage:** Tiger Research published a detailed analysis of the integration: [Defi App: Between Robinhood and DeFi](https://reports.tiger-research.com/p/defi-app-between-robinhood-and-defi-eng)

> *“Rocket Perps is a 1000x leverage perpetuals product integrated with a pixel-art arcade game interface. Built on Aark Digital’s oracle infrastructure, it enables instant position execution”* — Tiger Research

This integration demonstrates the core White-Label thesis: defi.app brought 1M+ users and consumer UX. Aark brought the engine. Neither could have built the other’s product alone.

***

## **Why Aark White-Label**

|                      | Aark White-Label               | Building In-House              |
| -------------------- | ------------------------------ | ------------------------------ |
| **Time to launch**   | Weeks                          | 6–12 months                    |
| **Capital required** | Minimal (zero-liquidity model) | $10–50M in LP capital          |
| **Bad debt risk**    | Structurally prevented         | Insurance fund dependent       |
| **Max leverage**     | Up to 1000x                    | Industry ceiling at 125x       |
| **Asset coverage**   | Crypto, equities, RWA, fx      | Crypto only (typically)        |
| **Maintenance**      | Handled by Aark                | Full engineering team required |
| **Audit**            | Pre-audited infrastructure     | Separate audit per deployment  |

***

**Traction**

* **$100B+** cumulative trading volume processed through the Aark engine
* **Zero** instances of bad debt across all market conditions
* **32,000+** unique traders served

***

### **Get Started — Aark 1000x Integration Guide**

Aark **1000x** (a.k.a. *Moon*) is a gasless perpetual-futures product (leverage up to 1000x) on **Arbitrum One** (chainId `42161`), collateralised in **USDC**.

Integration has two layers:

* **On-chain** — the user deposits USDC and registers a delegatee session key (*Enable Trading*). Orders are submitted with the user’s signature and executed on-chain by the Aark keeper (users never pay gas or sign per-order popups).
* **Off-chain API** (`https://api.aark.digital`) — REST for market data / account state / submitting signed order requests, plus a WebSocket stream for order lifecycle events.

Every write request carries the user’s `signature` header (verified on-chain at execution). The API `mode` field selects the deployment — for base Aark 1000x use **`mode: "AARK"`** (this is the default and may be omitted).

#### Contract Architecture (Arbitrum One)

| Contract       | Address                                      | Description                                                 |
| -------------- | -------------------------------------------- | ----------------------------------------------------------- |
| PriceOracle    | `0x96FAaA44e45277fE6e60a9275AFce9BC42056756` | Stores the off-chain index price used on open/close         |
| FeedVerifier   | `0x855f4996D165B8EAb825598631947086De532AEa` | Verifies the price publisher’s signature on the index price |
| OctRouter      | `0xfda50Eb6C4E34E2b097F61279D346B081da4C4AD` | Gasless (OCT/1CT) entry router for 1000x orders             |
| MasterRouter   | `0xCDF75C282C194aE161155238A0bA877d0f2Da8D2` | Direct USDC deposit / withdraw router                       |
| FuturesManager | `0x0b848a8A5eC8950E67d19E7a21A6Be29F44F685e` | 1000x (Moon) order logic                                    |
| Vault          | `0x858F0a7454462De49a135d9b63Da941eeA6f5899` | Holds LP + user deposits                                    |
| USDC           | `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` | Collateral token                                            |

**Market IDs:** ETH `1` · BTC `2` · SOL `3` · XRP `4` · DOGE `5`

#### Authentication Model

All typed-data (EIP-712) signatures use the domain `{ name: "AARK", chainId: 42161 }`. Required headers per endpoint:

| Endpoint               | Headers                                                              |
| ---------------------- | -------------------------------------------------------------------- |
| `POST /oct/delegate`   | `signature` (EIP-712 Delegate)                                       |
| `POST /oct/deposit`    | `signature` and `deposit-signature` (EIP-712 Deposit)                |
| `POST /oct/withdraw`   | `signature` (EIP-712 Withdrawal)                                     |
| `POST /oct/moon/open`  | `signature` (EIP-191 order) and `recaptcha-response` (see reCAPTCHA) |
| `POST /oct/moon/close` | `signature` (EIP-191 close)                                          |
| `POST /oct/moon/tp`    | `signature`                                                          |
| `GET` (read) endpoints | none                                                                 |

#### Frontend Integration

Recommended flow: **Enable Trading (delegate) → Deposit → Open / Close / TP → Withdraw**. Examples use `ethers` (v6) and the delegatee session key (`octPK`) held in the client.

**1. Enable Trading (delegate)**

```ts
export const getDelegateSignature = async (delegator, delegatee, nonce, provider) => {
  const domain = { name: "AARK", chainId: 42161 };
  const types = {
    Delegate: [
      { name: "delegator", type: "address" },
      { name: "delegatee", type: "address" },
      { name: "nonce", type: "uint256" },
    ],
  };
  return provider.getSigner()._signTypedData(domain, types, { delegator, delegatee, nonce });
};
// POST /oct/delegate
// header: { signature }
// body:   { chainId, delegator, delegatee, nonce, mode: "AARK" }
```

**2. Gasless Deposit**

`deposit-signature` is an EIP-712 signature over the Deposit struct `(payor, user, tokenAddress, amount, nonce)`.

```ts
export const getDepositSignature = async (payor, user, tokenAddress, amount, nonce, provider) => {
  const domain = { name: "AARK", chainId: 42161 };
  const types = {
    Deposit: [
      { name: "payor", type: "address" },
      { name: "user", type: "address" },
      { name: "tokenAddress", type: "address" },
      { name: "amount", type: "uint256" },
      { name: "nonce", type: "uint256" },
    ],
  };
  return provider.getSigner()._signTypedData(domain, types, { payor, user, tokenAddress, amount, nonce });
};
// POST /oct/deposit
// headers: { signature, "deposit-signature" }
// body:    { chainId, user, token, amount, deadline, mode: "AARK" }
```

**3. Open Position**

```ts
export const getMoonOrderSignature = async (
  delegator, marketId, amountIn, leverage, credit, takeProfit, isLong, nonce, octPK
) => {
  const hashMsg = ethers.keccak256(
    new ethers.AbiCoder().encode(
      ["address", "uint32", "uint256", "uint256", "uint256", "uint256", "bool", "uint256"],
      [delegator, marketId, amountIn, leverage, credit, takeProfit, isLong, nonce]
    )
  );
  const wallet = new ethers.Wallet(octPK);
  return wallet.signMessage(ethers.toBeArray(hashMsg)); // EIP-191
};
// POST /oct/moon/open
// headers: { signature, "recaptcha-response" }
// body:    { chainId, user, delegatee, nonce, marketId, isLong, amountIn, leverage, credit, takeProfit, mode: "AARK" }
```

* `amountIn` = initial margin as an integer × 10^18, string.
* `leverage` = e.g. `500` (no decimals).
* `credit` = fUSDC used for fee, integer × 10^6, string (`"0"` if none).

**reCAPTCHA (required only for `POST /oct/moon/open`)**

`POST /oct/moon/open` is protected by **Google reCAPTCHA Enterprise**. A browser/frontend integration must attach a fresh token as the `recaptcha-response` header on every open request. *(Backend / server-to-server integrations skip this via partner auth — see the last section.)* No other endpoint requires reCAPTCHA.

**1) Load the reCAPTCHA Enterprise script** with the Aark site key:

```html
<script src="https://www.google.com/recaptcha/enterprise.js?render=6LdHPmYsAAAAABliA8ARgLuSI8rlBWkZeqxXSKNP"></script>
```

> Production site key: `6LdHPmYsAAAAABliA8ARgLuSI8rlBWkZeqxXSKNP` (public; request the staging key from Aark).

**2) Generate a token for the `TRADE` action** immediately before submitting the order:

```ts
const SITE_KEY = "6LdHPmYsAAAAABliA8ARgLuSI8rlBWkZeqxXSKNP";

const getRecaptchaToken = (): Promise<string> =>
  new Promise((resolve, reject) => {
    window.grecaptcha.enterprise.ready(async () => {
      try {
        resolve(await window.grecaptcha.enterprise.execute(SITE_KEY, { action: "TRADE" }));
      } catch (e) {
        reject(e);
      }
    });
  });
```

**3) Send the token as the `recaptcha-response` header** alongside the order `signature`:

```ts
const token = await getRecaptchaToken();
await axios.post(`${API_URL}/oct/moon/open`, body, {
  headers: {
    signature,                    // EIP-191 order signature
    "recaptcha-response": token,  // reCAPTCHA Enterprise token (action: TRADE)
  },
});
```

* Generate a **fresh token per order** (tokens are short-lived / single-use).
* The backend validates the action is `TRADE`; a missing or invalid token is rejected.

**4. Close Position**

```ts
export const getMoonOrderCloseSignature = async (delegator, moonIndex, nonce, octPK) => {
  const hashMsg = ethers.keccak256(
    new ethers.AbiCoder().encode(["address", "uint32", "uint256"], [delegator, moonIndex, nonce])
  );
  const wallet = new ethers.Wallet(octPK);
  return wallet.signMessage(ethers.toBeArray(hashMsg));
};
// POST /oct/moon/close
// header: { signature }
// body:   { chainId, user, delegatee, moonIndex, nonce, mode: "AARK" }
```

**5. Take Profit Update**

```
// POST /oct/moon/tp
// header: { signature }
// body:   { chainId, user, delegatee, moonIndex, takeProfit, mode: "AARK" }
```

**6. Withdraw**

```ts
export const getGaslessWithdrawSignature = async (tokenAddress, account, amount, provider) => {
  const nonce = Date.now();
  const domain = { name: "AARK", chainId: 42161 };
  const types = {
    Withdrawal: [
      { name: "user", type: "address" },
      { name: "recipient", type: "address" },
      { name: "tokenAddress", type: "address" },
      { name: "amount", type: "uint256" },
      { name: "nonce", type: "uint256" },
      { name: "isLP", type: "bool" },
    ],
  };
  const values = { user: account, recipient: account, tokenAddress, amount, nonce, isLP: false };
  return provider.getSigner()._signTypedData(domain, types, values);
};
// POST /oct/withdraw
// header: { signature }
// body:   { chainId, user, recipient, token, amount, nonce, mode: "AARK" }
```

#### REST API

**Base URL:** `https://api.aark.digital`

**Read (no auth):**

* `GET /moon/markets?chainId=42161&mode=AARK` — markets (marketId, symbol, indexPrice, longOI/shortOI, baseFeeRate, min/maxLeverage, takeProfitCap, isBlocked, …)
* `GET /moon/positions?user={addr}&chainId=42161&mode=AARK` — open positions
* `GET /moon/position?moonIndex={n}&mode=AARK` — single position
* `GET /moon/trade-history?user={addr}&chainId=42161&page=1&mode=AARK` — executed trades (pnl, fees, size, leverage, …)
* `GET /futures/account/balance/{userAddress}?mode=AARK` — wallet balance & margin
* `GET /web3/moon-execution-fee?chainId=42161&mode=AARK` — current execution (gas) fee

**Write (see Authentication Model for headers):** `POST /oct/delegate`, `/oct/deposit`, `/oct/withdraw`, `/oct/moon/open`, `/oct/moon/close`, `/oct/moon/tp`.

#### WebSocket API

**Base URL:** `wss://ws-api.aark.digital/ws` — receive each **open**/**close** lifecycle stage.

**Subscribe:**

```json
{ "method": "moon.trade", "params": ["{userAddress}", 42161] }
```

**Events:** `openPositionRequestPending` → `openPositionTxPending` → `openMoonPosition`, and `closePositionRequestPending` → `closePositionTxPending` → `closeMoonPosition`.

#### Server-to-Server (Partner) Authentication

For **backend (server-to-server)** integrations that cannot generate a browser reCAPTCHA token.

**reCAPTCHA scope** — only `POST /oct/moon/open` has the anti-bot gate; `/oct/moon/close`, `/oct/moon/tp`, `/oct/deposit`, `/oct/withdraw`, `/oct/delegate` do not. Registered partners are exempt from the gate (below); every request still carries the per-user EIP order `signature`, verified on-chain — partner auth only removes the anti-bot check.

**Partner headers** (validated only when present; absent → normal reCAPTCHA path):

* `x-partner-timestamp` — unix seconds, within ±300s of server time
* `x-partner-signature` — EIP-191 `personal_sign` of the exact message `Aark-Partner-Auth:{timestamp}`, signed by your registered partner key

The address recovered from `x-partner-signature` must match an **active** partner address registered by the Aark team.

```ts
import { Wallet } from "ethers"; // v5
const partner = new Wallet(PARTNER_PRIVATE_KEY); // address pre-registered with Aark
const ts = Math.floor(Date.now() / 1000).toString();
const xPartnerSignature = await partner.signMessage(`Aark-Partner-Auth:${ts}`);

await fetch("https://api.aark.digital/oct/moon/open", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    signature: userOrderSignature,   // per-user EIP-191 order signature (unchanged)
    "x-partner-timestamp": ts,
    "x-partner-signature": xPartnerSignature,
  },
  body: JSON.stringify({
    chainId: 42161, user, delegatee, marketId, isLong,
    amountIn, leverage, credit: "0", takeProfit, nonce, mode: "AARK",
  }),
});
```

**Onboarding** — send your partner signing address (the public address of the key above) to the Aark team to be registered as active.

**Deposit note** — `POST /oct/deposit` requires **two** headers, `signature` and `deposit-signature`; server integrations must send both.
