Skip to content
BuildBuild on HyperCore16 pages
Architecture: info, exchange, WebSocketFoundationHyperliquid's API has three surfaces: an unsigned read endpoint, a signed write endpoint, and a WebSocket that streams data and can carry both.Your first requestFoundationReading Hyperliquid needs no key, no account and no risk: three unsigned POST requests return the list of markets, an order book and any address's positions.Asset ids and namingPractitionerOrders name a market by an integer asset id and info requests by a coin string, and perps, spot, HIP-3 and outcomes each derive both by a different rule.Precision: tick size, lot size, significant figuresPractitionerA HyperCore price has at most 5 significant figures and a decimal cap set by szDecimals, a size at most szDecimals decimals, and outcomes use a 0.00001 grid.Signing from first principlesExpertL1 actions sign a keccak hash of their msgpack bytes, user-signed actions sign readable EIP-712 data, and one wrong byte in either recovers a stranger's address.Nonces, expiry and API walletsPractitionerHyperCore keeps each signer's 100 highest nonces and accepts a new one only if unused, above the smallest, and within 2 days before and 1 day after block time.Orders: place, modify, cancel, batch, dead man's switchPractitionerAn order is a signed action carrying a batch of compact orders; modify, cancel, TWAP and the dead man's switch are separate actions, each with its own response.Transfers and withdrawalsPractitionerEvery HyperCore transfer is a signed action: sends and withdrawals need the account's own key, and an API wallet's transfer actions keep value inside the account.Multi-sig actionsExpertA multi-sig action carries enough authorised users' signatures over one nonce and one named leader, in an envelope only the leader signs and submits.WebSocket: subscriptions, post requests, heartbeatsPractitionerOne WebSocket streams book, trade and account updates as blocks execute and carries signed actions, but drops without warning and forgets every subscription.Rate limits and user limitsPractitionerHyperliquid meters each IP by request weight, 1200 per minute, and each address by actions: 10,000 plus one per USDC traded.Priority fees and the activation feeExpertHyperliquid sells latency in two burned auctions, read priority per IP and write priority per order, and charges 1 quote token to activate a new account.Error responsesPractitionerHyperliquid reports errors at four layers, from HTTP status to a string inside a successful response, and several name a cause other than the real one.Debugging signatures and wire shapesExpertA signature over wrong bytes still verifies, so HyperCore recovers a stranger's address and says it does not exist; the fix is almost always the encoding.Optimising latencyExpertMost of an order's round trip is consensus; code wins by streaming reads, cutting serial round trips, using the fast order class and never stalling orders.Data: historical, node and explorerPractitionerThe API keeps only recent history; a full record needs pagination, archived node data or your own node, and each trade counted once by its trade id.
BuildBuild on the HyperEVM9 pages
What the HyperEVM is, and is notFoundationThe HyperEVM is Hyperliquid's smart contract environment: it reads HyperCore state and queues HyperCore actions, but never executes them atomically.Blocks, gas and RPCPractitionerThe HyperEVM produces small blocks every second and big blocks every minute, prices gas with EIP-1559 in HYPE, and serves a JSON-RPC with no historical state.Moving assets between HyperCore and the HyperEVMPractitionerLinked tokens cross between HyperCore and the HyperEVM via per-token system addresses, with a decimal offset and a 200k-gas fee when leaving HyperCore.Linking a tokenExpertLinking binds a HyperCore token to one ERC20 through the spot deployer's request and the contract deployer's finalisation; the protocol checks almost nothing else.Reading HyperCore: precompilesExpertRead precompiles are 21 fixed addresses, 0x800 to 0x814, that return HyperCore state as of the EVM block's construction, and only at the latest block.Writing to HyperCore: CoreWriterExpertCoreWriter turns a contract call into a HyperCore action for the caller's own account, run after the EVM block, with no result returned and no revert on refusal.Execution order and timingExpertEach L1 block runs the EVM block, then EVM to HyperCore transfers, then CoreWriter actions; on mainnet most actions land within half a second, vault transfers in about 4 s.PatternsExpertA contract that touches HyperCore stays solvent by recording an intent, sending the action, and settling only on HyperCore state that visibly moved.Footguns, measuredExpertTwelve ways a HyperEVM contract loses money or silently does nothing when it touches HyperCore, each with the on-chain evidence and the fix.

Optimising latency

Expert

Most of an order's round trip is consensus; code wins by streaming reads, cutting serial round trips, using the fast order class and never stalling orders.

The API server hop, mempool and HyperBFT commit are protocol, and no code removes them. Per the docs, they add up to about 380 ms end to end for a cancel or ALO order. Your code controls the rest: round trips per decision, their distance, the ordering class, and whether bookkeeping stalls an order.

