How the exchange module clears a block, where it sits against other onchain books, and a working Go order book client and batch-auction matcher that runs in the browser against mainnet.
The role owns the Go that turns orders into trades and trades into data.
The work sample builds a small, tested version of each of the three: a fixed-point matcher that follows the documented clearing rules, a hedged LCD client with a sequence guard, and a REST and WebSocket server with one poller per market.
A Cosmos SDK chain whose order book is a native Go module.
| Layer | What is there now | Why it matters for this role |
|---|---|---|
| Exchange module | Spot, perpetual, expiry and binary options markets with a fully onchain order book. Matching runs in the EndBlocker as a frequent batch auction. | The "decentralized orderbook, order matcher" in the JD. |
| Markets | 489 active: 135 spot, 354 perps. Every perp is quoted in USDC (an erc20: denom). Perps include equities and metals: AAPL, NVDA, TSLA, MSFT, PLTR, GME, XAU, XAG. | Market params (ticks, min notional, fees) drive every client-side check. |
| Oracles | Perp oracle types on chain: PythPro 315, Chainlink Data Streams 33, Provider 6. | Mark price is an input to the limit-order clearing price. |
| Fees | All 354 perps carry a 0.0001% maker and taker rate on chain. Spot rates vary: 109 markets at 0.05% taker. | Fee refunds and charges depend on the clearing price (docs, "Single Trade Calculations"). |
| MultiVM | Native EVM live since 11 Nov 2025 (chain ID 1776). Solidity reaches the exchange module through a precompile at 0x…0065. | A second client population that calls the same Go keeper. |
| Read paths | Chain LCD (/injective/exchange/v2/…), the Indexer (gRPC, gRPC-web, REST) and Chain Stream. | The REST and WebSocket APIs the JD names sit on this layer. |
Market counts, fees and oracle types: live LCD queries, 7 Nov 2026. EVM facts: Injective docs.
Two stages, one uniform price per stage.
Sources: Injective docs, exchange module EndBlocker and Other Concepts; worked examples in the API reference.
Injective has the broadest product set and the thinnest major-pair books.
| Venue | Where the book and matching live | BTC perp depth ±50 bps | Gap vs Injective |
|---|---|---|---|
| Injective | Native Go module; frequent batch auction at block end; one clearing price. | ~$2.4M | Reference row. Spot, perps, expiry, binary options, RWA perps, EVM precompile access. |
| Hyperliquid | HyperCore onchain book; continuous price-time matching inside HyperBFT; HyperEVM reads it through precompiles. | ~$100M | Far deeper majors. Narrower product scope; continuous matching leaves ordering inside a block as a factor. |
| dYdX v4 | Book held in each validator's memory; only fills are committed on chain. | ~$7.5M | Book state is offchain. Perps only. |
| Lighter | Sequencer matches; zk proofs of matching and liquidation posted to Ethereum. | not measured | Verifiable matching via proofs; no native multi-module chain around it. |
| Binance futures | Centralised engine (reference only). | floor only* | The liquidity benchmark every onchain book is quoted against. |
Depth: one live snapshot on 7 Nov 2026 from each venue's public API, sum of bid and ask notional within 50 bps of the venue's own mid. Hyperliquid's API returns 20 levels a side, so deeper levels come from its rounded book. *Binance's public depth reaches about 17 bps on BTC. Snapshots move; treat these as orders of magnitude.
Three things a new integrator trips on.
| Finding | Evidence | What I would do |
|---|---|---|
| v1beta1 and v2 return one book on two scales | BTC/USDC PERP best bid: exchange/v1beta1/…/orderbook returns 75903000000, exchange/v2/…/orderbook returns 75903. v1beta1 is in chain units (quote decimals applied); v2 is human readable. Both paths are live. | One line on each orderbook query page naming the unit, and a typed price in the Go client so a mixed-up value fails to compile. |
| Worked limit-order example: intermediate tables do not reconcile | The new 0.2 buy at 64,360 appears as 0.1 in the merged book; the first match draws from the 64,250 ask while cheaper new asks remain; the text writes the range as "64,220 ≥ clearing ≥ 64,360" and the stop condition as "64,220 > 62,210". The stated range [64,220, 64,360] and the clearing price 64,230 are correct. | Regenerate the tables from a test fixture. My fba tests assert the stated results and could serve as that fixture. |
| Thin books stay stale between trades | Polled across this session, the INJ/USDT spot book kept the same seq (73443633) for over an hour at a 2% spread, and far-from-mid resting orders persist on the BTC perp (asks up to ~$89k with mid ~$76k). | Expose seq and last-update time on every REST book response so clients can tell quiet from stuck. |
Checked 7 Nov 2026 against sentry.lcd.injective.network and three other public LCD hosts.
Each duty, the first thing I would ship, and where the sample already shows it.
| JD duty | First thing I would ship | In the work sample |
|---|---|---|
| Build, maintain and test the order book, trade execution and matcher | Table tests generated from the documented clearing rules, plus fuzzing of order sequences against invariants (no crossed book after a block, conserved quantity, clearing price inside the matched range). | fba package: both documented worked examples as tests; book.Validate invariant checks. |
| Open-source Go clients for the protocol and contracts | Client-side order checks that mirror chain rules (ticks, min notional) so a rejected order fails before broadcast, with the nearest valid value in the error. | Market.CheckOrder returns every violation with a fix; client package with hedged reads. |
| High-performance REST and WebSocket APIs | One upstream subscription per market fanned out to N sockets, level diffs instead of full books, bounded per-client buffers. | bookd: one poller per market, diff messages, drop-on-slow-consumer; tested with three clients on one market. |
| Go idioms and CS fundamentals | Context everywhere, no shared mutable state without a lock, O(n) merges over sorted levels, fixed-point money. | go test -race clean; O(n) book.Diff; 18-digit dec with a fuzz test. |
| Geth or Erigon familiarity | Map how EVM calls into the exchange keeper through the precompile, and where gas and state access differ from a plain Geth call. | Earlier Injective EVM console work: live eth_call to the exchange precompile. |
| Communicate with technical and non-technical teammates | Short design notes per change: the invariant, the test, the rollback. | This page and the docs findings above. |
Injective Book Lab: Go compiled to WebAssembly, reading mainnet.
seq.| Package | What it does | Tests |
|---|---|---|
dec | Fixed-point decimal at 18 digits (the Cosmos SDK LegacyDec precision), half-up rounding, tick floor and ceil. | Table tests, fuzz round trip |
book | L2 book, validation, mid, spread, depth bands, taker walk, O(n) diff, exchange tick and notional checks. | Table tests, 2 benchmarks |
fba | Stage 1 market clearing and stage 2 limit clearing with the reference-price rule. | Both documented examples |
client | LCD client over net/http: hedged requests, failover, sequence guard, per-endpoint stats. | Failover, hedge, stale node |
cmd/bookd | REST (/v1/book, /v1/sim, /v1/markets) and WebSocket (/v1/stream) server. | 3-client fan-out, bad input |
cmd/wasm, cmd/injbook | Browser build exposing the packages as Promises; CLI for the same reads from a terminal. | Browser run on mainnet |
Standard library plus one WebSocket package. About 2,000 lines of Go, a quarter of them tests. Independent code written for this application.
Read, test, then ship behind the tests.
MsgCreate…Order to EndBlocker persistence.Every number on this page comes from a live query or the docs linked below, taken on 7 Nov 2026. The JD is the public job posting (2026).
Exchange module: EndBlocker · Other Concepts
Worked examples: market · limit
EVM: precompiles · exchange precompile
Live data: sentry.lcd.injective.network/injective/exchange/v2/…
Go SDK: InjectiveLabs/sdk-go
Depth comparison: each venue's public order book API, read in one pass
Demo: injective-go.pages.dev · source
Independent homework for the Injective Labs Golang/Blockchain Engineer role · 2026 · edwardtay.com