Documentation Index
Fetch the complete documentation index at: https://docs.ekiden.fi/llms.txt
Use this file to discover all available pages before exploring further.
Supported Environments
Ekiden supports the following environments:
| Environment | Network Key | REST URL | WebSocket URL |
|---|
| Testnet | testnet | https://api.ekiden.fi/api/v1 | wss://api.ekiden.fi/ws |
Use the network parameter during client initialization to select your target environment.
Initialization Parameters
| Parameter | Description | Required | Default |
|---|
| network | mainnet or testnet | No | mainnet |
| api_key | For private endpoints | Yes (if API key auth) | — |
| private_key | Alternative for signature-based auth | Yes (if no API key) | — |
| subaccount_id | Optional subaccount ID | No | 0 |
| use_websocket | Enable WS connections | No | true |
Examples
TypeScript
import { Ed25519Account, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
import { EkidenClient, TESTNET } from "@ekiden/ts-sdk";
const ekiden = new EkidenClient(TESTNET);
const privateKey = new Ed25519PrivateKey(ENV.PRIVATE_KEY);
const account = new Ed25519Account({ privateKey });
const publicKey = account.publicKey.toString();
const nowMs = Date.now();
const nonce = crypto.getRandomValues(new Uint8Array(16))
.reduce((acc, b) => acc + String.fromCharCode(b), "");
const nonceB64Url = btoa(nonce).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
const signed = `AUTHORIZE|${nowMs}|${nonceB64Url}`;
const messageBytes = new TextEncoder().encode(signed);
const signature = account.sign(messageBytes).toString();
// Authorize (get JWT)
const { token } = await ekiden.authorize({
signature,
public_key: publicKey,
timestamp_ms: nowMs,
nonce: nonceB64Url
});
Rust
use ekiden_sdk::{ClientBuilder, Network};
#[tokio::main]
async fn main() {
let client = ClientBuilder::new(Network::Mainnet)
.with_subaccount(0)
.enable_websocket(true)
.build()
.unwrap();
}