Say you hedge from Ireland while the API servers run in Tokyo, on AWS. One such hedge measured 350 to 500 ms: about 110 ms of transit plus four sequential round trips. Cutting round trips and moving to Tokyo are the levers.

Sequencing is far less noisy than latency: send times varying under 10 ms produce predictable ordering on the L1. So measure where your transactions land relative to others, not only reply time.

YOUR CODE PROTOCOL Your process decides, signs, sends API server Tokyo, forwards to a node Mempool cancels and ALO first Committed usually 2 blocks the reply is the execution result, sent only after commit about 380 ms end to end for a cancel or ALO order
Code controls the first hop, how many times a decision goes round this loop, and which ordering class it lands in.

Polling REST is the slowest view of the book and spends IP weight that order placement needs (rate limits): subscribe over WebSocket.

Past that, the docs’ read path is your own non-validating node (running a node):

  • Peer with a reliable node such as the foundation non-validator.
  • --disable-output-file-buffering writes outputs as soon as blocks execute.
  • Hardware at least as in the numbers; more cores execute blocks faster.
  • Build the book locally from node outputs, faster and more granular than the API. The docs’ example order book server is not actively maintained: fork it or write your own, and handle ALO priority fees.
  • --batch-by-block waits for block end before writing: simpler to consume, but turning it off and inferring boundaries is faster.
  • split_client_blocks: true streams transactions 70 to 150 ms sooner, before inclusion in client blocks and before execution, so results must be predicted (reasonable for simple actions such as orders). Predictions must handle actions that later fail.

Beyond that, read priority is bought (priority fees).

Count serialised round trips. Prepare everything an order needs (metadata, precision rules, leverage) before the signal, and never put an /info call in the order path. The order path depends only on cached state, the nonce source and the signer: a read that stalls it costs more than any network tuning saves (rate limits).

Keep connections warm and small writes immediate. One WebSocket carries reads and signed actions. On TCP sockets you control, set TCP_NODELAY so a small order is sent at once, not held to coalesce.

Land in the fast class. Cancels and ALO orders sent at time t almost always execute before IOC and GTC orders sent at the same time, across several blocks; within each consensus bundle, ALO orders and cancels execute first. The docs recommend:

  • Cancels with the fast flag f: true; its only cost, and its only effect today, is that it cannot cancel trigger orders. The docs say a future upgrade will prioritise only fast cancels in the mempool, so set it now.
  • Batches every 0.1 s from one task per process, ALO in batches of their own: ALO-only batches are prioritised.
  • Order priority for IOC orders that must arrive sooner.

One API wallet per process keeps nonces apart

Section titled “One API wallet per process keeps nonces apart”

Nonces are tracked per signer, the account key or the signing API wallet (nonces and API wallets). Several processes signing with one key and the millisecond clock collide: two orders in one millisecond share a nonce, and one is rejected.

The docs’ fix: one API wallet per trading process, and in each process one counter every batch draws from, fast-forwarded to the current millisecond when behind. It tolerates out-of-order arrival within 2 seconds.

// One instance per signing key, shared by every task in the process.
export class NonceSource {
private last = 0;
next(): number {
const now = Date.now();
this.last = now > this.last ? now : this.last + 1;
return this.last;
}
}

One API wallet signing for several sub-accounts shares one nonce set across them: give each sub-account its own.

A quoting process that exits leaves ALO orders resting and filling while nothing hedges. Cancel everything on shutdown and keep scheduleCancel armed for crashes: at least 5 s ahead, re-armed on a heartbeat, at most 10 firings per day (orders).

For an order in flight, the docs call noop more effective than cancel: signed with the pending order’s nonce, it marks that nonce used so the order cannot land. After a WebSocket drop, reconcile in-flight posts by cloid (WebSocket). A stale expiresAfter rejection costs 5 times the usual address budget, so a short expiry as a latency guard has a price.

Item Value
End to end, cancel or ALO order about 380 ms
Commit usually 2 blocks
Send-time variation for predictable ordering under 10 ms
split_client_blocks gain 70 to 150 ms
Node hardware 32 logical cores, 128 GB RAM, 500 MB/s disk
Suggested batch cadence every 0.1 s, ALO batched separately
IOC order priority about 45 ms per bp, linear to 8 bps
Gossip priority about 25 ms per slot
Tokyo and Ireland hedge (measured) 350 to 500 ms
Gossip peer RTT (measured, TCP connect on ports 4001 and 4002) about 70 ms (APAC) to 252 ms (eastern Europe)
Nonce window 2 days before to 1 day after block time
Nonces kept per signer 100

For the trading decision this page serves, see Latency, priority and infrastructure. For the full nonce rules, see Nonces, expiry and API wallets.