# Activate a closed-launch access code Source: https://docs.ekiden.fi/api-reference/access/activate-a-closed-launch-access-code /api-reference/openapi.json post /api/v1/access/activate # Get Account Balance Source: https://docs.ekiden.fi/api-reference/account/get-account-balance /api-reference/openapi.json get /api/v1/account/balance Query account balances. Returns all subaccounts' vault balances. # Get Account Statistics Source: https://docs.ekiden.fi/api-reference/account/get-account-statistics /api-reference/openapi.json get /api/v1/account/statistics Query account equity, PnL, volume, and ROI. Optional step: hour/day/week/month. Newest `limit` rows (default 100, max 1000). # Post apiv1accountfund Source: https://docs.ekiden.fi/api-reference/account/post-apiv1accountfund /api-reference/openapi.json post /api/v1/account/fund # Get apiv1competitions Source: https://docs.ekiden.fi/api-reference/competitions/get-apiv1competitions /api-reference/openapi.json get /api/v1/competitions # Get apiv1competitions 1 Source: https://docs.ekiden.fi/api-reference/competitions/get-apiv1competitions-1 /api-reference/openapi.json get /api/v1/competitions/{competition_slug} # Get apiv1competitions leaderboard Source: https://docs.ekiden.fi/api-reference/competitions/get-apiv1competitions-leaderboard /api-reference/openapi.json get /api/v1/competitions/{competition_slug}/leaderboard # Conventions Source: https://docs.ekiden.fi/api-reference/conventions This document outlines Ekiden's API design conventions and standards. These ensure consistency, developer-friendliness, and compatibility across all REST and WebSocket interfaces. *** ## 1. Base URLs and Environments Ekiden provides separate base URLs for each environment: * **Mainnet**: [https://api.ekiden.fi/api/v1](https://api.ekiden.fi/api/v1) * **Testnet Beta**: [https://api.cnt.ekiden.fi/api/v1](https://api.cnt.ekiden.fi/api/v1) * **Staging**: [https://api.testnet.ekiden.fi/api/v1](https://api.testnet.ekiden.fi/api/v1) > All API calls must use **HTTPS**. *** ## 2. Versioning We use URI-based versioning: * **Format**: `/v1/` * **Example**: `GET /v1/market/tickers` Backward-incompatible changes will trigger a new version (e.g., `/v2/`). *** ## 3. RESTful Design | Method | Description | | - | - | | `GET` | Fetch resources (e.g., market data) | | `POST` | Create resources or perform actions (e.g., place or amend an order) | | `DELETE` | Cancel or remove resources | | `PUT` | Replace or update resources where applicable (e.g., whitelist management) | * Endpoints are organized by resource. *** ## 4. WebSocket Protocol Endpoints: * Mainnet: * Public data: `wss://api.ekiden.fi/ws/public` * Private data: `wss://api.ekiden.fi/ws/private` * Testnet Beta: * Public data: `wss://api.cnt.ekiden.fi/ws/public` * Private data: `wss://api.cnt.ekiden.fi/ws/private` * Staging: * Public data: `wss://api.testnet.ekiden.fi/ws/public` * Private data: `wss://api.testnet.ekiden.fi/ws/private` Messages use an `op` field with snake\_case values. Optional `req_id` lets you correlate requests/responses. ### Topics #### Public topics (market data) * `orderbook..` (e.g. `orderbook.10.BTC-USDCx`) — order book snapshots and deltas * `trade.` — public trade feed * `ticker.` — 24h ticker updates * `kline..` — candlestick updates * `all_liquidations.` — liquidation events * `insurance_pool.` — insurance pool snapshots * `adl_alert.` — ADL alert updates #### Private topics (authenticated) Available only after successful authentication on `/ws/private`. * `order` — order updates * `position` — position updates * `execution` — execution (fill) updates * `account_balance` — account balance updates ### Subscribe Client → Server ```json theme={null} { "op": "subscribe", "args": ["orderbook.1.BTC-USDCx", "ticker.BTC-USDCx"], "req_id": "optional-id" } ``` Server → Client ```json theme={null} { "op": "subscribed", "args": ["orderbook.1.BTC-USDCx", "ticker.BTC-USDCx"], "req_id": "optional-id" } ``` ### Unsubscribe Client → Server ```json theme={null} { "op": "unsubscribe", "args": ["orderbook.1.BTC-USDCx"] } ``` Server → Client ```json theme={null} { "op": "unsubscribed", "args": ["orderbook.1.BTC-USDCx"] } ``` ### Event delivery ```json theme={null} { "op": "event", "topic": "ticker.BTC-USDCx", "server_ts_ms": 1731541800000, "data": { /* event payload */ } } ``` ## Authenticate (private WebSocket only) Private WebSocket connections support two authentication methods: ### JWT Authenticate immediately after connecting to `/ws/private` using a JWT access token obtained from the REST authorization endpoint. Client → Server ```json theme={null} { "op": "auth", "bearer": "", "req_id": "optional-id" } ``` Server → Client ```json theme={null} { "op": "auth", "success": true, "user_id": "", "req_id": "optional-id" } ``` ### API Key Authenticate immediately after connecting to `/ws/private` using an API key. Client → Server ```json theme={null} { "op": "auth_api_key", "api_key": "", "signature": "", "timestamp_ms": 1731541800000, "nonce": "unique-nonce", "req_id": "optional-id" } ``` The `signature` must be an Ed25519 signature of: `EKIDEN_WS|AUTH|{timestamp_ms}|{nonce}` *** ## 5. Authentication (REST) Private REST and private WebSocket use a short-lived JWT issued by the gateway, or API Key authentication. ### JWT Authentication 1. Request a token via `POST /api/v1/authorize` ```json theme={null} { "public_key": "", "signature": "", "timestamp_ms": 1731541800000, "nonce": "random-unique-string" } ``` Response: ```json theme={null} { "token": "", "user_id": "" } ``` 2. Use the token with Bearer auth for private endpoints: ```http theme={null} Authorization: Bearer ``` ### API Key Authentication Gateway supports API-key auth via headers: * `X-API-KEY`: Your API public key * `X-SIGNATURE`: Ed25519 signature over `EKIDEN_API|{method}|{uri}|{timestamp_ms}|{nonce}` * `X-TIMESTAMP-MS`: Current Unix timestamp in milliseconds * `X-NONCE`: Random unique string *** ## 6. Numerical Precision * Prices and quantities are represented as strings to preserve precision. * Clients should use arbitrary-precision decimal libraries instead of floating-point numbers. * Price and quantity precision vary by instrument. Use the `price_filter.tick_size` and `lot_size_filter.qty_step` values returned in the response from `GET /api/v1/market/instruments-info` to determine the supported precision for each market. *** ## 7. Timestamps Ekiden uses Unix timestamps in milliseconds unless otherwise specified. Common timestamp fields include: * `timestamp` * `timestamp_ms` * `server_ts_ms` * `created_time` * `updated_time` * `ts` * `mts` * `client_ts` * `server_ts` All of the above represent Unix timestamps in milliseconds. Some endpoints also accept Unix timestamps in milliseconds as query parameters (for example, `start_time` and `end_time`). Refer to the endpoint documentation for the supported parameters. *** ## 8. Error Handling ### Error response format ```json theme={null} { "code": "UNAUTHORIZED", "message": "Unauthorized" } ``` ### Common Error Codes | Code | Meaning | | - | - | | `BAD_REQUEST` | Invalid request parameters | | `UNAUTHORIZED` | Authentication failed or token expired | | `FORBIDDEN` | Insufficient permissions | | `RateLimitExceeded` | Too many requests | | `NOT_FOUND` | Resource not found | | `SERVICE_UNAVAILABLE` | Backend service down or lagging | | `INTERNAL` | Unexpected server error | > HTTP status codes (`400`, `401`, `403`, `404`, `429`, `500`, `503`) are used appropriately. *** ## 9. Rate Limits REST API requests are subject to rate limits. When a rate limit is exceeded, the server returns HTTP `429 Too Many Requests`. Example: ```json theme={null} { "code": "RateLimitExceeded", "message": "Rate limit exceeded" } ``` *** ## 10. Pagination Cursor-based pagination is used for endpoints that return lists of resources. Common query parameters: * `limit` — Maximum number of items to return. * `cursor` — Pagination cursor returned by the previous request. Example: ```http theme={null} GET /api/v1/trade/executions?symbol=BTC-USDCx&limit=20 ``` Example response: ```json theme={null} { "list": [...], "next_page_cursor": "" } ``` To retrieve the next page, pass the returned `next_page_cursor` value as the `cursor` parameter in the next request. ## 11. Field Naming * All JSON keys use `snake_case`. * High-precision numeric values are represented as strings. * Integer values are represented as JSON numbers. ## 12. WebSocket Heartbeats ### Application-level ping/pong Clients may send: ```json theme={null} { "op": "ping", "req_id": "optional-id", "ts": 1718000000000 } ``` The server replies: ```json theme={null} { "op": "pong", "req_id": "optional-id", "client_ts": 1718000000000, "server_ts": 1718000001000 } ``` All timestamps are Unix milliseconds. ### WebSocket-level ping/pong (keepalive) The server periodically sends WebSocket-level ping frames and expects pong responses. If a pong is not received within the configured timeout, the server may close the connection. Clients should automatically respond to WebSocket-level ping frames and may also send application-level `ping` messages if desired. *** For detailed endpoint specifications and integration examples, refer to the API Reference. # API Error Codes Source: https://docs.ekiden.fi/api-reference/errors Gateway errors and matching-engine rejection codes for order placement, amendment, and cancellation. ![API Error Codes cover](https://mintcdn.com/ekiden/tOrD4_nnYydmkLI5/images/clipboard.jpeg?fit=max\&auto=format\&n=tOrD4_nnYydmkLI5\&q=85\&s=0f38bd048824c984c3d379776a0496f8) This page is the complete reference for errors returned by Ekiden's trading API. It covers both gateway responses and matching-engine rejections for placing, amending, and cancelling orders. > [!NOTE] > > For the general error-response envelope, authentication requirements, and rate-limit conventions, see [API conventions](/api-reference/conventions). ## How an error is returned Gateway failures use an HTTP status code and an error payload. Matching-engine rejections are normally returned with HTTP `400`; the payload contains the applicable `RejectReason` code. ```json theme={null} { "code": "EcInsufficientFunds", "message": "Insufficient funds" } ``` If an order is rejected without a more specific matching-engine reason, the gateway may return `OrderRejected`. Batch operations can return HTTP `202 Accepted` while the final result is pending; use the relevant order or execution endpoint to retrieve the outcome. ## Gateway API errors | HTTP status | Code | Meaning | | - | - | - | | `400` | `BAD_REQUEST` | The request is malformed or fails endpoint validation. | | `401` | `UNAUTHORIZED` | Authentication is missing, invalid, or expired. | | `401` | `ROOT_ADDRESS_NOT_WHITELISTED` | The root address is not permitted for the requested operation. | | `401` | `CANTON_PARTY_NOT_PROVISIONED` | The Canton party has not been provisioned for access. | | `401` | `CANTON_ID_TOKEN_STALE` | The Canton identity token is no longer current. | | `401` | `CANTON_ID_TOKEN_INVALID` | The Canton identity token cannot be validated. | | `401` | `TIMESTAMP_OUTSIDE_ALLOWED_WINDOW` | The signed request timestamp is outside the permitted window. | | `403` | `FORBIDDEN` | The authenticated caller does not have permission for the operation. | | `403` | `ACCOUNT_BANNED_COMPETITIONS` | The account is restricted from competition-related access. | | `403` | `OPERATOR_EMAIL_DOMAIN_NOT_ALLOWED` | The operator email domain is not permitted. | | `403` | `ACCESS_NOT_ACTIVATED` | Trading access has not yet been activated. | | `403` | `BLOCKED` | The caller or account is blocked. | | `404` | `NOT_FOUND` | The requested resource or route does not exist. | | `429` | `RateLimitExceeded` | The request exceeds the applicable rate limit. | | `429` | `TRADING_BACKPRESSURE` | Trading requests are being throttled to protect the service. | | `500` | `INTERNAL` | An unexpected internal error occurred. | | `503` | `SERVICE_UNAVAILABLE` | A required service is unavailable or temporarily unable to process the request. | ## Matching-engine rejection codes The codes below are returned as `RejectReason` values. A code can apply to more than one endpoint; the operation group shows where it is expected to occur, not an exclusive mapping. ### Place order | Code | Meaning | | - | - | | `EcInsufficientFunds` | Available balance is insufficient for the order. | | `EcUnknownMessageType` | The matching engine does not recognize the request message type. | | `EcMissingClOrdId` | The client order ID is missing. | | `EcUnknownOrderType` | The order type is unsupported or invalid. | | `EcUnknownSide` | The order side is unsupported or invalid. | | `EcUnknownTimeInForce` | The time-in-force value is unsupported or invalid. | | `EcWronglyRouted` | The request was routed to an incorrect matching-engine destination. | | `EcMarketOrderPriceIsNotZero` | A market order must not include a non-zero price. | | `EcLimitOrderInvalidPrice` | The limit price is invalid. | | `EcNoEnoughQtyToFill` | The available quantity is insufficient to fill the order. | | `EcNoImmediateQtyToFill` | No quantity is immediately available to fill the order. | | `EcMarketOrderCannotBePostOnly` | A market order cannot use the post-only instruction. | | `EcPostOnlyWillTakeLiquidity` | A post-only order would take liquidity. | | `EcReduceOnlyNoPosition` | A reduce-only order was submitted without an open position. | | `EcReduceOnlyWouldIncreasePosition` | A reduce-only order would increase exposure. | | `EcReduceOnlyExceedsPosition` | The reduce-only quantity exceeds the position size. | | `EcReduceOnlyMode` | The requested order conflicts with the applicable reduce-only mode. | | `EcInvalidSymbolStatus` | The instrument is not in a valid status for the request. | | `EcBySelfMatch` | The order would match against the same user. | | `EcInCallAuctionStatus` | The instrument is in call-auction status. | | `EcQtyCannotBeZero` | Quantity must be greater than zero. | | `EcMarketOrderNoSupportTif` | The selected time-in-force is not supported for market orders. | | `EcReachMaxTradeNum` | The request would exceed the maximum permitted trade count. | | `EcInvalidPriceScale` | The price uses an invalid precision or scale. | | `EcInvalidSmpType` | The self-match-prevention type is invalid. | | `EcInvalidUserType` | The user type is invalid for this request. | | `EcPriceNotMultipleOfTick` | Price is not a multiple of the instrument tick size. | | `EcQtyBelowMin` | Quantity is below the minimum order quantity. | | `EcQtyNotMultipleOfLot` | Quantity is not a multiple of the lot size. | | `EcQtyAboveMax` | Quantity is above the maximum order quantity. | | `EcInvalidAmount` | Order amount is invalid. | | `EcMarketQuoteNoSuppSell` | A quote-denominated market sell is not supported. | | `EcInvalidBaseValue` | The base value is invalid. | | `EcSecurityStatusFail` | The instrument's security status does not permit the request. | | `EcReachRiskPriceLimit` | The order breaches the applicable risk-price limit. | | `EcReachMarketPriceLimit` | The order breaches the applicable market-price limit. | | `EcTradingHalted` | Trading is halted for the instrument or market. | | `EcCancelByMmp` | The order was cancelled by market-maker protection. | | `EcLoadOrderCanMatch` | The loaded order would immediately match. | | `EcBitIndexInvalid` | A bit index in the request is invalid. | | `EcStopBySelfMatch` | The order was stopped by self-match prevention. | ### Amend or cancel-replace order | Code | Meaning | | - | - | | `EcMissingClOrdId` | The new client order ID is missing. | | `EcMissingOrigClOrdId` | The original client order ID is missing. | | `EcClOrdIdOrigClOrdIdAreTheSame` | The new and original client order IDs must differ. | | `EcDuplicatedClOrdId` | The specified client order ID is already in use. | | `EcOrigClOrdIdDoesNotExist` | The original client order ID does not identify an order. | | `EcTooLateToCancel` | The order can no longer be cancelled or replaced. | | `EcCancelReplaceOrder` | The cancel-replace request was rejected by the matching engine. | | `EcUnknownOrderType` | The order type is unsupported or invalid. | | `EcUnknownSide` | The order side is unsupported or invalid. | | `EcUnknownTimeInForce` | The time-in-force value is unsupported or invalid. | | `EcMarketOrderPriceIsNotZero` | A market order must not include a non-zero price. | | `EcLimitOrderInvalidPrice` | The limit price is invalid. | | `EcMarketOrderCannotBePostOnly` | A market order cannot use the post-only instruction. | | `EcPostOnlyWillTakeLiquidity` | A post-only order would take liquidity. | | `EcReduceOnlyNoPosition` | A reduce-only order was submitted without an open position. | | `EcReduceOnlyWouldIncreasePosition` | A reduce-only order would increase exposure. | | `EcReduceOnlyExceedsPosition` | The reduce-only quantity exceeds the position size. | | `EcReduceOnlyMode` | The requested order conflicts with the applicable reduce-only mode. | | `EcInvalidSymbolStatus` | The instrument is not in a valid status for the request. | | `EcQtyCannotBeZero` | Quantity must be greater than zero. | | `EcInvalidPriceScale` | The price uses an invalid precision or scale. | | `EcPriceNotMultipleOfTick` | Price is not a multiple of the instrument tick size. | | `EcQtyBelowMin` | Quantity is below the minimum order quantity. | | `EcQtyNotMultipleOfLot` | Quantity is not a multiple of the lot size. | | `EcQtyAboveMax` | Quantity is above the maximum order quantity. | | `EcInvalidAmount` | Order amount is invalid. | | `EcOrderNotExist` | The targeted order does not exist. | | `EcTradingHalted` | Trading is halted for the instrument or market. | | `EcSecurityStatusFail` | The instrument's security status does not permit the request. | | `EcReachRiskPriceLimit` | The amended order breaches the applicable risk-price limit. | | `EcReachMarketPriceLimit` | The amended order breaches the applicable market-price limit. | ### Cancel order | Code | Meaning | | - | - | | `EcMissingOrigClOrdId` | The original client order ID is missing. | | `EcOrigClOrdIdDoesNotExist` | The original client order ID does not identify an order. | | `EcTooLateToCancel` | The order can no longer be cancelled. | | `EcPerCancelRequest` | The cancel request was rejected by the matching engine. | | `EcCancelForNoFullFill` | The order was cancelled because it could not be fully filled. | | `EcOrderNotExist` | The targeted order does not exist. | | `EcCancelByOrderValueZero` | The order was cancelled because its order value is zero. | | `EcCancelByMatchValueZero` | The order was cancelled because its matched value is zero. | | `EcLoadOrderCancel` | A loaded order was cancelled. | | `EcDisorderOrderId` | The order ID is out of the expected sequence. | | `EcCancelByMmp` | The order was cancelled by market-maker protection. | ### Shared and generic codes | Code | Meaning | | - | - | | `EcNoError` | No matching-engine error was recorded. | | `EcOthers` | An uncategorized matching-engine rejection occurred. | | `EcUnknownMessageType` | The matching engine does not recognize the request message type. | | `EcDuplicatedClOrdId` | The specified client order ID is already in use. | | `EcInvalidMirrorOid` | The mirrored order ID is invalid. | | `EcInvalidMirrorUid` | The mirrored user ID is invalid. | ## Integration guidance 1. Use the HTTP status to determine whether to retry, re-authenticate, or correct the request. 2. For HTTP `400` order rejections, branch on the returned `RejectReason` rather than parsing the human-readable message. 3. Do not retry validation, risk, precision, or order-state rejections unchanged. Correct the request first. 4. Back off and retry only transient errors such as `429`, `503`, or `500`; respect any rate-limit headers and use exponential backoff with jitter. 5. For `202 Accepted` batch results, wait for the final status through the appropriate order or execution query rather than treating acceptance as execution. > [!WARNING] > > Do not assume that a code is exclusive to one endpoint. The matching engine may return an applicable shared rejection code for any order lifecycle operation. # Account Data Source: https://docs.ekiden.fi/api-reference/integration/account-data This section describes the REST endpoints and corresponding TypeScript SDK methods for retrieving user account information, balances, positions, executions, and account statistics. ## REST Endpoints | Resource | Endpoint | | - | - | | Root Account | `GET /api/v1/user/root-account` | | Sub Accounts | `GET /api/v1/user/sub-accounts` | | Positions | `GET /api/v1/position/list?sub_account_address=
` | | Executions (Fills) | `GET /api/v1/execution/list?sub_account_address=
` | | Account Balances | `GET /api/v1/account/balance` | | Account Statistics | `GET /api/v1/account/statistics` | ## TypeScript SDK Retrieve the authenticated user's root account: ```ts theme={null} const rootAccount = await client.user.getRootAccount(); ``` Retrieve all sub-accounts: ```ts theme={null} const subAccounts = await client.user.getSubAccounts(); ``` Retrieve account balances: ```ts theme={null} const balances = await client.account.getBalance(); ``` Retrieve positions: ```ts theme={null} const positions = await client.position.getPositionInfo({ sub_account_address, }); ``` Retrieve execution history: ```ts theme={null} const executions = await client.trade.getTradeHistory({ sub_account_address, }); ``` Retrieve account statistics: ```ts theme={null} const statistics = await client.account.getStatistics({ sub_account_address, }); ``` ## Timestamp Fields REST resources use Unix timestamps in milliseconds. Common timestamp fields include: * `created_time` * `updated_time` * `timestamp_ms` Some legacy responses may still include the `timestamp` field for backward compatibility. # Account Statistics Source: https://docs.ekiden.fi/api-reference/integration/account-statistics Use account statistics to retrieve historical time-series metrics for a trading sub-account, including equity, PnL, trading volume, and ROI. ## REST Endpoint ```http theme={null} GET /api/v1/account/statistics ``` ### Query Parameters | Parameter | Required | Description | | - | - | - | | `sub_account_address` | No | Sub-account to query. If omitted, the backend determines the accessible account(s) from the authenticated user. | | `start_time` | No | Start timestamp in Unix milliseconds. | | `end_time` | No | End timestamp in Unix milliseconds. | | `step` | No | Aggregation interval. Supported values: `hour`, `day`, `week`, `month` (aliases `h`, `d`, `w`, `m` are also accepted). | | `limit` | No | Maximum number of records to return. | | `sorting_order` | No | Sort order: `asc` or `desc`. | ## TypeScript SDK Retrieve account statistics: ```ts theme={null} const statistics = await client.account.getStatistics({ sub_account_address, start_time, end_time, step: "day", limit: 100, sorting_order: "desc", }); ``` ## Example ```bash theme={null} curl \ -H "Authorization: Bearer " \ "https://api.cnt.ekiden.fi/api/v1/account/statistics?sub_account_address=" ``` ## Response Fields Each entry may include: * `timestamp` * `sub_account_address` * `equity` * `realised_pnl_cum` * `unrealised_pnl` * `volume` * `roi` The exact response schema is documented in the API Reference. # Leverage Source: https://docs.ekiden.fi/api-reference/integration/adjust-the-leverage ## Overview Ekiden allows leverage to be configured independently for each trading symbol. Changing leverage affects the margin requirements for future position exposure and the estimated liquidation price. Increasing leverage reduces the required margin but increases liquidation risk, while lowering leverage increases the required margin and reduces liquidation risk. ## Endpoint ```http theme={null} POST /api/v1/position/set-leverage ``` Updates the leverage setting for a specific trading symbol and sub-account. ### Authentication ```text theme={null} Authorization: Bearer Content-Type: application/json ``` ## Request Parameters | Parameter | Type | Description | Required | | - | - | - | - | | `leverage` | string | Leverage value to set (for example, `"10"` for 10× leverage). | Yes | | `sub_account_address` | string | Sub-account address. | Yes | | `symbol` | string | Trading symbol (for example, `"BTC-USDCx"`). | Yes | ## Example Request ```json theme={null} { "leverage": "8", "sub_account_address": "0x6160e0768af12ec30112972801aaa8287b42f15a2485ef68cd184a3eeec9dc49", "symbol": "BTC-USDCx" } ``` ## Response ```json theme={null} { "success": true, "time": 1783479390120 } ``` A successful response indicates that the leverage update request has been accepted. ## Notes * Leverage is configured independently for each trading symbol. * Supported leverage ranges vary by market and can be obtained from `GET /api/v1/market/instruments-info`. * Changing leverage affects margin requirements and the estimated liquidation price. # Closing Positions Source: https://docs.ekiden.fi/api-reference/integration/closing-position A position can be reduced or closed by submitting an order on the opposite side of the current position. To ensure that the order does not increase exposure, set: ```json theme={null} { "reduce_only": true } ``` A reduce-only order will only decrease or close an existing position. If the order would increase the position size, it is rejected. ## Position Fields Useful position fields include: * `margin_mode` — Cross or Isolated margin mode. * `initial_margin` — Initial margin allocated to the position. * `maintenance_margin` — Maintenance margin requirement. * `leverage` — Position leverage. * `liq_price` — Estimated liquidation price. * `updated_time` — Last position update time (Unix timestamp in milliseconds). See also: **PnL, Margin & Funding**. # Configuration Source: https://docs.ekiden.fi/api-reference/integration/configuration Production endpoint URLs for REST and WebSocket integrations with Ekiden. ## Production Use the production environment for live integrations with Ekiden. * **REST**: [https://api.ekiden.fi/api/v1](https://api.ekiden.fi/api/v1) * **WebSocket public**: wss\://api.ekiden.fi/ws/public * **WebSocket private**: wss\://api.ekiden.fi/ws/private See [Client Initialization](/api-reference/integration/initialization) for setup and [API Authentication](/api-reference/integration/onboarding-auth) for credentials. ## Staging The staging environment is reserved for authorized development and integration testing. Request access from the Ekiden team before using it. * **REST**: [https://api.testnet.ekiden.fi/api/v1](https://api.testnet.ekiden.fi/api/v1) * **WebSocket public**: wss\://api.testnet.ekiden.fi/ws/public * **WebSocket private**: wss\://api.testnet.ekiden.fi/ws/private # Deposit & Withdraw Funds Source: https://docs.ekiden.fi/api-reference/integration/deposit-and-withdraw ## Overview Ekiden uses Canton to manage collateral for trading. Users can deposit supported assets into their funding account and withdraw available collateral. ## Supported Assets Currently supported collateral: * USDCx Additional assets may be added in future releases. ## Deposits Deposit functionality is available through the TypeScript SDK and Canton integration. Detailed integration examples will be added once the deposit workflow is finalized. ## Withdrawals Withdrawal functionality is available through the TypeScript SDK and Canton integration. Detailed integration examples will be added once the withdrawal workflow is finalized. # Client Initialization Source: https://docs.ekiden.fi/api-reference/integration/initialization Initialize the Ekiden TypeScript SDK to connect to the REST and WebSocket APIs. ## Supported Environments The SDK provides predefined configurations for supported environments. | Environment | REST API | Public WebSocket | Private WebSocket | | - | - | - | - | | Mainnet | `https://api.ekiden.fi/api/v1` | `wss://api.ekiden.fi/ws/public` | `wss://api.ekiden.fi/ws/private` | | Testnet Beta | `https://api.cnt.ekiden.fi/api/v1` | `wss://api.cnt.ekiden.fi/ws/public` | `wss://api.cnt.ekiden.fi/ws/private` | | Staging | `https://api.testnet.ekiden.fi/api/v1` | `wss://api.testnet.ekiden.fi/ws/public` | `wss://api.testnet.ekiden.fi/ws/private` | ## Initialize the Client ```ts theme={null} import { EkidenClient, TESTNET } from "@ekidenfi/ts-sdk"; const ekiden = new EkidenClient(TESTNET); ``` ## Custom Configuration You can also provide a custom configuration. ```ts theme={null} import { EkidenClient } from "@ekidenfi/ts-sdk"; const ekiden = new EkidenClient({ baseURL: "https://your-api.example.com", wsURL: "wss://your-api.example.com/ws/public", privateWSURL: "wss://your-api.example.com/ws/private", apiPrefix: "/api/v1", }); ``` After initializing the client, continue with the Authentication guide to obtain a JWT or configure API Key authentication. # Installation Source: https://docs.ekiden.fi/api-reference/integration/installation Official npm package: [@ekidenfi/ts-sdk](https://www.npmjs.com/package/@ekidenfi/ts-sdk) Install the Ekiden TypeScript SDK using your preferred package manager. ## Install ### npm ```bash theme={null} npm install @ekidenfi/ts-sdk ``` ### pnpm ```bash theme={null} pnpm add @ekidenfi/ts-sdk ``` ### yarn ```bash theme={null} yarn add @ekidenfi/ts-sdk ``` ### bun ```bash theme={null} bun add @ekidenfi/ts-sdk ``` ## Next Steps Continue with the Authentication guide to configure your credentials and make your first API request. # Leaderboards & Competitions Source: https://docs.ekiden.fi/api-reference/integration/leaderboards-and-competitions Leaderboards provide ranked trading sub-accounts together with trading performance metrics and XP statistics. Competition endpoints provide public competition information, leaderboards, and authenticated competition views. ## User Leaderboard ```http theme={null} GET /api/v1/user/leaderboard ``` Query parameters: | Parameter | Required | Notes | | - | - | - | | `timeframe` | Yes | Ranking window. Supported values: `today`, `7d`, `30d`, `all`. | | `limit` | No | Page size. | | `offset` | No | Pagination offset. | Each leaderboard row includes: * `sub_account_address` * `place` * `ranked` * `volume` * `pnl` * `roi` * `account_value` * `trading_xp` * `referral_xp` * `total_xp` Pagination metadata is returned in the `meta` object. ## User Placement ```http theme={null} GET /api/v1/user/leaderboard/placement ``` Query parameters: | Parameter | Required | Notes | | - | - | - | | `timeframe` | Yes | Ranking window. Supported values: `today`, `7d`, `30d`, `all`. | | `sub_account` | No | Returns placement for the specified trading sub-account. If omitted, placement is returned for each trading sub-account. | Each placement entry includes: * `sub_account_address` * `place` * `ranked` * `volume` * `pnl` * `roi` * `account_value` * `trading_xp` * `referral_xp` * `total_xp` ## Public Competitions ### List Competitions ```http theme={null} GET /api/v1/competitions ``` Returns the list of public competitions. Query parameters: | Parameter | Required | Notes | | - | - | - | | `status` | No | Filters competitions by status. See OpenAPI for accepted values. | Each competition includes: * `id` * `slug` * `title` * `description_md` * `status` * `start_time_ms` * `end_time_ms` * `prize_usdc` * `metric` * `symbol` See the generated OpenAPI schema for the complete response structure. ### Competition Details ```http theme={null} GET /api/v1/competitions/{competition_slug} ``` Returns the details for a single public competition. Path parameters: | Parameter | Required | Notes | | - | - | - | | `competition_slug` | Yes | Competition slug. | Returns metadata and configuration for a single public competition. See the generated OpenAPI schema for the complete response structure. ### Competition Leaderboard ```http theme={null} GET /api/v1/competitions/{competition_slug}/leaderboard ``` Path parameters: | Parameter | Required | Notes | | - | - | - | | `competition_slug` | Yes | Competition slug. | Query parameters: | Parameter | Required | Notes | | - | - | - | | `limit` | No | Page size. | | `offset` | No | Pagination offset. | | `sub_account` | No | Returns the specified trading sub-account only. | The response includes: * `competition` * `data` * `meta` Each leaderboard entry includes: * `sub_account_address` * `rank` * `score` * `metric_value` * `active_days` * `eligible` * `ineligible_reason` * `projected_xp` Pagination metadata is returned in the `meta` object. ## Authenticated Competition Endpoints The following endpoints require authentication and operate on competition IDs rather than slugs. ```http theme={null} GET /api/v1/user/competitions GET /api/v1/user/competitions/{competition_id}/leaderboard GET /api/v1/user/competitions/{competition_id}/placement ``` Competition leaderboard rows include: * `sub_account_address` * `rank` * `score` * `metric_value` * `active_days` * `eligible` * `ineligible_reason` * `projected_xp` `projected_xp` is a live display-only projection based on the current eligible leaderboard scores. Final XP allocation is recorded in the rewards ledger. # Market Data Source: https://docs.ekiden.fi/api-reference/integration/market-data ## Sources * REST: See the API Reference for `/api/v1/market/*` endpoints, including market data, order books, tickers, klines, funding, open interest, and risk limits. * WebSocket (real-time): * Public: `wss://api.ekiden.fi/ws/public` * Private: `wss://api.ekiden.fi/ws/private` (requires JWT authentication) ## Common Subscriptions * `orderbook..` (e.g. `orderbook.1.BTC-USDCx`) — order book snapshots and deltas * `trade.` — public trade feed * `ticker.` — 24-hour ticker updates * `kline..` — candlestick updates * `all_liquidations.` — liquidation events * `insurance_pool.` — insurance pool snapshots * `adl_alert.` — ADL alert updates * `order`, `position`, `execution`, `account_balance` — private user streams (available on `/ws/private` after authentication) ## Timestamps * `ts` (ticker snapshots) is a Unix timestamp in milliseconds. * `client_ts` and `server_ts` (WebSocket ping/pong) are Unix timestamps in milliseconds. * `server_ts_ms` (WebSocket event envelope) is a Unix timestamp in milliseconds. # Market Maker Integration Guide Source: https://docs.ekiden.fi/api-reference/integration/market-maker-integration This guide explains how to integrate a market making system with the Ekiden REST and WebSocket APIs. It provides an overview of authentication, market data, order management, private account streams, and operational best practices. Detailed endpoint specifications, request parameters, and response schemas are available in the API Reference. *** # 1. Overview Ekiden provides REST and WebSocket APIs for low-latency market making and automated trading. ## Supported Protocols * REST API (HTTPS) * WebSocket (WSS) ## Environments | Environment | REST | WebSocket | | - | - | - | | Mainnet | `https://api.ekiden.fi/api/v1` | `wss://api.ekiden.fi/ws/public` `wss://api.ekiden.fi/ws/private` | | Testnet Beta | `https://api.cnt.ekiden.fi/api/v1` | `wss://api.cnt.ekiden.fi/ws/public` `wss://api.cnt.ekiden.fi/ws/private` | | Staging | `https://api.testnet.ekiden.fi/api/v1` | `wss://api.testnet.ekiden.fi/ws/public` `wss://api.testnet.ekiden.fi/ws/private` | Public market data is available without authentication. Trading operations and private account streams require authentication. *** # 2. Authentication Ekiden supports two authentication methods: * JWT Bearer authentication * API Key authentication ## Obtain a JWT ```http theme={null} POST /api/v1/authorize ``` Example request: ```json theme={null} { "public_key": "", "signature": "", "timestamp_ms": 1731541800000, "nonce": "random-unique-string" } ``` Successful response: ```json theme={null} { "token": "", "user_id": "" } ``` The returned JWT is used to authenticate private REST requests and private WebSocket connections. ## REST Authentication Authenticated REST requests use the standard Bearer header: ```http theme={null} Authorization: Bearer ``` ## API Key Authentication REST API Key authentication uses the following headers: * `X-API-KEY` * `X-SIGNATURE` * `X-TIMESTAMP-MS` * `X-NONCE` The signature must be an Ed25519 signature of: ```text theme={null} EKIDEN_API|{method}|{uri}|{timestamp_ms}|{nonce} ``` Refer to the Authentication guide for complete details. *** # 3. REST API REST endpoints are grouped by resource. | Group | Purpose | | - | - | | `/market/*` | Public market data | | `/order/*` | Order management | | `/execution/*` | Trade execution history | | `/position/*` | Positions and leverage | | `/account/*` | Account balances | | `/user/*` | User resources | Example: ```bash theme={null} curl \ -H "Authorization: Bearer " \ "https://api.ekiden.fi/api/v1/position/list?sub_account_address=" ``` Refer to the API Reference for complete endpoint documentation. *** # 4. WebSocket Ekiden provides separate public and private WebSocket endpoints. | Endpoint | Authentication | | - | - | | `/ws/public` | Not required | | `/ws/private` | JWT or API Key | ## JWT Authentication Authenticate immediately after connecting. Client → Server ```json theme={null} { "op": "auth", "bearer": "", "req_id": "auth-1" } ``` Server → Client ```json theme={null} { "op": "auth", "success": true, "user_id": "", "req_id": "auth-1" } ``` ## API Key Authentication Alternatively, authenticate using an API key. Client → Server ```json theme={null} { "op": "auth_api_key", "api_key": "", "signature": "", "timestamp_ms": 1731541800000, "nonce": "random-unique-string", "req_id": "auth-1" } ``` The signature must be an Ed25519 signature of: ```text theme={null} EKIDEN_WS|AUTH|{timestamp_ms}|{nonce} ``` ## Subscribe After successful authentication, subscribe to private topics. ```json theme={null} { "op": "subscribe", "args": [ "order", "execution", "position", "account_balance" ], "req_id": "sub-1" } ``` Public market data is available from the public WebSocket without authentication. Common public topics include: * `orderbook..` * `trade.` * `ticker.` * `kline..` * `insurance_pool.` * `adl_alert.` *** # 5. Typical Trading Flow A typical market maker integration follows this sequence: 1. Obtain a JWT or use API Key authentication. 2. Connect to the public WebSocket. 3. Subscribe to market data. 4. Connect to the private WebSocket. 5. Authenticate the private connection. 6. Subscribe to private account topics. 7. Place, amend, or cancel orders using the REST API. 8. Monitor order, execution, position, and account updates through the private WebSocket. *** # 6. Error Handling Common HTTP status codes include: | Status | Description | | - | - | | `400` | Invalid request | | `401` | Authentication failed | | `403` | Permission denied | | `404` | Resource not found | | `429` | Rate limit exceeded | | `500` | Internal server error | | `503` | Service temporarily unavailable | Refer to the Error Handling guide for the complete list of application error codes. *** # 7. Rate Limits REST API requests are subject to rate limits. When a limit is exceeded, the server returns: * HTTP `429 Too Many Requests` * `Retry-After` response header Clients should respect the `Retry-After` value before retrying requests. Refer to the Rate Limits guide for current limits. # API Authentication Source: https://docs.ekiden.fi/api-reference/integration/onboarding-auth This guide explains how to authenticate with the Ekiden API using either a JWT or an API key. ## 1. Obtain a JWT Request a JWT access token from the authorization endpoint. ```http theme={null} POST /api/v1/authorize Content-Type: application/json ``` Example request: ```json theme={null} { "public_key": "", "signature": "", "timestamp_ms": 1731541800000, "nonce": "random-unique-string" } ``` Where: * `public_key` – Your Canton Party ID. * `signature` – "". * `timestamp_ms` – Current Unix timestamp in milliseconds. * `nonce` – A unique random string. Example response: ```json theme={null} { "token": "", "user_id": "" } ``` *** ## 2. API Key Authentication For server-to-server integrations, you can authenticate requests directly using an API key. Required headers: * `X-API-KEY` – Your API public key. * `X-SIGNATURE` – Ed25519 signature of `EKIDEN_API|{method}|{uri}|{timestamp_ms}|{nonce}`. * `X-TIMESTAMP-MS` – Current Unix timestamp in milliseconds. * `X-NONCE` – A unique random string. *** ## 3. Authenticate REST Requests Include the JWT as a Bearer token in the `Authorization` header. ```http theme={null} GET /api/v1/user/sub-accounts Authorization: Bearer ``` *** ## 4. Authenticate a Private WebSocket Connection Connect to the private WebSocket endpoint: ```text theme={null} wss://api.ekiden.fi/ws/private ``` Authenticate immediately after connecting. Client → Server ```json theme={null} { "op": "auth", "bearer": "", "req_id": "auth-1" } ``` Server → Client ```json theme={null} { "op": "auth", "success": true, "user_id": "", "req_id": "auth-1" } ``` After successful authentication, subscribe to private topics. ```json theme={null} { "op": "subscribe", "args": [ "order", "position", "execution", "account_balance" ], "req_id": "sub-1" } ``` Public topics such as: * `orderbook.1.BTC-USDCx` * `trade.BTC-USDCx` * `ticker.BTC-USDCx` are available on `/ws/public` without authentication. *** ## Timestamp and Nonce Requirements * `timestamp_ms` must represent the current Unix time in milliseconds. * Each authorization request must use a unique `nonce`. * Requests with expired timestamps or reused nonces may be rejected. *** ## Example (curl) Request a JWT: ```bash theme={null} curl -X POST "https://api.ekiden.fi/api/v1/authorize" \ -H "Content-Type: application/json" \ -d '{ "public_key": "", "signature": "", "timestamp_ms": 1731541800000, "nonce": "random-unique-string" }' ``` Call a private endpoint: ```bash theme={null} curl \ -H "Authorization: Bearer " \ "https://api.ekiden.fi/api/v1/user/sub-accounts" ``` *** ## Troubleshooting | Problem | Possible cause | | - | - | | `400 Bad Request` | Invalid request payload, expired `timestamp_ms`, or invalid `nonce`. | | `401 Unauthorized` | Missing, expired, or invalid JWT. | | WebSocket authentication failed | Authenticate before subscribing to private topics on `/ws/private`. | # Orders Source: https://docs.ekiden.fi/api-reference/integration/orders ### **REST Endpoints** * **Get Order History**: `GET /api/v1/order/history` * **Get Open Orders**: `GET /api/v1/order/realtime` * **Place Order**: `POST /api/v1/order/place` * **Place Batch Orders**: `POST /api/v1/order/place-batch` * **Amend Order**: `POST /api/v1/order/amend` * **Amend Batch Orders**: `POST /api/v1/order/amend-batch` * **Cancel Order**: `POST /api/v1/order/cancel` * **Cancel Batch Orders**: `POST /api/v1/order/cancel-batch` * **Cancel All Orders**: `POST /api/v1/order/cancel-all` ### Order types and Time-in-Force This section describes all supported order types for entries and how Time-in-Force (TIF) affects execution. Entry orders support two base types; conditional entries and bracket exits extend these with triggers. #### Entry orders * Market * `order_type: "Market"` * Executes immediately against the order book at the best available prices. * Any unfilled remainder does not rest on the book; pair with `time_in_force: "IOC"` or `"FOK"` to enforce stricter behavior explicitly. * Limit * `order_type: "Limit"` * Executes up to the specified `price`; any unfilled remainder can rest on the book depending on TIF. * Common pairings: `time_in_force: "GTC"` to rest, `"IOC"` to cancel any remainder, or `"FOK"` to require full fill. * If the order should only add liquidity, set `post_only: true`; the order is rejected if it would execute immediately. Set `post_only: false` if post-only behavior is not required. Recommended: set `time_in_force` explicitly for clarity rather than relying on implicit defaults. #### Time-in-Force * GTC — Good-Till-Cancelled. Rests until filled or cancelled. * IOC — Immediate-Or-Cancel. Fills as much as possible immediately and cancels any unfilled remainder. * FOK — Fill-Or-Kill. Either fills completely immediately or is cancelled. * GTD — Good-Till-Date. Remains active until the specified expiration time, unless filled or cancelled earlier. Provide `time_in_force` using one of the supported values: * `"GTC"` * `"IOC"` * `"FOK"` * `{ "GTD": }` Post-only behavior is controlled separately using the `post_only` boolean field: * `post_only: true` — the order only adds liquidity and is rejected if it would execute immediately. * `post_only: false` — post-only behavior is not required. #### Conditional entries (stop orders) You can create a stop-style entry by supplying a `trigger` object. The `trigger` object includes: * `trigger_by`: Price source used to activate the order. Supported values: `"LastPrice"`, `"IndexPrice"`, or `"MarkPrice"`. * `trigger_direction`: Direction in which the trigger condition is evaluated. Supported values: `"Up"` or `"Down"`. * `trigger_price`: Price level that activates the order. * Stop-Market * `order_type: "Market"` +`trigger` * Activates when the selected price source reaches the specified `trigger_price` in the specified `trigger_direction`. * Stop-Limit * `order_type: "Limit"` + `trigger` + `price` * Activates when the selected price source reaches the specified `trigger_price` in the specified `trigger_direction`; places a limit order at `price` on activation. #### Order placement results and status updates A successful REST response indicates that the request was accepted, not that the order has been executed. Track subsequent order status changes through the private WebSocket `order` topic. Batch order placement returns per-request result information in `exit_info`, including `Success` or `Error`, together with order identifiers in `result`. ### Triggers and TP/SL * **Order field: `trigger`** * Makes the order conditional. * Structure: * `trigger_by`: `"LastPrice"`, `"IndexPrice"`, or `"MarkPrice"` — the price source used to activate the order. * `trigger_direction`: `"Up"` or `"Down"` — the trigger direction. * `trigger_price`: The price level at which the order is activated. * **Order field: `tpsl`** * Attaches Take Profit and/or Stop Loss settings to an entry order. * Structure: * `mode`: `"Full"` or `"Partial"`. * `take_profit` / `stop_loss`: Optional TP/SL settings that support `market` or `limit` order types. * **Reduce-only** * Use `reduce_only: true` to prevent increasing exposure. Triggered TP/SL orders are intended to reduce or close an existing position. See the dedicated page: TP/SL, Triggers, and Reduce-Only. # PnL, Margin & Funding Source: https://docs.ekiden.fi/api-reference/integration/pnl-margin-fr This page describes the margin- and funding-related fields returned by the position endpoints. ## Position Information Position information is available through: ```http theme={null} GET /api/v1/position/list ``` The response includes commonly used margin and risk fields such as: * `entry_price` * `mark_price` * `unrealised_pnl` * `realised_pnl` * `margin_mode` * `initial_margin` * `maintenance_margin` * `leverage` * `liq_price` * `funding` *** ## Margin Mode Ekiden currently supports **Cross Margin** only. In Cross Margin mode: * Margin is shared across all positions within the trading account. * Available account equity may be used to prevent liquidation. * Liquidation risk is evaluated using the account's available margin. The current margin mode is returned in the `margin_mode` field. *** ## Risk Fields Position responses include the following risk-related fields: * `initial_margin` * `maintenance_margin` * `leverage` * `liq_price` These values are calculated by the trading engine and returned for informational purposes. *** ## Funding Funding-related information is available through: * Position responses (`funding`) * Funding Rate History: ```http theme={null} GET /api/v1/market/funding/history ``` Refer to the Market Data documentation for funding rate history endpoints. # Quick Start Source: https://docs.ekiden.fi/api-reference/integration/quick-start This guide shows how to authenticate with the Ekiden TypeScript SDK and make your first API request. ## Initialize the client ```ts theme={null} import { Account, Ed25519PrivateKey, EkidenClient, TESTNET, } from "@ekidenfi/ts-sdk"; const ekiden = new EkidenClient(TESTNET); ``` ## Authenticate ```ts theme={null} const privateKey = new Ed25519PrivateKey(process.env.PRIVATE_KEY!); const account = Account.fromPrivateKey({ privateKey }); const timestamp_ms = Date.now(); const nonce = Math.random().toString(36).slice(2); const message = `AUTHORIZE|${timestamp_ms}|${nonce}`; const signature = account .sign(new TextEncoder().encode(message)) .toString(); const { token } = await ekiden.user.authorize({ public_key: account.publicKey.toString(), timestamp_ms, nonce, signature, }); ekiden.setToken(token); ``` ## Make your first request ```ts theme={null} const markets = await ekiden.market.getMarkets(); const balance = await ekiden.account.getBalance(); const positions = await ekiden.position.getPositionInfo({ sub_account_address: "0x...", symbol: "BTC-USDCx", }); ``` # Referrals & Rewards Source: https://docs.ekiden.fi/api-reference/integration/referrals-and-rewards Referral and reward endpoints provide access to referral information, referral code management, XP rewards, weekly summaries, and reward history. These endpoints require authentication using either a JWT bearer token or API Key authentication. See the Authentication guide for details. *** ## Referral Summary Retrieve the authenticated user's referral information. ### REST ```http theme={null} GET /api/v1/user/referral ``` ### TypeScript SDK ```ts theme={null} const referral = await client.user.getReferralSummary(); ``` The response includes: * `referral_code` * `referrer_code` * `referrer_user_id` * `downline_count` Example response: ```json theme={null} { "referral_code": "EKIDEN123", "referrer_code": "PARTNER42", "referrer_user_id": "user_abc", "downline_count": 12 } ``` *** ## Bind a Referrer Associate the authenticated user with a referral code. ### REST ```http theme={null} POST /api/v1/user/referral Content-Type: application/json ``` ```json theme={null} { "referral_code": "PARTNER42" } ``` ### TypeScript SDK ```ts theme={null} await client.user.bindReferral({ referral_code: "PARTNER42", }); ``` The response returns the updated referral summary. > A referral can typically only be bound once. Refer to the platform rules for the current referral policy. *** ## Rewards Summary Retrieve the user's XP balance, weekly statistics, and reward history. ### REST ```http theme={null} GET /api/v1/user/rewards ``` ### TypeScript SDK ```ts theme={null} const rewards = await client.user.getRewardsSummary(); ``` Or with optional query parameters: ```ts theme={null} const rewards = await client.user.getRewardsSummary({ limit: 100, }); ``` The response includes: * `xp_balance` * `current_week` * `history` * `ledger` Example response: ```json theme={null} { "xp_balance": 125000, "current_week": { "week_start": 1731283200000, "week_end": 1731888000000, "own_ps": "90000", "bonus_ps": "15000", "final_ps": "105000", "xp": "105000", "finalized": false }, "history": [], "ledger": [] } ``` Refer to the API Reference for the complete `RewardSummaryResponse` schema. # Insurance Pool & ADL Source: https://docs.ekiden.fi/api-reference/integration/risk-feeds Insurance Pool and Auto-Deleveraging (ADL) endpoints expose the current state of Ekiden's risk management system. These endpoints are intended for monitoring, analytics, and operational dashboards. For real-time updates, subscribe to the corresponding public WebSocket topics. ## Insurance Pool ### Current State ```http theme={null} GET /api/v1/market/insurance-pool?symbol=BTC-USDCx ``` Returns the current insurance pool state for the specified market. Common response fields include: * `pool_id` * `pool_group_id` * `cash_balance` * `realized_pnl_cum` * `unrealized_pnl` * `base_equity` * `equity` * `group_redistribution_in` * `group_redistribution_out` * `group_adl_obligation` * `adl_mode` * `adl_trigger_reason` * `latest_pnl_ratio` * `updated_time` * `inventory` ### History ```http theme={null} GET /api/v1/market/insurance-pool/history?symbol=BTC-USDCx&start_time=1731541800000&end_time=1732146600000&limit=100 ``` Supported query parameters: | Parameter | Description | | - | - | | `symbol` | Optional market symbol filter. | | `start_time` | Optional Unix timestamp in milliseconds. | | `end_time` | Optional Unix timestamp in milliseconds. | | `limit` | Maximum number of records to return. | *** ## Auto-Deleveraging (ADL) ### Current State ```http theme={null} GET /api/v1/market/adl-alert?symbol=BTC-USDCx ``` Returns the current ADL status for the specified market. Common response fields include: * `pool_id` * `pool_group_id` * `symbol` * `adl_mode` * `adl_trigger_reason` * `latest_pnl_ratio` * `equity` * `updated_time` ### History ```http theme={null} GET /api/v1/market/adl-alert/history?symbol=BTC-USDCx&start_time=1731541800000&end_time=1732146600000&limit=100 ``` Supported query parameters: | Parameter | Description | | - | - | | `symbol` | Optional market symbol filter. | | `start_time` | Optional Unix timestamp in milliseconds. | | `end_time` | Optional Unix timestamp in milliseconds. | | `limit` | Maximum number of records to return. | *** ## WebSocket Topics Live updates are available on the public WebSocket endpoint: ```text theme={null} wss://api.ekiden.fi/ws/public ``` Available topics: * `insurance_pool.` * `adl_alert.` # Root Whitelist Source: https://docs.ekiden.fi/api-reference/integration/root-whitelist Root whitelist endpoints manage the set of root accounts that are permitted to authorize and onboard when whitelist enforcement is enabled. ## Check Whitelist Status Check whether a root account is currently whitelisted. By root address: ```http theme={null} GET /api/v1/authorize/whitelist/check?root_address=0x... ``` Or by public key: ```http theme={null} GET /api/v1/authorize/whitelist/check?root_public_key=0x... ``` Provide exactly one of `root_address` or `root_public_key`. Example response: ```json theme={null} { "root_address": "0x...", "whitelisted": true } ``` The `whitelisted` field indicates whether the specified root account is currently allowed to authorize. When whitelist enforcement is disabled, all root accounts are treated as whitelisted. *** ## Manage Whitelist Entries Whitelist entries can be managed using the following administrative endpoints. These endpoints are protected using **HTTP Basic Authentication** and are intended for administrative use only. ```http theme={null} PUT /api/v1/authorize/whitelist/{root_address} ``` Adds or updates a whitelist entry. ```http theme={null} DELETE /api/v1/authorize/whitelist/{root_address} ``` Removes a whitelist entry. These endpoints should never be exposed in client applications or SDKs. *** ## Root Account Lookup Authenticated users can retrieve the root account associated with their account. ```http theme={null} GET /api/v1/user/root-account Authorization: Bearer ``` Example response: ```json theme={null} { "root_address": "0x..." } ``` This endpoint is useful when a frontend or SDK needs to display the authenticated user's root account. # TP/SL, Triggers, and Reduce-Only Source: https://docs.ekiden.fi/api-reference/integration/tpsl ## Overview Ekiden supports the following advanced order features: * **Take Profit / Stop Loss (TP/SL)** using the `tpsl` object attached to an entry order. * **Conditional orders** using the `trigger` object. * **Reduce-only orders** using the `reduce_only` flag to prevent increasing an existing position. ## TP/SL The `tpsl` object configures Take Profit and Stop Loss for an entry order. ### Modes The `mode` field supports the following values: | Value | Description | | - | - | | `Full` | Applies the configured Take Profit and Stop Loss settings in full mode. | | `Partial` | Applies the configured Take Profit and Stop Loss settings in partial mode. | ### TP/SL Configuration The `take_profit` and `stop_loss` fields support both **Market** and **Limit** configurations. | Field | Description | | - | - | | `market` | Executes a market order when the trigger price is reached. | | `limit` | Places a limit order when the trigger price is reached. | ## Trigger Conditional orders are configured using the `trigger` object. | Field | Description | | - | - | | `trigger_by` | Price source used to evaluate the trigger. Supported values: `LastPrice`, `IndexPrice`, `MarkPrice`. | | `trigger_direction` | Trigger direction. Supported values: `Up` or `Down`. | | `trigger_price` | Price level that activates the order. | ## Reduce-only Set ```json theme={null} { "reduce_only": true } ``` to ensure that an order only reduces or closes an existing position. ## Example Request ```json theme={null} { "sub_account_address": "0x6160e0768af12ec30112972801aaa8287b42f15a2485ef68cd184a3eeec9dc49", "symbol": "CC-USDCx", "side": "Buy", "order_type": "Market", "qty": "8.32089394", "price": "0", "margin_mode": "Cross", "time_in_force": "IOC", "post_only": false, "reduce_only": false, "close_on_trigger": false, "tpsl": { "mode": "Full", "take_profit": { "market": { "trigger_price": "0.151785799", "trigger_by": "LastPrice" } }, "stop_loss": { "market": { "trigger_price": "0.124188381", "trigger_by": "LastPrice" } } } } ``` ## Notes * Market TP/SL configurations require `trigger_by` and `trigger_price`. * Limit TP/SL configurations require `limit_price`, `trigger_by`, and `trigger_price`. * `trigger_by` supports `LastPrice`, `IndexPrice`, and `MarkPrice`. * All price values (`trigger_price` and `limit_price`) are represented as strings. # Troubleshooting & Best Practices Source: https://docs.ekiden.fi/api-reference/integration/troubleshooting Common troubleshooting tips and integration best practices. ## Troubleshooting ### Authentication * Ensure your system clock is synchronized before requesting JWTs or signing API requests. * Verify that `timestamp_ms` is close to the current time. * Use a unique `nonce` for every authorization request. * Refresh the JWT if authentication fails due to token expiration. ### WebSocket * Automatically reconnect if the connection is interrupted. * Re-authenticate after reconnecting to the private WebSocket. * Re-subscribe to all required topics after reconnecting. * Respond to WebSocket ping frames and optionally send application-level `ping` messages to monitor latency. ### REST * Retry transient failures using exponential backoff. * Respect HTTP `429 Too Many Requests` responses and the `Retry-After` header. * Avoid excessive polling for frequently changing market data. ## Best Practices * Use WebSocket streams for real-time market data instead of frequent REST polling. * Keep a REST fallback for critical state synchronization and recovery. * Validate order parameters using the instrument metadata returned by `/api/v1/market/instruments-info`. * Treat all prices and quantities as decimal strings to avoid precision loss. * Handle order status updates through the private `order` WebSocket topic rather than relying solely on REST responses. # Introduction Source: https://docs.ekiden.fi/api-reference/introduction The Ekiden API provides REST endpoints and WebSocket streams for interacting with both the off-chain central limit order book (CLOB), where matching and execution take place, and the on-chain settlement layer on Canton. While most interactions happen off-chain, some workflows also involve on-chain actions on Canton. All trading actions require digital signature authentication. Orders are matched off-chain for speed, but are cryptographically verified and settled on-chain using Merkle proofs. ### **Connectivity & Integration** Ekiden’s API is built for low-latency, high-throughput trading infrastructure: * **REST** endpoints handle order execution, cancellation, market data, and account management. * **WebSocket** streams provide real-time updates, including trade events, order book changes, and fills. ### TypeScript SDK The official TypeScript SDK simplifies integration with the Ekiden API by providing typed REST and WebSocket clients, authentication helpers, and ready-to-use examples for Node.js and browser applications. * `ekiden-ts-sdk` — Official TypeScript SDK for the Ekiden API. ### **Institutional Support** For advanced needs such as colocated execution, higher rate limits, or custom infrastructure, Ekiden offers private connectivity and priority support. For access and assistance, reach out to our team directly on Discord. ### **Next Steps** The following sections provide comprehensive API specifications, endpoint documentation, and integration examples to help you onboard quickly and confidently. # Get Leaderboard Source: https://docs.ekiden.fi/api-reference/leaderboard/get-leaderboard /api-reference/openapi.json get /api/v1/user/leaderboard Paginated subaccount leaderboard ranked by PnL. Realized + unrealized (mark-to-market). Timeframe required: today, 7d, 30d, all. Default limit 10, max 100. # Get Leaderboard Placement Source: https://docs.ekiden.fi/api-reference/leaderboard/get-leaderboard-placement /api-reference/openapi.json get /api/v1/user/leaderboard/placement Placement(s) for the authenticated user. When sub_account is omitted, returns one entry per user trading subaccount; otherwise exactly one entry. When the user has no trading subaccounts, data is an empty array. If the account is not ranked, ranked is false and place is "0". # Get ADL Alert History Source: https://docs.ekiden.fi/api-reference/market/get-adl-alert-history /api-reference/openapi.json get /api/v1/market/adl-alert/history Get archived ADL alert snapshots for one symbol or all pools. # Get ADL Alerts Source: https://docs.ekiden.fi/api-reference/market/get-adl-alerts /api-reference/openapi.json get /api/v1/market/adl-alert Get the latest ADL alert snapshot for one symbol or all pools. # Get apiv1marketinstruments info Source: https://docs.ekiden.fi/api-reference/market/get-apiv1marketinstruments-info /api-reference/openapi.json get /api/v1/market/instruments-info # Get Funding Rate History Source: https://docs.ekiden.fi/api-reference/market/get-funding-rate-history /api-reference/openapi.json get /api/v1/market/funding/history Query for historical funding rates. Each symbol has a different funding interval. For example, if the interval is 8 hours and the current time is UTC 12, then it returns the last funding rate, which settled at UTC 8. # Get Index Price Kline Source: https://docs.ekiden.fi/api-reference/market/get-index-price-kline /api-reference/openapi.json get /api/v1/market/index-price-kline Query for historical index price klines. Charts are returned in groups based on the requested interval. # Get Insurance Pool Source: https://docs.ekiden.fi/api-reference/market/get-insurance-pool /api-reference/openapi.json get /api/v1/market/insurance-pool Get the latest insurance pool snapshot for one symbol or all pools. # Get Insurance Pool History Source: https://docs.ekiden.fi/api-reference/market/get-insurance-pool-history /api-reference/openapi.json get /api/v1/market/insurance-pool/history Get archived insurance pool snapshots for one symbol or all pools. # Get Kline Source: https://docs.ekiden.fi/api-reference/market/get-kline /api-reference/openapi.json get /api/v1/market/kline Query for historical klines (also known as candles/candlesticks). Charts are returned in groups based on the requested interval. # Get Long Short Ratio Source: https://docs.ekiden.fi/api-reference/market/get-long-short-ratio /api-reference/openapi.json get /api/v1/market/account-ratio This refers to the net long and short positions as percentages of all position holders during the selected time. Long account ratio = Number of holders with long positions / Total number of holders Short account ratio = Number of holders with short positions / Total number of holders Long-short account ratio = Long account ratio / Short account ratio # Get Mark Price Kline Source: https://docs.ekiden.fi/api-reference/market/get-mark-price-kline /api-reference/openapi.json get /api/v1/market/mark-price-kline Query for historical mark price klines. Charts are returned in groups based on the requested interval. # Get Open Interest Source: https://docs.ekiden.fi/api-reference/market/get-open-interest /api-reference/openapi.json get /api/v1/market/open-interest Get historical open interest snapshots for one symbol. Values are returned as closed interval buckets sorted newest first. # Get Order Price Limit Source: https://docs.ekiden.fi/api-reference/market/get-order-price-limit /api-reference/openapi.json get /api/v1/market/price-limit Query for order price limit parameters. # Get Orderbook Source: https://docs.ekiden.fi/api-reference/market/get-orderbook /api-reference/openapi.json get /api/v1/market/orderbook Query for orderbook depth data. # Get Recent Trades Source: https://docs.ekiden.fi/api-reference/market/get-recent-trades /api-reference/openapi.json get /api/v1/market/recent-trade Query for recent public trades, optionally filtered by symbol. # Get Risk Limit Source: https://docs.ekiden.fi/api-reference/market/get-risk-limit /api-reference/openapi.json get /api/v1/market/risk-limit Query for the risk limit margin parameters. # Get Stats Source: https://docs.ekiden.fi/api-reference/market/get-stats /api-reference/openapi.json get /api/v1/market/stats Query for period-filtered turnover, trades, open interest, and per-market stats. # Get Stats Volume Source: https://docs.ekiden.fi/api-reference/market/get-stats-volume /api-reference/openapi.json get /api/v1/market/stats/volume Query for turnover time series and 24h/7d/30d/all_time aggregates. # Get Tickers Source: https://docs.ekiden.fi/api-reference/market/get-tickers /api-reference/openapi.json get /api/v1/market/tickers Query for the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours. # Get Closed PnL Source: https://docs.ekiden.fi/api-reference/position/get-closed-pnl /api-reference/openapi.json get /api/v1/position/closed-pnl Query user's closed profit and loss records # Get Position Info Source: https://docs.ekiden.fi/api-reference/position/get-position-info /api-reference/openapi.json get /api/v1/position/list Query real-time position data, such as position size, cumulative realized PNL, etc. # Set leverage Source: https://docs.ekiden.fi/api-reference/position/set-leverage /api-reference/openapi.json post /api/v1/position/set-leverage Set leverage for a symbol # Set Trading Stop Source: https://docs.ekiden.fi/api-reference/position/set-trading-stop /api-reference/openapi.json post /api/v1/position/trading-stop Set the take profit, stop loss or trailing stop for the position. # Rate Limits Source: https://docs.ekiden.fi/api-reference/rate-limits Ekiden enforces uniform rate limits across all API endpoints to ensure fair usage and system stability. Rate limiting prevents any single client from overloading the platform, so all users experience a consistent, high-performance trading API. > **Note:** All rate limits are subject to change as we balance demand and reliability. Ekiden may adjust these limits over time to maintain optimal performance. ## Rate Limit Policy Ekiden’s REST API rate limits apply **globally** – there is a single limit on requests across all endpoints. * **Global request limit:** **100 requests per 10 seconds** (aggregate across all REST endpoints). Brief bursts above this are tolerated, but sustained requests beyond this threshold will be rejected. * **Enforcement scope:** * **Public (unauthenticated) endpoints:** Tracked per **IP address**. * **Private (authenticated) endpoints:** Tracked per **API key** *and* per **IP address**. * **Behavior on exceedance:** * Response: **HTTP 429 – Too Many Requests** * Error code: `2003` * Message: `"Rate limit exceeded"` * **Rate limit headers:** * `Retry-After`- number of seconds to wait before retrying (typically **60 seconds**).\ Clients **must** pause requests until the indicated time has passed. ## Best Practices * **Throttle requests:** Ensure you do not exceed 100 requests in any rolling 10-second window. * **Use WebSockets for real-time data:** Ideal for high-frequency updates instead of frequent REST polling. * **Handle 429 responses gracefully:** * Respect the `Retry-After` header. * Wait the specified time before retrying. * **`Check for error code 2003:`** Helps your application identify rate limit issues. * **Need higher limits?**\ Contact the Ekiden team (e.g., via Discord) for options like colocated infrastructure and custom limits. ## Example: 429 Rate Limit Exceeded ```http theme={null} HTTP/1.1 429 Too Many Requests Content-Type: application/json Retry-After: 60 { "error_code": 2003, "error_message": "Rate limit exceeded" } ``` # Get system configuration and discovery info Source: https://docs.ekiden.fi/api-reference/system/get-system-configuration-and-discovery-info /api-reference/openapi.json get /api/v1/info # Amend Order Source: https://docs.ekiden.fi/api-reference/trade/amend-order /api-reference/openapi.json post /api/v1/order/amend Amend an existing order # Batch Amend Orders Source: https://docs.ekiden.fi/api-reference/trade/batch-amend-orders /api-reference/openapi.json post /api/v1/order/amend-batch Amend multiple existing orders in a single request # Batch Cancel Orders Source: https://docs.ekiden.fi/api-reference/trade/batch-cancel-orders /api-reference/openapi.json post /api/v1/order/cancel-batch Cancel multiple existing orders in a single request # Batch Place Orders Source: https://docs.ekiden.fi/api-reference/trade/batch-place-orders /api-reference/openapi.json post /api/v1/order/place-batch Create multiple new orders in a single request # Cancel All Orders Source: https://docs.ekiden.fi/api-reference/trade/cancel-all-orders /api-reference/openapi.json post /api/v1/order/cancel-all Cancel all existing orders for a sub-account. Optionally filtered by symbol; omit symbol to cancel open orders across all markets. # Cancel Order Source: https://docs.ekiden.fi/api-reference/trade/cancel-order /api-reference/openapi.json post /api/v1/order/cancel Cancel an existing order # Get Open & Closed Orders Source: https://docs.ekiden.fi/api-reference/trade/get-open-&-closed-orders /api-reference/openapi.json get /api/v1/order/realtime Primarily query unfilled or partially filled orders in real-time, but also supports querying recent 500 closed status (Cancelled, Filled) orders. Please see the usage of request param open_only. # Get Order History Source: https://docs.ekiden.fi/api-reference/trade/get-order-history /api-reference/openapi.json get /api/v1/order/history Query order history. As order creation/cancellation is asynchronous, the data returned from this endpoint may delay. # Get Trade History Source: https://docs.ekiden.fi/api-reference/trade/get-trade-history /api-reference/openapi.json get /api/v1/execution/list Query users' execution records, sorted by execTime in descending order. # Place Order Source: https://docs.ekiden.fi/api-reference/trade/place-order /api-reference/openapi.json post /api/v1/order/place Create a new order # `POST /user/season-claim/redeem` — verifies a season-claim voucher issued by the testnet side and redeems it (merging the testnet root's XP into the caller's mainnet account), or dry-runs the entitlement when `preview` is set. Root-only, same as the issue side. Source: https://docs.ekiden.fi/api-reference/user/`post-userseason-claimredeem`-—-verifies-a-season-claim-voucher-issuedby-the-testnet-side-and-redeems-it-merging-the-testnet-roots-xp-intothe-callers-mainnet-account-or-dry-runs-the-entitlement-when`preview`-is-set-root-only-same-as-the-issue-side /api-reference/openapi.json post /api/v1/user/season-claim/redeem # `POST /user/season-claim/voucher` — issues a short-lived, server-signed voucher attesting the caller's testnet root address. Root-only: a signed bearer proof of the wallet's identity is only meaningful for the wallet that owns it. Source: https://docs.ekiden.fi/api-reference/user/`post-userseason-claimvoucher`-—-issues-a-short-lived-server-signedvoucher-attesting-the-callers-testnet-root-address-root-only:-a-signedbearer-proof-of-the-wallets-identity-is-only-meaningful-for-the-walletthat-owns-it /api-reference/openapi.json post /api/v1/user/season-claim/voucher # Authorize User Source: https://docs.ekiden.fi/api-reference/user/authorize-user /api-reference/openapi.json post /api/v1/authorize Authorize and obtain an access token # Delete apiv1authorizewhitelist Source: https://docs.ekiden.fi/api-reference/user/delete-apiv1authorizewhitelist /api-reference/openapi.json delete /api/v1/authorize/whitelist/{root_address} # Delete apiv1userapi keys Source: https://docs.ekiden.fi/api-reference/user/delete-apiv1userapi-keys /api-reference/openapi.json delete /api/v1/user/api-keys/{id} # Delete apiv1userreferral codes Source: https://docs.ekiden.fi/api-reference/user/delete-apiv1userreferral-codes /api-reference/openapi.json delete /api/v1/user/referral-codes/{code_id} # Get apiv1authorizewhitelistcheck Source: https://docs.ekiden.fi/api-reference/user/get-apiv1authorizewhitelistcheck /api-reference/openapi.json get /api/v1/authorize/whitelist/check # Get apiv1useraccess Source: https://docs.ekiden.fi/api-reference/user/get-apiv1useraccess /api-reference/openapi.json get /api/v1/user/access # Get apiv1useraffiliate Source: https://docs.ekiden.fi/api-reference/user/get-apiv1useraffiliate /api-reference/openapi.json get /api/v1/user/affiliate # Get apiv1userapi keys Source: https://docs.ekiden.fi/api-reference/user/get-apiv1userapi-keys /api-reference/openapi.json get /api/v1/user/api-keys # Get apiv1usercompetitions Source: https://docs.ekiden.fi/api-reference/user/get-apiv1usercompetitions /api-reference/openapi.json get /api/v1/user/competitions # Get apiv1usercompetitions leaderboard Source: https://docs.ekiden.fi/api-reference/user/get-apiv1usercompetitions-leaderboard /api-reference/openapi.json get /api/v1/user/competitions/{competition_id}/leaderboard # Get apiv1usercompetitions placement Source: https://docs.ekiden.fi/api-reference/user/get-apiv1usercompetitions-placement /api-reference/openapi.json get /api/v1/user/competitions/{competition_id}/placement # Get apiv1userinvite codes Source: https://docs.ekiden.fi/api-reference/user/get-apiv1userinvite-codes /api-reference/openapi.json get /api/v1/user/invite-codes # Get apiv1userquests Source: https://docs.ekiden.fi/api-reference/user/get-apiv1userquests /api-reference/openapi.json get /api/v1/user/quests # Get apiv1userreferral Source: https://docs.ekiden.fi/api-reference/user/get-apiv1userreferral /api-reference/openapi.json get /api/v1/user/referral # Get apiv1userreferral codes Source: https://docs.ekiden.fi/api-reference/user/get-apiv1userreferral-codes /api-reference/openapi.json get /api/v1/user/referral-codes # Get apiv1userrewards Source: https://docs.ekiden.fi/api-reference/user/get-apiv1userrewards /api-reference/openapi.json get /api/v1/user/rewards # Get Root Account Source: https://docs.ekiden.fi/api-reference/user/get-root-account /api-reference/openapi.json get /api/v1/user/root-account Return the Root Account address for the current user # Get Sub Accounts Source: https://docs.ekiden.fi/api-reference/user/get-sub-accounts /api-reference/openapi.json get /api/v1/user/sub-accounts List Sub Accounts under the Root Account # Post apiv1referralclick Source: https://docs.ekiden.fi/api-reference/user/post-apiv1referralclick /api-reference/openapi.json post /api/v1/referral/click # Post apiv1useraccessactivate Source: https://docs.ekiden.fi/api-reference/user/post-apiv1useraccessactivate /api-reference/openapi.json post /api/v1/user/access/activate # Post apiv1userapi keys Source: https://docs.ekiden.fi/api-reference/user/post-apiv1userapi-keys /api-reference/openapi.json post /api/v1/user/api-keys # Post apiv1userinvite codes Source: https://docs.ekiden.fi/api-reference/user/post-apiv1userinvite-codes /api-reference/openapi.json post /api/v1/user/invite-codes # Post apiv1userquests claim Source: https://docs.ekiden.fi/api-reference/user/post-apiv1userquests-claim /api-reference/openapi.json post /api/v1/user/quests/{quest_id}/claim # Post apiv1userreferral Source: https://docs.ekiden.fi/api-reference/user/post-apiv1userreferral /api-reference/openapi.json post /api/v1/user/referral # Post apiv1userreferral codes Source: https://docs.ekiden.fi/api-reference/user/post-apiv1userreferral-codes /api-reference/openapi.json post /api/v1/user/referral-codes # Provision Canton OIDC Ledger User Source: https://docs.ekiden.fi/api-reference/user/provision-canton-oidc-ledger-user /api-reference/openapi.json post /api/v1/authorize/provision Verify an OIDC id_token and ensure a Ledger API user/party exists for its `sub` # Put apiv1authorizewhitelist Source: https://docs.ekiden.fi/api-reference/user/put-apiv1authorizewhitelist /api-reference/openapi.json put /api/v1/authorize/whitelist/{root_address} # Private Source: https://docs.ekiden.fi/api-reference/websockets/private Account streams — orders, positions, executions, balances. **Path:** `/ws/private` Authenticate with JWT or API key before subscribing. # Public Source: https://docs.ekiden.fi/api-reference/websockets/public Market data streams — order book, trades, tickers, klines. **Path:** `/ws/public` No authentication required. # Architecture Source: https://docs.ekiden.fi/architecture Ekiden's architecture provides speed, transparency, and resilience through a hybrid design that balances off-chain performance with on-chain trust. It operates across three key layers: Client, Infrastructure and Smart contract layer. ## 1. Client Layer The Client Layer is the entry point for all user interactions. Users engage with the platform through: * **Non-Custodial Canton Wallet** – Users maintain full control of their assets. * **Ekiden CLOB dApp** – Interface to submit orders and view the order book. * **Ekiden API** – Programmatic trading access for algorithmic strategies. * **Submit Orders** – Market and limit order support. * **Deposit/Withdraw** – Vault-based funds management. ## 2. Infrastructure Layer Handles all off-chain operations for high-speed trading. * **Engine Service** – Validates orders, manages active trading state, matches orders, evaluates triggers, and handles liquidation logic. * **Orderbook Root Hash** – Anchored on-chain for transparency. * **Inclusion Proofs** – Merkle proofs provide auditability. ## 3. Smart Contract Layer Runs on Canton to ensure onchain settlement and state integrity. * **Orderbook Verifier** – Validates trades using Merkle proofs. * **Clearinghouse** – Manages collateral and finalizes trades. * **Position Registry** – Tracks open positions, supports withdrawals. * **Vaults** – Modular and secure fund storage. * **State Updates** – Settlements and balances are updated on-chain. ## Hybrid Design Ekiden’s architecture combines: * **Off-chain speed** – Fast matching, low latency, and scalable infrastructure. * **On-chain integrity** and Privacy anchored on Canton. This hybrid model delivers the performance of centralized exchanges with the security and control of DeFi platforms. # Authentication Source: https://docs.ekiden.fi/authentication Authentication is required only for the private WebSocket endpoint. Ekiden supports two authentication methods: * **JWT Access Token** — recommended for authenticated user sessions. * **API Key** — recommended for server-side applications, trading bots, and automated integrations. *** ## JWT Authentication Authenticate by sending an **Auth** message. | Field | Value | | - | - | | `op` | `auth` | | `bearer` | Your JWT access token | | `req_id` | Optional correlation identifier | ```json theme={null} { "op": "auth", "bearer": "", "req_id": "1" } ``` See the **Auth** message in the [**Private WebSocket Reference**](./api-reference/websockets/private) for the complete request and response schema. *** ## API Key Authentication Unlike the REST API, WebSocket API key authentication uses a dedicated signing payload. **Signing payload** ```text theme={null} EKIDEN_WS|AUTH|{timestamp_ms}|{nonce} ``` | Step | Description | | - | - | | 1 | Generate `timestamp_ms` (Unix time in milliseconds) and a unique `nonce`. | | 2 | Generate an Ed25519 signature using your API private key. | | 3 | Send an `auth_api_key` message to the private WebSocket (`/ws/private`). | ```json theme={null} { "op": "auth_api_key", "api_key": "0x...", "signature": "0x...", "timestamp_ms": 1700000000000, "nonce": "unique-nonce", "req_id": "1" } ``` ### Validation Rules | Rule | Description | | - | - | | Clock skew | ±30 seconds from server time | | Nonce | Must be unique per API key | | Scopes | The API key must allow access to the requested private topics | See the **AuthApiKey** message in the [**Private WebSocket Reference**](./api-reference/websockets/private) for the complete request format and response schema. # Connection Source: https://docs.ekiden.fi/connection Connect to the Ekiden WebSocket API. The Ekiden WebSocket API provides separate endpoints for public market data and private account events. ## Environments | Environment | Public Endpoint | Private Endpoint | | - | - | - | | **Mainnet** | `wss://api.ekiden.fi/ws/public` | `wss://api.ekiden.fi/ws/private` | | **Staging** | `wss://api.testnet.ekiden.fi/ws/public` | `wss://api.testnet.ekiden.fi/ws/private` | | **Testnet** | `wss://api.cnt.ekiden.fi/ws/public` | `wss://api.cnt.ekiden.fi/ws/private` | > **Note** > > Always use REST and WebSocket endpoints from the same environment. Authentication credentials issued by one environment cannot be used with another. ## Public Endpoint The public endpoint provides unauthenticated access to real-time market data. ## Private Endpoint The private endpoint provides access to authenticated account events and requires successful authentication before subscribing to private topics. Authentication is supported using either a **JWT access token** or an **API key**. See the **Authentication** guide for details. ## Connection Lifecycle A typical WebSocket session consists of the following steps: 1. Connect to the appropriate endpoint. 2. Authenticate (private endpoint only). 3. Subscribe to one or more topics. 4. Receive and process real-time events. 5. Maintain the connection using Ping/Pong messages. Detailed channel definitions, message schemas, and payload formats are available in the [**WebSocket Reference Public**](./api-reference/websockets/public) and [**WebSocket Reference Private**](./api-reference/websockets/private). # Fees Source: https://docs.ekiden.fi/fees Ekiden is built for serious traders. Our fee structure is designed to reward both volume and liquidity. If you’re trading size or consistently making markets, you’ll benefit from lower costs and in many cases, get paid to provide liquidity. Fees are calculated using a standard maker-taker model, with rates determined by your 30-day notional volume. Maker rebates kick in at higher tiers, and market share incentives offer additional rewards for dominating individual perp markets. All fee logic is transparent, predictable, and optimized for performance. > [!NOTE] > > During the Private Mainnet period, we lower the fees, making them as low as **0.01% for the maker**, **0.0350% for the taker**, which corresponds to the standard \$10M+ tier. ## Fee Tiers Fees are based on your **rolling 30-day notional volume**. Maker fees drop to zero and eventually negative as volume increases. Taker fees are flat or reduced at higher tiers. | 30-Day Volume | Maker Fee | Taker Fee | | - | - | - | | \$0+ | 0.0200% | 0.0500% | | \$2.5M+ | 0.0150% | 0.0450% | | \$5M+ | 0.0125% | 0.0400% | | \$10M+ | 0.0100% | 0.0350% | | \$20M+ | 0.0075% | 0.0300% | | \$30M+ | 0.0050% | 0.0250% | | \$50M+ | 0.0030% | 0.0200% | | \$75M+ | 0.0015% | 0.0150% | | \$100M+ | 0.0000% | 0.0125% | | \$250M+ | -0.0015% | 0.0100% | | \$500M+ | -0.0030% | 0.0100% | | \$1B+ | -0.0050% | 0.0100% | * Volume is calculated across all perpetuals. * Tiers update in real time and apply immediately. * Negative maker fees = rebate paid on execution. ## Market Share Rebates If your maker volume accounts for a meaningful share of a specific market, you’ll earn additional rebates on top of your tier. | Maker Share (per market) | Extra Maker Rebate | | - | - | | ≥ 0.5% | -0.001% | | ≥ 1.0% | -0.002% | | ≥ 3.0% | -0.003% | * Evaluated per contract. * Stacks with volume-based rebates. * Applied automatically. Ekiden fees are designed to scale with performance. High-volume and high-share makers get rewarded. No fluff, no delays just better execution economics. # Getting Started with Ekiden Source: https://docs.ekiden.fi/getting-started Create your account, activate access, bridge funds to Canton, and fund your Trading Account. This guide takes you from your first sign-in to a funded Trading Account, ready to use on the [Ekiden exchange](https://app.ekiden.fi). > [!NOTE] > > Ekiden operates on mainnet. Depending on your access status, an access code may be required before trading becomes available. ## Before you begin * Use the [Ekiden app](https://app.ekiden.fi) to create or sign in to your account. * Have your access code ready if access has not yet been activated. * Use a source wallet and an asset or network shown as supported in the in-app deposit flow. * Review the destination account before you submit a bridge transaction. > [!WARNING] > > Always confirm that the Canton recipient displayed by Ekiden belongs to the account you intend to fund. Transactions sent to a different recipient cannot be reassigned automatically. ## 1. Create an account or log in Open the [Ekiden app](https://app.ekiden.fi) and select **Connect**. Choose one of the available sign-in methods: * **Google** is the fastest option for a new account. Your Party ID is provisioned during the sign-in flow; no browser extension is required. * **Console Wallet** is available if you already use a Canton wallet. ![Sign In](https://mintcdn.com/ekiden/VOZaw5z7fTrlUsvR/images/sign_in-1.png?fit=max\&auto=format\&n=VOZaw5z7fTrlUsvR\&q=85\&s=65da9aa56b5b4223c089884f269557fb) ## 2. Find and share your Party ID If your account is not yet enabled, you may see a **Not on the access list** screen. Your Party ID is shown at the bottom. 1. Find **Your party ID** — it begins with ekiden-. 2. Select the copy icon. 3. Send the Party ID to your Ekiden contact or the team handling your access. ![Party Id](https://mintcdn.com/ekiden/fd3OdW6JEWt6p8ma/images/party_id.png?fit=max\&auto=format\&n=fd3OdW6JEWt6p8ma\&q=85\&s=232d984d7c3b30c3b254e4c735ef00c2) ## 3. Activate access When your account has been approved, enter the access code you receive. 1. Enter the code on the access screen. 2. Select **Activate**. 3. After activation, continue to the funding flow. ![Activate Access](https://mintcdn.com/ekiden/PYvoeo_d6XORFNuI/images/activate_-access.png?fit=max\&auto=format\&n=PYvoeo_d6XORFNuI\&q=85\&s=8ce22d3fae64f256b6b9a89a0c43003b) ## 4. Open Deposit/Withdraw In the app, open **Deposit/Withdraw** and select **EVM to Canton Bridge**. 1. Connect the source wallet you want to fund from. 2. Choose the source network and the asset shown in the flow. 3. Enter the amount you want to bridge. 4. Check the Canton recipient shown for your Ekiden account before continuing. ![EVM to Canton Bridge form](https://mintcdn.com/ekiden/L_D2iR5D3ri2Fk-Y/images/deposit.png?fit=max\&auto=format\&n=L_D2iR5D3ri2Fk-Y\&q=85\&s=6cf41a7dd97fb603b04855b108dff3f9) ## 5. Approve and submit the bridge transaction Your wallet may ask you to approve the asset before the bridge can transfer it. 1. Confirm the recipient and amount again. 2. Approve the token in your wallet when prompted. 3. Submit the bridge transaction. ![Wallet approval for bridge](https://mintcdn.com/ekiden/e_QUnHC8CNqqjdGg/images/bridge.png?fit=max\&auto=format\&n=e_QUnHC8CNqqjdGg\&q=85\&s=40237f0406f931826e25aac0fc0e6123) ## 6. Wait for the deposit and fund your Trading Account After the bridge transaction is submitted, wait for the balance to arrive in Ekiden. Once it is credited: 1. Open your account balances. 2. Move the amount you intend to use for margin from your **Funding Account** to your **Trading Account**. 3. Confirm the transfer before placing an order. ![Bridge submitted status](https://mintcdn.com/ekiden/8WyeQdb_ONeKtzzS/images/submitted-4.png?fit=max\&auto=format\&n=8WyeQdb_ONeKtzzS\&q=85\&s=88f4ab6b4bdbdb50ce8102a968a7ee9e) > [!NOTE] > > The EVM to Canton Bridge is one available funding route. Use the deposit method and assets currently offered in the app for your account. ## Funding Account and Trading Account | Account | What it is used for | | - | - | | **Funding Account** | Holds assets after they arrive on Ekiden. | | **Trading Account** | Holds the margin available for your positions and orders. | ## 7. Start trading Once the Trading Account is funded, open the [Trading Guide](/trade) to choose a market, set leverage, and place an order. > [!TIP] > > Start with an amount you are comfortable using. Perpetual futures can use leverage and involve risk. ## Need help? For access issues, provide your Party ID and a screenshot of the screen you see to your Ekiden contact. For deposit or bridge issues, include the transaction status or transaction reference. For product issues, use **Share feedback** in the app. # Introduction Source: https://docs.ekiden.fi/index ![Intro](https://mintcdn.com/ekiden/yPa4c5HfrCKZE82i/images/Intro.jpg?fit=max\&auto=format\&n=yPa4c5HfrCKZE82i\&q=85\&s=151c8cbebc15ef264c0dace77b5e6a5c) Ekiden is infrastructure for tokenized derivative markets on [Canton Network](https://www.canton.network/). It provides an orderbook-based venue for perpetual futures, combining off-chain matching with deferred on-chain settlement. Ekiden is designed for traders, market makers, and teams that need low-latency execution, transparent market structure, and programmable access to a derivatives venue. ## How Ekiden works * **Central Limit Orderbook (CLOB)** — orders are matched off-chain for responsive price discovery and execution. * **Deferred on-chain settlement** — batched updates are settled on Canton, balancing throughput with verifiability. * **Merkle-based proofs** — order and position data can be verified through cryptographic commitments. * **Self-custody** — users retain control of their assets while trading through the platform. Read the [Architecture guide](/architecture) for a deeper explanation of Ekiden's design. ## Built for active markets Ekiden supports perpetual futures trading with a maker–taker fee model, account and position management, and tools for active traders. Market makers and algorithmic traders can integrate through the [API Reference](/api-reference/introduction) and real-time WebSocket feeds. See [Fees](/fees), the [VIP Program](/vip-program), and the [Trading Guide](/trade) for product details. ## Get started 1. [Open the Ekiden app](https://app.ekiden.fi). 2. Complete onboarding and fund your trading account. 3. Review the [Trading Guide](/trade) before placing your first order. 4. Visit the [Referral Program](/untitled-page) or [Points Program](/points-program) to learn about access and rewards. # Message Format Source: https://docs.ekiden.fi/message-format Overview of WebSocket message types and structure. All WebSocket messages are exchanged as JSON objects. Every message includes an `op` field that identifies the operation or message type. The optional `req_id` field can be used to correlate client requests with their corresponding server responses. *** ## Client → Server | Operation | Purpose | | - | - | | `auth` | Authenticate using a JWT access token | | `auth_api_key` | Authenticate using an API key | | `subscribe` | Subscribe to one or more topics | | `unsubscribe` | Unsubscribe from one or more topics | | `ping` | Keep the connection alive and measure round-trip latency | Example: ```json theme={null} { "op": "subscribe", "args": ["ticker.BTC-USDCx"], "req_id": "2" } ``` *** ## Server → Client | Operation | Purpose | | - | - | | `auth` | Authentication result | | `subscribed` | Subscription confirmation | | `unsubscribed` | Unsubscription confirmation | | `pong` | Response to a `ping` message | | `error` | Error response | | `event` | Real-time event payload | *** ## Event Envelope All streaming updates are delivered using the following envelope: ```json theme={null} { "op": "event", "server_ts_ms": 1700000000000, "topic": "ticker.BTC-USDCx", "data": {} } ``` Order book events may also include a type field (snapshot vs delta). See the **Public WebSocket Reference** and **Private WebSocket Reference** for complete message schemas and payload definitions. # Overview Source: https://docs.ekiden.fi/overview Introduction to the Ekiden WebSocket API. The Ekiden WebSocket API enables real-time, event-driven communication over persistent WebSocket connections. It complements the REST API by streaming market data and account events with minimal latency. Ekiden provides two WebSocket endpoints: * **Public** — streams publicly available market data, including order books, trades, tickers, candlesticks and other market events. * **Private** — streams authenticated account events, including order updates, executions, positions, balances, transfers, and other account-related events. The typical connection flow is: 1. Connect to the appropriate WebSocket endpoint. 2. Authenticate (private endpoint only). 3. Subscribe to one or more topics. 4. Receive real-time event updates. 5. Keep the connection alive using Ping/Pong messages. The following pages explain how to establish a connection, authenticate, and subscribe to topics. For complete channel definitions, message schemas, payload formats, and interactive examples, see the [**WebSocket Reference Public**](./api-reference/websockets/public) and [**WebSocket Reference Private**](./api-reference/websockets/private). # Earning XP Source: https://docs.ekiden.fi/points-program Learn how XP is earned from trading, holding positions, referrals, multipliers, and quests. XP is credited as you trade and hold positions. Trading XP appears in your account within about 30 seconds, while holding XP is credited every minute after a position becomes eligible. ## Four ways to earn > **Take liquidity** > > **10 XP per \$1 of taker fees paid** > > Every taker fill earns XP based on the fee you actually paid. > > ```text theme={null} > taker_xp = taker_fees_paid * 10 > ``` > **Make liquidity** > > **5 XP per \$1 of taker-equivalent fees** > > Maker fills earn XP based on what a taker would have paid for the same trade. You still earn when your maker fee is zero or receives a rebate. > > ```text theme={null} > maker_xp = taker_equivalent_fees * 5 > ``` > **Hold a position** > > **Up to 1 XP per \$1,000 held for one hour** > > Positions accrue XP every minute after they have been open for five minutes. The rate is adjusted by effective leverage. > **Refer traders** > > **15% / 10% / 5% of the XP earned by your network** > > Referral XP is paid three levels deep and added on top of the trader's reward. ## What that looks like A trader takes a \$5,000 position at a 0.1% taker fee, holds it for six hours at 3x effective leverage, then closes it. ```text theme={null} Taker fee $5,000 * 0.1% = $5.00 Trading XP $5.00 * 10 = 50 XP Risk factor 3x leverage / 10 = 0.3 Holding XP 5 units * 6 hours * 0.3 = 9 XP Total 59 XP L1 referral 59 * 15% = 8.85 XP Displayed referral XP 8 XP Fraction carried forward 0.85 XP ``` The trader keeps all 59 XP. The referral reward is added on top. > [!NOTE] > > **Small amounts are never lost.** XP is displayed as a whole number, but fractional XP is tracked precisely. Any remainder carries forward until it adds up. ## How holding XP works Holding XP rewards both position size and the risk carried. Two positions with the same notional can earn different amounts when they use different amounts of account equity. ```text theme={null} effective_leverage = position_notional / account_equity risk_factor = min(max(effective_leverage / 10, 0.1), 1) holding_xp = (position_notional / 1,000) * hours_held * risk_factor ``` | Rule | How it works | | - | - | | **Scales with leverage** | Holding XP increases with effective leverage and reaches the full rate at 10x and above. | | **Floor at low leverage** | Lower-leverage positions still earn at one tenth of the full rate. The risk factor never falls below `0.1`. | | **Five-minute minimum** | A position starts earning once it is five minutes old. The first five minutes are not credited retroactively. | | **Accrues every minute** | XP is credited while the position is open; you do not need to close it first. | | **Adding resets nothing** | Adding to a position keeps its age. Fully closing and reopening starts a new five-minute clock. | ## Referrals pay three levels deep When a referred trader earns XP, referral rewards travel up their chain for three levels. If a trader you referred earns 100 XP: | Level | Recipient | Relationship | Reward | | - | - | - | -: | | Earner | Your referral | Keeps every point earned | **100 XP** | | L1 | You | Referred the trader directly | **+15 XP** | | L2 | Your referrer | One level further up | **+10 XP** | | L3 | Their referrer | Final rewarded level | **+5 XP** | > [!NOTE] > > **Nobody pays for referral XP.** It is added on top. The trader keeps all the XP they earned, and no referral reward is deducted from another user's balance. | Rule | How it works | | - | - | | **Every source counts** | Referral rewards apply to XP earned from trading, holding, and quests - not only fees. | | **Bind once** | You can add one referrer after signing up. Once added, the referrer cannot be changed. Self-referrals are not allowed. | | **No cap** | There is no limit on the number of traders you can refer or the amount of referral XP you can earn. | ## Multipliers Some accounts receive an XP multiplier through the access code used to join or through a season conversion. | Rule | How it works | | - | - | | **The highest multiplier wins** | Multipliers do not stack. If an account has more than one, only the highest applies. | | **Applies to your own trading** | The multiplier boosts XP earned from your own fills and positions. | | **Your referrers benefit too** | Referral rewards are calculated after your multiplier is applied. | ## Quests Quests award a fixed amount of XP for completing a specific target. A quest can require you to: * Reach a trading-volume threshold. * Place a set number of trades. * Bring in your first active referral. Daily quests reset at midnight UTC. One-off quests can be completed once. Available quests and progress are shown on the quests page. ## Good to know | | | | - | - | | **When XP appears** | Trading XP appears within about 30 seconds. Holding XP is credited every minute while an eligible position is open. | | **Fees are the basis** | Trading XP is proportional to fees, not raw trading volume. | | **XP does not go down** | Losing a trade does not reduce your XP balance. | | **Market makers are excluded** | Designated market-maker and internal accounts do not earn XP. | | **One account, one chain** | XP and referrals belong to the root account, not individual sub-accounts. | Your XP total, referral link, and quest progress are available on the rewards page. # How Referrals & Rewards Work Source: https://docs.ekiden.fi/referrals-and-rewards Learn how Mainnet invite codes, referral XP, and affiliate commissions work on Ekiden. ![Referral Program overview](https://pbs.twimg.com/media/HSBCexQWcAA6bKC?format=jpg\&name=medium) The [Referral Program](https://app.ekiden.fi/referral) rewards you for introducing active traders to Ekiden. Your own trading activity unlocks Mainnet invite codes, while your referral network can earn you XP and affiliate commissions. ## Unlocking Mainnet invite codes Open the Referral section at [app.ekiden.fi/referral](https://app.ekiden.fi/referral). New accounts begin with no available invite codes. To unlock your first code, generate [\$1,000 of personal Mainnet trading volume](https://app.ekiden.fi/trades/). ![Invite Codes section](https://pbs.twimg.com/media/HSBAanQWUAoYr9w?format=jpg\&name=medium) Each \$1,000 in trading volume unlocks one Mainnet invite code, up to 50 codes. These are the same access codes used to enter Ekiden Mainnet, so you can share an unlocked code with a trader who needs access. ![Invite code example](https://pbs.twimg.com/media/HSBBccya8AA-wU4?format=jpg\&name=medium) Your referral link and Mainnet invite codes serve different purposes. The referral link is available immediately in the Referral Hub and identifies traders who join through you. Invite codes are used to unlock access to the exchange. ![Referral Hub](https://pbs.twimg.com/media/HSBA-enWEAUDPoo?format=jpg\&name=medium) ## 1. Earn XP through your referral network When people in your network trade and earn XP, you receive a percentage of their XP based on their position in your network: * **Level 1:** 15% * **Level 2:** 10% * **Level 3:** 5% Level 1 refers to a trader you invited directly. Someone invited by your Level 1 referral is Level 2, and the next layer is Level 3. As the network expands, activity beyond your direct invites can continue to contribute to your XP. ## 2. Earn affiliate commissions from referral trading Referral trading can also create affiliate commissions. You receive a share of the trading fees generated by your referrals: * **Level 1:** 40% * **Level 2:** 10% The affiliate dashboard shows pending commission, lifetime paid, downline size, and downline trading volume. Affiliate commissions are tracked and paid in USDCx. An active network can therefore contribute to both referral XP and affiliate commissions. ![Affiliate dashboard](https://pbs.twimg.com/media/HSBBGSaWsAAIwCN?format=jpg\&name=large) ## 3. Referrals can grow their own networks Your network can extend beyond the people you invite yourself. If a trader you refer invites another trader, that new trader becomes your Level 2 referral. If the Level 2 trader refers someone else, that person becomes Level 3 for you. Every trader has their own perspective in the network. A trader who is Level 2 for you can still build a direct Level 1 network of their own and receive the full Level 1 rewards for the traders they invite. Your rewards depend on the trader's depth in your network: * **XP:** 15% / 10% / 5% across Levels 1–3 * **Affiliate commissions:** 40% / 10% / 0% across Levels 1–3 This means a strong referral can develop their own community while continuing to create value for the network above them. ## 4. Share PnL to grow your network Sharing PnL on X can be part of your usual trading routine. When you share a PnL card, select the referral-sharing option to include your referral link in the post. Traders who join Ekiden through that link are attributed to your network. When those traders trade, their activity can contribute to your referral XP and, where applicable, affiliate commissions under the level structure above. ![PnL sharing with referral link](https://pbs.twimg.com/media/HSBBXDkXAAEZMab?format=jpg\&name=medium) ## Start trading and grow your network Trade on Mainnet to unlock invite codes: every \$1,000 of your own volume unlocks another code. Share those codes with traders who need Mainnet access, and use your referral link wherever you build your community. As referrals become active, they can add to your XP and affiliate commissions while building networks of their own. # Topics Source: https://docs.ekiden.fi/topics Available WebSocket topics. Clients receive real-time updates by subscribing to one or more topics. Topics are passed as strings in the `args` field of the **Subscribe** message and removed using the **Unsubscribe** message. A single WebSocket connection can maintain multiple active topic subscriptions simultaneously. *** ## Public Topics Public topics provide real-time market data and do not require authentication. | Topic Pattern | Example | Description | | - | - | - | | `orderbook.{depth}.{symbol}` | `orderbook.10.BTC-USDCx` | Order book snapshots and incremental updates | | `trade.{symbol}` | `trade.BTC-USDCx` | Public trade stream | | `ticker.{symbol}` | `ticker.BTC-USDCx` | 24-hour ticker updates | | `kline.{interval}.{symbol}` | `kline.1m.BTC-USDCx` | Candlestick (OHLCV) updates | | `all_liquidations.{symbol}` | `all_liquidations.BTC-USDCx` | Liquidation events | | `insurance_pool.{symbol}` | `insurance_pool.BTC-USDCx` | Insurance pool updates | | `adl_alert.{symbol}` | `adl_alert.BTC-USDCx` | ADL alert notifications | *** ## Private Topics Private topics require authentication and stream account-specific events. | Topic | Description | | - | - | | `order` | Order updates | | `position` | Position updates | | `execution` | Trade execution updates | | `account_balance` | Account balance updates | *** Examples, payload schemas, and message formats are available in the [**WebSocket Reference Public**](./api-reference/websockets/public) and [**WebSocket Reference Private**](./api-reference/websockets/private). # Trading on Ekiden Source: https://docs.ekiden.fi/trade Open and manage positions, set leverage and TP/SL, and use Portfolio, Stats, and Referral on Ekiden. This guide is for users who already have an Ekiden account and wallet connected. It covers placing trades, managing risk, and navigating the rest of the platform. > [!NOTE] > > If you haven't connected a wallet or funded a Trading Account yet, start with [Getting Started](./getting-started) first. ## Signing back in If your session has expired, reconnecting will prompt the **Terms of Use** modal again. Confirm both checkboxes and click **Agree and Sign** to resume trading. ![01 Terms Of Use](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/01-terms-of-use.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=847e1c8773d113f95e2a50f52b8c2a50) ## Funding your account Use **Get Test Tokens** to top up your Funding Account, then deposit into your Trading Account. A confirmation toast appears once the vault balance updates. ![02 Test Tokens](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/02-test-tokens.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=6847b494dd6db3e4082fa4b283716602) ## Order types and Time in Force, explained > [!NOTE] > > Ekiden's order panel has three order type tabs — **Limit**, **Market**, and **Stop Limit** — plus an **Advanced** section with **Reduce-Only** and a **Time in Force (TIF)** dropdown. That Advanced section is where any additional order types would live if the panel had them; it doesn't — it only exposes Reduce-Only and TIF. So functionally, these three order types (each combinable with the five TIF modifiers below and Reduce-Only) are the complete current set. ![14 Advanced Panel Tif Confirmed](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/14-advanced-panel-tif-confirmed.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=ccf90c4f33d35209536a29a886f4ab34) > **Limit — why use it** > > You set the exact price you're willing to trade at. The order sits on the book and only fills at your price or better. Use it when you want price certainty and are fine waiting (or not filling at all if the market never reaches your price). > **Market — why use it** > > You skip price selection entirely and fill immediately against the best available price(s) in the book. Use it when speed/certainty of execution matters more than price precision — at the cost of potential slippage on thin order books. > **Stop Limit — why use it** > > A **Limit** order that only becomes active once the market trades through a **trigger price** you set. Commonly used to enter on a breakout, or to defend a position (a defensive stop) without watching the screen — but unlike a plain stop-market, once triggered it still behaves like a Limit order, so in a fast-moving market it can be triggered and still not fill if price runs past your limit. > **Reduce-Only — why use it** > > Restricts the order to only reduce or close your existing position on that market — it can never open a new position or flip you to the opposite side, even if the size you enter would otherwise overshoot. Use it for exits and stop-losses where you want a hard guarantee you can't accidentally add exposure. > **Time in Force: GTC / IOC / FOK / PO / GTD — what each means** > > These control how long an order is allowed to rest and how it can be filled, independent of order type: > > * **GTC (Good Till Cancelled)** — stays open until it fills or you cancel it manually. The default for most traders. > * **IOC (Immediate Or Cancel)** — fills whatever portion it can immediately, cancels the rest. Avoids leaving a resting order on the book. > * **FOK (Fill Or Kill)** — must fill the entire size immediately or the whole order is cancelled. No partial fills. > * **PO (Post Only)** — guarantees your order only adds liquidity (maker), never removes it (taker); it's rejected instead of matching immediately. Used to guarantee maker fees instead of taker fees. > * **GTD (Good Till Date)** — like GTC, but auto-cancels at a specific date/time you set. ## Opening a position **1. Choose your order type and leverage** In the order panel, select **Limit**, **Market**, or **Stop Limit**, then set your leverage multiplier (e.g. `3x`). The available margin updates to reflect your buying power at that leverage. ![03 Leverage Select](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/03-leverage-select.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=01e3d8f0b83c4eec4e45897e13273aaf) **2. Adjust leverage in detail (optional)** Clicking the leverage value (e.g. `3x`) opens an **Adjust Leverage** modal with more control than the quick selector: * **Margin Mode: Cross** — in cross mode, all positions on your Trading Account share the same margin pool, so a loss on one position can be offset by available margin from the rest of the account. (Ekiden's UI currently shows Cross; an Isolated mode — where each position only risks the margin assigned to it specifically — is the typical alternative on perpetuals platforms, but wasn't observed in this flow.) * **Leverage slider / stepper** — drag or use +/− to pick a multiplier, up to the market's max (shown in the modal title, e.g. "Max: 15x"). Max leverage is set **per market**, not account-wide — a volatile asset will usually cap out lower than BTC. * **Max Position Value** — recalculates live as you change leverage, showing the largest position your current margin could open at that multiplier. ![13 Leverage Modal](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/13-leverage-modal.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=deb1886caed8f64dd81c5671760bd6f2) > [!WARNING] > > The modal explicitly warns: **"Leverage is set per-market. Changing it may affect your open position and orders on \[market]."** If you already have an open position on that market, raising or lowering leverage changes your liquidation price immediately — confirm the new **Max Position Value** and liquidation impact before clicking **Confirm**. Click **Confirm \[X]x Leverage** to apply. **3. Pick Long or Short and size your order** Toggle **Long** or **Short**, enter a size (or drag the percentage slider to use a portion of your available margin), and submit. Market orders fill immediately at the current price. **4. Confirm the position in your Positions table** Filled orders appear instantly in the **Positions** panel at the bottom of the screen, showing size, entry price, mark price, liquidation price, unrealized PnL, and funding. Each row has a **Close** button. ![04 Position Opened](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/04-position-opened.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=cd45cd01074260780b3f508bf3154a34) > [!TIP] > > **How PnL is calculated, conceptually:** Unrealized PnL compares your position's **entry price** to the current **mark price** (a smoothed reference price used for PnL and liquidation, not necessarily the last traded price), scaled by position size and direction (Long gains as mark price rises; Short gains as it falls). **Liquidation Price** is the mark price at which your posted margin would be fully consumed by losses — it moves closer to your entry price as leverage increases, which is why higher leverage means a smaller adverse move can liquidate you. **5. Switch markets to diversify** Use the market dropdown (top-left of the chart) to search and switch between trading pairs. Each row shows last price, 24h change, funding rate, 24h volume, and open interest. ![06 Market Switcher](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/06-market-switcher.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=60ff428f03bb531fad1a1eb153b9d4e2) Repeat the order flow on a new market to open additional positions — for example, a Long on `TSLA-USDTx` alongside your BTC short. ![05 Long Order Tsla](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/05-long-order-tsla.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=894ed8a842b90013c1aa53d83d84c2c6) ## Setting Take Profit / Stop Loss Open **TP/SL** on a position to define exit conditions without watching the market manually. ![07 Tpsl Modal 2](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/07-tpsl-modal-2.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=ceb4b7be985c3e188d085bb9def2fffc) **1. Set a Take Profit** Enter a **Take Profit Price** or a target **Gain %** — the other field calculates automatically. **2. Set a Stop Loss** Enter a **Stop Loss Price** or a maximum **Loss %**. **3. Confirm** Click **Confirm**. Your TP/SL levels appear inline in the Positions table and can be edited at any time via the pencil icon. > [!TIP] > > The order panel also exposes a **Time in Force** setting (`GTC`, `IOC`, `FOK`, `PO`, `GTD`) under **Advanced** — useful for controlling exactly how and when a limit order can fill. ## Tracking your account: Portfolio The **Portfolio** tab is your account command center. ![08 Portfolio Overview 1](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/08-portfolio-overview-1.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=a2bdfecdaf2ef335ba5988560b2bc5ca) It includes: * **Funding Account** and **Trading Account** balances, plus a **Health** indicator * **Account Performance**: 30-day volume, available margin, unrealized PnL, and all-time account PnL * **Points Breakdown**: trading points and referral points, viewable by 7D / 30D / All Time, with a countdown to the next points distribution * A unified **Positions** table, plus tabs for **Open Orders**, **Order History**, and **Trade History** ### Reviewing trade history The **Trade History** tab lists every fill — timestamp, market, side (Buy/Sell), price, size/value, and fee. ![09 Trade History](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/09-trade-history.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=7162bcce06b462c87f0ea5c90717173c) ## Platform-wide stats The **Stats** tab shows exchange-level metrics: 24h trading volume, active traders, total trades, and open interest, along with a per-market breakdown (price, 24h change, average funding, volume, and open interest). ![10 Stats Page](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/10-stats-page.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=b19f544ebf1d8d0df769082e9a93fc02) ## Referring other traders The **Referral** tab gives you a unique referral code and link to share, plus a live count of invited users. You can copy the link directly or share it to X in one click. ![11 Referral Hub](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/11-referral-hub.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=68c4df5db5b5c644c98b0b997584712d) ## Moving funds between accounts Use **Deposit/Withdraw → Transfer** to move USDCx between your **Funding Account** and **Trading Account** without leaving the app — for example, pulling margin back out of a Trading Account after closing positions. ![12 Transfer Funds](https://mintcdn.com/ekiden/GG3OMxTAeHEcXnzb/images/12-transfer-funds.png?fit=max\&auto=format\&n=GG3OMxTAeHEcXnzb\&q=85\&s=d3005438d64d410a4926509574fa5b31) **1. Open Deposit/Withdraw** Click **Deposit/Withdraw** in the top navigation bar. **2. Select the Transfer tab** Choose **Transfer**, then set **Withdraw from** and **Transfer to** accounts. **3. Enter an amount and confirm** Enter an amount (or click **Max**) and confirm — the destination balance updates immediately. ## Closing positions From either the Trade screen or the Portfolio Positions table, click **Close** on an individual position, or **Close All** to flatten every open position at once. # VIP Program Source: https://docs.ekiden.fi/vip-program Volume-based fee benefits and rewards for active Ekiden traders. The VIP program combines lower trading fees, maker rebates, and XP rewards. Fee tiers are based on rolling 30-day notional volume. XP rewards are allocated through the rewards system described in [Points Program](./points-program). ## Fee Tiers | 30-Day Volume | Maker Fee | Taker Fee | | - | - | - | | \$0+ | 0.0200% | 0.0500% | | \$2.5M+ | 0.0150% | 0.0450% | | \$5M+ | 0.0125% | 0.0400% | | \$10M+ | 0.0100% | 0.0350% | | \$20M+ | 0.0075% | 0.0300% | | \$30M+ | 0.0050% | 0.0250% | | \$50M+ | 0.0030% | 0.0200% | | \$75M+ | 0.0015% | 0.0150% | | \$100M+ | 0.0000% | 0.0125% | | \$250M+ | -0.0015% | 0.0100% | | \$500M+ | -0.0030% | 0.0100% | | \$1B+ | -0.0050% | 0.0100% | Volume is calculated across perpetual markets. Negative maker fees are rebates paid on execution. ## Market Share Rebates High-share makers can earn additional maker rebates per market. | Maker Share | Extra Maker Rebate | | - | - | | >= 0.5% | -0.001% | | >= 1.0% | -0.002% | | >= 3.0% | -0.003% | Market share rebates stack with volume-based maker fees. ## XP Rewards XP does not use a simple `notional / 1000 * multiplier` formula. Ekiden currently uses the backend `rewards_xp_mvp_v1` model: * A weekly XP pool is allocated pro rata. * Trading power score is based on eligible volume, ROI, and drawdown factor. * Referral bonuses add power score from up to three referral levels. * Ledger entries record the allocation reason and balance impact. XP is visible through rewards and leaderboard APIs once enabled for the user/account: * `GET /api/v1/user/rewards` * `GET /api/v1/user/referral` * `GET /api/v1/user/leaderboard` * `GET /api/v1/user/leaderboard/placement` ## Eligibility VIP benefits and XP rewards may exclude activity that is not economically meaningful or violates program rules, including wash trading, self-referral, circular referral activity, multi-account farming, or attempts to exploit campaign windows. ## Distribution Fee benefits apply through the trading fee schedule. XP allocations are recorded in the points ledger and surfaced through account rewards and leaderboard responses. Campaign-specific grants or adjustments should also be recorded through auditable ledger reasons. # CIP-0056 — Token Standard Source: https://docs.ekiden.fi/wallet/cip-0056 Canton token standard, supported token operations, and implementation limitations in Ekiden Wallet. CIP-0056 is how Canton tokens look the same to every wallet. It is a set of Daml interfaces plus optional registry HTTP APIs. It is not the API a website uses to connect. That is [CIP-0103](/wallet/cip-0103). Specification: [CIP-0056](https://github.com/canton-foundation/cips/blob/main/cip-0056/cip-0056.md). Wallet-oriented walkthrough: [Canton token standard](https://docs.canton.network/appdev/deep-dives/token-standard). ## The six APIs | API | Purpose | Ekiden wallet | | - | - | - | | Token metadata | Symbol, name, supply, registry URLs, icon | Catalog entries for Canton Coin (`Amulet`) and utility instruments (for example USDCx): symbol, name, icon, `kind` | | Holdings | Portfolio and history | Canton Coin via the Holding interface. Utility tokens via the utility holding template. Balances shown on Home | | Transfer instruction | Free-of-payment transfer | Send, and incoming offers the user can accept, reject, or withdraw. Factory choice for Canton Coin, transfer-offer / instruction contracts for utility tokens | | Allocation | Lock an asset for delivery-versus-payment | Not a general wallet screen. App-specific flows (trading margin) are separate from this API | | Allocation request | App asks a wallet to allocate | Not exposed to dApps as a CIP-0056 endpoint | | Allocation instruction | Wallet asks a registry to create an allocation | Not implemented as a generic registry call | A registry says which of these it supports. Ekiden treats Canton Coin (`kind: "amulet"`) and utility-registry instruments (`kind: "cip56"`) as the two kinds it knows how to display and send. ## How the wallet uses the standard The five patterns in the Canton wallet guide, and where they live: 1. **Read contracts that implement a token interface.** Holdings and incoming transfer instructions are read from active contracts (gateway and, for Canton Coin, the wallet backend ACS). 2. **Read transaction history.** The wallet UI is balance-and-offer oriented. It does not yet render a full CIP-0056 transaction history for every registry. 3. **Execute a factory choice.** Canton Coin sends fetch the transfer factory, then submit a signed batch. 4. **Execute a choice on an existing contract.** Accept, reject, or withdraw on a transfer instruction the user already holds. 5. **Custom Daml for bulk workflows.** Out of scope for the extension. Sends are one approval at a time. Private keys never go to the registry. The extension signs the prepared transaction hash. The participant co-signs where the workflow requires an operator (for example some preapproval accepts). ## What a dApp should not reimplement If a site only needs “user pays this party N of an instrument”, it should submit that as `prepareExecute` commands, or use the product’s own API, and let the wallet render the approval. Parsing holding interfaces in the page duplicates the wallet and breaks when a registry adds a package version. ## Gaps to keep visible in the public docs * No generic Allocation / Allocation Request UI. * No claim that every CIP-0056 registry on the network is listed. The wallet shows instruments it has a catalog entry for, plus holdings it can parse. * History is not the full token-standard transaction log. ## Token transfer flow CIP-0056 instruments the wallet knows how to move. The dApp is not on this path when the user sends from the extension UI. ```mermaid theme={null} flowchart LR subgraph read [Read] H[Holdings] M[Metadata] end subgraph send [Send] F[Transfer factory or existing instruction] A[User approves in the extension] S[Signed submission] end H --> F M --> F F --> A --> S ``` Canton Coin uses the Holding interface and the transfer-factory choice. Utility instruments use the utility holding and transfer-offer / transfer-instruction contracts. Allocation for delivery-versus-payment is not this chart. # CIP-0103 — dApp API Source: https://docs.ekiden.fi/wallet/cip-0103 Canton dApp API implementation, supported methods, events, errors, and limitations in Ekiden Wallet. CIP-0103 is the Canton standard a website uses to talk to a wallet. The machine-readable spec is the sync OpenRPC document in the Splice wallet kernel. This page is the Ekiden reading of that spec: what we implement, and the one method we refuse. Specification: [CIP-0103](https://github.com/canton-foundation/cips/blob/main/cip-0103/cip-0103.md). Browser discovery: [Canton docs — browser extension](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/wallet-providers/browser-extension). For visual explanations of wallet interactions, see: * [Discovery flow](#discovery-flow) — how a dApp discovers Ekiden Wallet. * [Connection flow](#connection-flow) — how a user authorizes a wallet connection. * [Transaction submission flow](#transaction-submission-flow) — how the wallet signs and submits transactions. ## Discovery The Canton SDK does not look for `window.ekidenWallet` or `window.canton`. It dispatches `canton:requestProvider` and collects `canton:announceProvider` for a few hundred milliseconds. Ekiden announces: | Field | Value | | - | - | | `id` | `ekiden-wallet` | | `name` | `Ekiden Wallet` | | `target` | `ekidenWallet` | The SDK’s provider id is `browser:ext:ekiden-wallet`. A dApp that does not want auto-discovery can register the extension itself: ```ts theme={null} import { ExtensionAdapter } from "@canton-network/dapp-sdk"; await sdk.init({ additionalAdapters: [ new ExtensionAdapter({ providerId: "browser:ext:ekiden-wallet", name: "Ekiden Wallet", target: "ekidenWallet", }), ], }); ``` `window.ekidenWallet` on the page is only a marker (`isEkiden`, `id`, `name`, `version`). Call the SDK, not that object. ### Discovery flow ```mermaid theme={null} sequenceDiagram participant App as dApp page participant SDK as Canton dApp SDK participant Ext as Ekiden content script App->>SDK: init() SDK->>App: canton:requestProvider Ext->>App: canton:announceProvider Note over Ext,App: id ekiden-wallet
target ekidenWallet SDK->>SDK: providerId browser:ext:ekiden-wallet ``` ## Wire protocol Requests and responses are `window.postMessage` frames. Request: ```json theme={null} { "type": "SPLICE_WALLET_REQUEST", "target": "ekidenWallet", "request": { "jsonrpc": "2.0", "id": "1", "method": "getPrimaryAccount", "params": {} } } ``` Success: ```json theme={null} { "type": "SPLICE_WALLET_RESPONSE", "target": "ekidenWallet", "response": { "jsonrpc": "2.0", "id": "1", "result": {} } } ``` Failure uses `response.error` with `{ code, message, data? }`. Events are the same request frame **without** `id`: ```json theme={null} { "type": "SPLICE_WALLET_REQUEST", "target": "ekidenWallet", "request": { "jsonrpc": "2.0", "method": "txChanged", "params": { "status": "executed", "commandId": "cmd-1", "payload": {} } } } ``` Frames whose `target` is set and is not `ekidenWallet` are ignored. ## Methods | CIP-0103 | Ekiden behavior | | - | - | | `connect` | Popup unless this origin is already connected. Requires an initialized, unlocked wallet and an account on the active network. Returns `{ isConnected: true, isNetworkConnected: true }` | | `disconnect` | Drops this origin. Emits `statusChanged` | | `isConnected` | Same fields as connect. Does not open a popup | | `status` | `connection`, `provider` (`id`, `version: "1.0.0"`, `providerType: "browser"`), `network.networkId`, `network.ledgerApi` (gateway URL). No `session.accessToken` | | `getActiveNetwork` | Network the user selected in the wallet. The dApp cannot change it | | `listAccounts` | Parties on that network. Each has `partyId`, `hint`, `publicKey`, `namespace`, `networkId`, `primary`, `signingProviderId`, `status` | | `getPrimaryAccount` | The party selected in the wallet | | `signMessage` | Popup, then a base64 Ed25519 signature of the primary party. Params: a string, `{ message: string }`, or `{ message: { hex \| base64 } }` | | `prepareExecute` | Popup, sign, submit. JSON-RPC **result is `null`**, as the spec requires. Progress is `txChanged`. The Ekiden SDK method of the same name still returns `{ tx }` for older callers | | `ledgerApi` | **Not implemented.** Error `4200`. See [Gaps](#gaps) | `prepareExecute` params are a JSON Ledger API prepare body: `commands` (required), plus optional `commandId`, `actAs`, `synchronizerId`, `disclosedContracts`. A nested `params.params` object is flattened. ### Connection flow ```mermaid theme={null} sequenceDiagram participant User participant App as dApp participant Ext as Ekiden Wallet User->>App: Click Connect App->>Ext: connect alt Origin not yet allowed Ext->>User: Approval popup User->>Ext: Approve end Ext->>App: isConnected true App->>Ext: getPrimaryAccount Ext->>App: partyId ``` ### Transaction submission flow ```mermaid theme={null} sequenceDiagram participant App as dApp participant Ext as Ekiden Wallet participant User participant Ledger as Canton App->>Ext: prepareExecute(commands) Ext-->>App: txChanged pending Ext->>User: Approval popup alt Rejected User->>Ext: Reject Ext-->>App: txChanged failed Ext-->>App: error 4001 else Approved User->>Ext: Approve Ext->>Ledger: sign and submit Ledger-->>Ext: updateId Ext-->>App: txChanged executed Note over App,Ext: CIP-0103 result is null.
Ekiden SDK prepareExecute returns tx. end ``` ## Events | Event | When | Payload | | - | - | - | | `accountsChanged` | Active party or network changes | Array of account objects | | `statusChanged` | Connect, disconnect, or the same account change | Status object (`connection`, `provider`, `network`) | | `txChanged` | `prepareExecute` lifecycle | `{ status, commandId, payload? }` | `txChanged.status` is `pending` (approval opened), `executed` (`payload.updateId`, `payload.completionOffset`), or `failed` (user rejected, or submit failed). Ekiden does not emit a separate `signed` event; signing and submit are one approval. ## Errors CIP-0103 uses the EIP-1193 / EIP-1474 codes. On the `SPLICE_WALLET_*` path Ekiden returns: | Code | When | | - | - | | `4001` | User rejected the popup | | `4100` | Origin is not connected, or the wallet is locked | | `4200` | Unknown method, or `ledgerApi` | | `-32602` | Invalid params (for example no `commands`) | | `-32603` | Anything else | The named Ekiden SDK methods (`ekidenWallet.connect`, …) still reject with `Error.message` and no code. `ekidenWallet.request` uses the codes above. ## Gaps ### `ledgerApi` CIP-0103 says a wallet should proxy the participant JSON Ledger API, authenticated as the connected party, and return the JSON body unchanged. Ekiden does not do that. The extension does not hold a participant token it can safely hand to a website, and it does not forward arbitrary HTTP to a validator. An open proxy would let any connected origin read or write anything that token allows. Use these instead: | Need | Call | | - | - | | Holdings | `getBalance` / `getCoinsBalance` on `@ekidenfi/dapp-sdk` | | Active contracts | `getContracts` | | Submit | `prepareExecute` | `request("ledgerApi", …)` fails with `4200` and `data.reason` explaining the same limit. ### Async API The remote CIP-0103 variant (`userUrl`, `connected` event) is for server-side wallets. Ekiden is in-page and synchronous. There is no `userUrl`. ### `signed` transaction event The spec allows `txChanged` with `status: "signed"` before submit. Ekiden signs inside `prepareExecute` and only emits `pending`, then `executed` or `failed`. ## Ekiden SDK and CIP-0103 together `@ekidenfi/dapp-sdk` is a thin client. * Named methods use Ekiden’s own `postMessage` types (`CONNECT`, `GET_ACTIVE_ACCOUNT`, `EXECUTE`, …). `prepareExecute` resolves `{ tx: { status, commandId, payload } }`. * `ekidenWallet.request(method, params)` and `ekidenWallet.on(event, listener)` use the CIP-0103 frames above. `request("prepareExecute", body)` resolves `null`. Prefer the named methods in an Ekiden-only app. Prefer `sdk.connect()` from `@canton-network/dapp-sdk` when the app should list every CIP-0103 wallet. # dApp Integration Source: https://docs.ekiden.fi/wallet/dapp-integration Connect your application to Ekiden Wallet using the Canton dApp SDK or Ekiden SDK. Two ways to connect. Use one. * The app should work with any CIP-0103 wallet: [Canton dApp SDK](#canton-dapp-sdk). * The app only supports Ekiden Wallet: [Ekiden SDK](#ekiden-sdk). Connect from a click. Do not call `connect` on page load. ## Canton dApp SDK ```bash theme={null} npm install @canton-network/dapp-sdk ``` ```ts theme={null} import { init, connect, getPrimaryAccount, prepareExecute } from "@canton-network/dapp-sdk"; await init(); document.querySelector("#connect")!.addEventListener("click", async () => { const result = await connect(); if (!result.isConnected) return; const account = await getPrimaryAccount(); console.log(account.partyId); }); ``` Ekiden shows up in the picker because the extension emits `canton:announceProvider` (`id: "ekiden-wallet"`, `target: "ekidenWallet"`). If you disable default discovery, register it: ```ts theme={null} import { ExtensionAdapter, init } from "@canton-network/dapp-sdk"; await init({ additionalAdapters: [ new ExtensionAdapter({ providerId: "browser:ext:ekiden-wallet" as never, name: "Ekiden Wallet", target: "ekidenWallet", }), ], }); ``` Submit: ```ts theme={null} await prepareExecute({ commands: [ { CreateCommand: { templateId: "#package:Module:Template", createArguments: {}, }, }, ], }); ``` `prepareExecute` on this path resolves `null`. Subscribe to `txChanged` for `pending`, `executed`, or `failed`. `executed.payload.updateId` is the ledger update id. Errors from the provider use CIP-0103 codes. `4001` means the user closed the popup. The wallet will not proxy `ledgerApi`. Read contracts with your own backend, or use the Ekiden SDK `getContracts` if you depend on Ekiden specifically. ## Ekiden SDK ```bash theme={null} npm install @ekidenfi/dapp-sdk ``` ```ts theme={null} import { ekidenWallet } from "@ekidenfi/dapp-sdk"; const availability = await ekidenWallet.checkExtensionAvailability(); if (availability.status !== "installed") { // link the user to the extension install page } const result = await ekidenWallet.connect({ name: "My dApp", icon: "https://example.com/icon.png", }); const account = await ekidenWallet.getPrimaryAccount(); ``` `checkExtensionAvailability` is the only call that times out (1 second). Other methods wait until the extension answers. If it is not installed, they never settle — check availability first. ### Sign ```ts theme={null} const signature = await ekidenWallet.signMessage({ message: "hello", }); // base64 Ed25519 signature of the primary party ``` `message` may also be `{ hex }` or `{ base64 }`. ### Submit ```ts theme={null} const result = await ekidenWallet.prepareExecute({ commands: [ { ExerciseCommand: { templateId: "#package:Module:Template", contractId: "", choice: "SomeChoice", choiceArgument: {}, }, }, ], commandId: "optional-id", disclosedContracts: [], }); const updateId = result.tx.payload.updateId; ``` Optional fields the wallet reads: `commandId`, `actAs` (defaults to the primary party), `synchronizerId`, `disclosedContracts`. `prepareExecuteAndWait` submits the same way. It does not poll for finality. `completionOffset` is `0`. ### Events ```ts theme={null} ekidenWallet.onAccountsChanged((account) => { console.log(account?.partyId); }); ekidenWallet.on("txChanged", (event) => { console.log(event); }); ``` ### Balances and contracts ```ts theme={null} const balance = await ekidenWallet.getBalance({}); const contracts = await ekidenWallet.getContracts({ templateId: "#package:Module:Template", }); ``` `getBalance` uses the active account. A `party` argument is ignored. `balance` is the USDCx amount. `tokens` is the wallet catalog, including `symbol`, `kind`, and `balance`. ### Errors ```ts theme={null} try { await ekidenWallet.signMessage({ message: "hello" }); } catch (error) { const message = error instanceof Error ? error.message : String(error); if (message === "User rejected request") return; throw error; } ``` ## Approval UX The extension popup is the consent step. The website should say, before the click, which party will sign and what the command does. The popup repeats origin, action, and party. Do not try to hide it or pre-approve from the page. ![Ekiden Wallet connection approval popup](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/approve-connect.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=2fbb54aad20cf22fcebba3ba3349df51) ![Ekiden Wallet transaction approval popup](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/approve-tx-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=7f6b7b9f12ae0b99df6c88e9072c1c13) ## Party id A party id looks like `ekiden-::1220…`. The hint (`ekiden-`) is chosen when the wallet is created. The fingerprint is derived from the public key. dApps should store `partyId`, not the hint alone. # Ekiden Wallet Source: https://docs.ekiden.fi/wallet/overview Learn how Ekiden Wallet works, how it connects to Canton dApps, and which standards it supports. Ekiden Wallet is a self-custody browser extension. Keys stay on the device. The extension allocates a Canton party, holds that party’s instruments, and approves what a website is allowed to sign. A dApp never sees the seed or the private key. It asks the extension. The extension shows an approval screen. If the user accepts, the extension signs and, for transactions, submits the command. ## Two Canton standards People often say “CIP-56” for the whole wallet interface. On Canton those are two different proposals. | Proposal | Title | Who it is for | | - | - | - | | [CIP-0103](https://docs.canton.network/overview/reference/cip-0103) | dApp API | Websites that connect a wallet, sign, and submit | | [CIP-0056](https://docs.canton.network/overview/reference/cip-0056) | Token standard | Wallets and apps that read holdings and move instruments the same way on every registry | Ekiden implements CIP-0103 as a **browser extension** (synchronous API). It does not publish a remote JSON-RPC URL and it does not speak WalletConnect. CIP-0056 is how balances and sends are modeled on the ledger, described in [CIP-0056](/wallet/cip-0056). ## What a dApp can do After the user connects the site: * Read the primary party and the other parties on the active network. * Read the active network id (`canton:testnet`, `canton:mainnet`, `canton:devnet`). * Ask the user to sign a message. * Ask the user to prepare, sign, and submit Daml commands (`prepareExecute`). * Read holdings and active contracts through the Ekiden SDK methods. The site cannot switch the wallet’s network, export the seed, or skip the approval popup. ## What the wallet does not do * No open proxy of the participant JSON Ledger API (`ledgerApi`). Reads go through the Ekiden gateway methods. See [CIP-0103 gaps](/wallet/cip-0103#gaps). * No QR / mobile session. * No remote `userUrl` login. Approval happens in the extension popup, which is the synchronous CIP-0103 model. ## How it works Ekiden Wallet interactions follow three main stages: 1. [**Discovery**](/wallet/cip-0103#discovery-flow) — the dApp detects the wallet extension. 2. [**Connect**](/wallet/cip-0103#connection-flow) — the user authorizes the connection. 3. [**Submit**](/wallet/cip-0103#transaction-submission-flow) — the user approves signing and transaction submission. ## Related documentation * [User Flows](/wallet/user-flows) — learn how to create, import, and use Ekiden Wallet. * [dApp Integration](/wallet/dapp-integration) — connect your application to Ekiden Wallet. * [CIP-0103](/wallet/cip-0103) — explore the wallet API, supported methods, events, and limitations. * [CIP-0056](/wallet/cip-0056) — learn about token holdings and transfers. # User Flows Source: https://docs.ekiden.fi/wallet/user-flows Learn how to create, import, unlock, and use Ekiden Wallet. This guide covers the main actions available in the Ekiden Wallet browser extension, from creating a wallet to approving transactions and managing networks. ## First open No vault yet. The splash offers **Create wallet** and **Import seed**. ![Ekiden Wallet welcome screen with Create wallet and Import seed options](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/splash.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=96ad21b685e859ea53e48adc78eb6e54) Create asks them to write down the 12 words, confirm, choose a party name (`ekiden-`), and set a password. ![Wallet recovery phrase setup](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/seed-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=a45070d7c1873173cc02f8b3dd90a375) ![Party name and password setup](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/password-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=cfff704a7cc6b4fcaa14694b7b5f472f) Import asks for the same phrase, then the same party name. The name has to match the party that was allocated with that seed. Fingerprint-only restore does not find the party on this ledger. ![Import an existing wallet using a recovery phrase](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/import-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=f6179a836efd5c4bf0aea28c52801f55) ## Unlock The vault exists and the session is locked. Password, then **Unlock**. **Sign out / remove wallet** deletes the local vault. The seed still restores it. ![Ekiden Wallet unlock screen](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/unlock.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=2bab9a705cb59b936b90966975c4b42f) ## Home After unlock: party, network, balances. Send, receive, and settings hang off this screen. ![Ekiden Wallet home screen showing party, network, and balances](https://mintcdn.com/ekiden/ldVqp95q9gqiW1uu/images/home.png?fit=max\&auto=format\&n=ldVqp95q9gqiW1uu\&q=85\&s=955730e49f9e7e67b9d407ac35e77ab3) ![Receive screen displaying the full Canton party ID](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/recieve.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=f6a5077a1e8b9688ba70363b02fd1872) ![Send assets screen with instrument, amount, and recipient](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/send.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=392fe11b45c1bfbfbcb8cb7e9029bc7f) Incoming transfer instructions show as offers the user can accept or reject. ![Incoming transfer offer with Accept and Reject actions](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/offer-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=29c91612940c3111b96e272ce24c12d1) ## A website connects The site calls `connect`. The extension opens an approval with the origin and the dApp name. ![dApp connection approval popup](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/approve-connect.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=2fbb54aad20cf22fcebba3ba3349df51) Signing a message and submitting a transaction are the same popup family, with the payload summarized. ![Message signing approval popup](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/approve-sign-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=fb61e6e40ce6c53171b165edbfad156c) ![Transaction approval popup showing command summary](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/approve-tx-1.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=7f6b7b9f12ae0b99df6c88e9072c1c13) If the user rejects, the site receives “User rejected request” (`4001` on the CIP-0103 path). If they accept a transaction, the wallet signs and submits, then the site sees `executed` and an `updateId`. ## Network The user picks the network in the wallet. A dApp cannot switch it. A network marked coming soon cannot create or use an account. ![Wallet network selection screen](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/network.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=9f87656082a9007df6240ab767cdb9f6) ## Lock and remove Lock ends the session and returns to Unlock. Sign out removes the vault from this browser profile. ![Wallet settings with lock and remove wallet options](https://mintcdn.com/ekiden/coIbOVnLWg3ojKNF/images/settings.png?fit=max\&auto=format\&n=coIbOVnLWg3ojKNF\&q=85\&s=30a8c7a0c008a461ac44b85777b1943a)