Why deterministic?
- No client order ID required - The exchange assigns a unique ID from the transaction contents.
- Know the ID before the node responds - Useful for optimistic UI and local tracking.
- Reproducible - Same action + account + nonce + index always yields the same order ID.
Computing order IDs
You can compute order IDs yourself from the protocol formula, or use bulk-keychain so you don’t have to implement the binary encoding.Option 1: Use bulk-keychain (recommended)
The official signing library bulk-keychain can compute order IDs for you in Node.js, browser (WASM), Rust, and Python. Single-order and batch (group) transactions are supported.| Environment | Package | Install |
|---|---|---|
| Node.js | bulk-keychain | npm install bulk-keychain |
| Browser (Web) | bulk-keychain-wasm | npm install bulk-keychain-wasm |
| Python | bulk-keychain | pip install bulk-keychain |
| Rust | bulk-keychain | cargo add bulk-keychain |
signGroup, prepareGroup, and batch order ID options.
You can also compute an order ID without signing (e.g. for display or lookup) using the library’s compute_order_id / computeOrderId helpers with order fields, nonce, and account.
Option 2: Compute from the protocol
Order IDs are the base58-encoded SHA-256 hash of:seqno: Zero-based index of the order-producing action in theactionsarray (0 for a single-order tx).single_action: Canonical bincode of that one action (same encoding used for signing).- For limit/market actions,
pxandszuse fixed-point:round(value * 1e8)as u64.
Summary
| Need | Approach |
|---|---|
| Sign and send orders | Use bulk-keychain (Node, Web, Rust, Python). |
| Know order ID before response | Use bulk-keychain’s pre-computed order ID after signing (or after prepare, with external wallet). |
| Order ID without private key | Use bulk-keychain’s compute_order_id / computeOrderId with order + nonce + account. |