The Proof Trading SDK is a first-party client library for the Proof Exchange, a CometBFT-based perpetuals exchange. It handles every layer between your application and the on-chain engine: Ed25519 key generation and signing, MessagePack wire encoding, monotonic timestamp-nonce allocation, and both gateway and direct CometBFT broadcast. Whether you are building a trading bot, an AI agent, or a full-featured frontend, every exchange action flows through a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Proof-labs/trading-sdk/llms.txt
Use this file to discover all available pages before exploring further.
submitTx call.
What the SDK does
The SDK packages four responsibilities into one cohesive interface:- Ed25519 signing — generate a keypair locally, derive a 20-byte owner address via
pubkeyToOwner, and attach a domain-separated signature to every transaction. - MessagePack wire encoding — transactions are compact positional arrays (
[version, action_type, seq, payload, pubkey, signature]) encoded with MessagePack, not JSON. - Timestamp-nonce allocation —
seqis a millisecond Unix timestamp advanced bymax(now_ms, last_nonce + 1). The exchange validates against a sliding window and rejects replays with code21. - Gateway and CometBFT submission — by default, transactions POST to the gateway’s
/exchangeendpoint; setuseGateway: falseto broadcast directly to CometBFT’sbroadcast_tx_sync.
Available packages
TypeScript / Node.js
Python
python/pyproject.toml.Rust
crates/proof-trading-sdk.Devnet defaults
The SDK ships pre-configured for the public Proof devnet. No additional setup is required to start querying.| Parameter | Default |
|---|---|
| Gateway URL | https://api.dev.proof.trade |
| Chain ID | exchange-devnet-1 |
| Faucet URL | https://faucet.dev.proof.trade |
chainId:
Key capabilities at a glance
Trading actions
Place, cancel, replace, and amend limit orders. Execute market orders, close positions, and submit atomic basket (multi-leg) orders — all via a single discriminated-union
Action type.Full query surface
Query orderbooks, open orders, account info, market configs, tickers, chain status, ADL queues, and withdrawal records without any authentication.
Submission modes
submitTx returns after CheckTx (fire-and-forget with background polling). submitTxCommit polls /tx?hash for up to 9 seconds for synchronous confirmation. Collect all background DeliverTx results with awaitPendingVerifies().WebSocket events
Subscribe to real-time block events — trades, order placements, position updates, funding, and liquidations — via
client.subscribeBlocks() or the raw wss:// feed.Wire format overview
Transactions are MessagePack positional arrays signed over a domain-separated message:DOMAIN_PREFIX(16B) || chain_id(32B) || action_type(1B) || seq(8B BE) || payload. The 32-byte chain_id binding closes the cross-chain replay vector. Full payload layouts are defined in src/types.ts and src/codec.ts.
Prices and quantities are always
bigint (u64) — never JavaScript number or floating point. Prices are integer cents (5000000n = 10,000).Unit conventions
| Field | Unit | Example |
|---|---|---|
| Prices | Integer cents | 5000000n = $50,000.00 |
| Balances / amounts | MicroUSDC (6 dp) | 10_000_000_000n = $10,000 |
| Fees / margin rates | Basis points | 500 = 5% |
| Addresses | 20-byte Uint8Array | pubkeyToOwner(publicKey) |
Explore further
Quickstart
Generate a keypair, fund via faucet, and place your first limit order in under five minutes.
Installation
TypeScript, Python, and Rust setup with runtime requirements and connectivity tests.
ExchangeClient API
Full reference for all client methods, options, and return types.
Key Management
Ed25519 keypair generation, address derivation, and secure key handling patterns.