LPsLux Proposals
DEX & Trading
LP-9027

Wire

Final

DEX transport — a CCXT public surface over a single frozen dex_* ZAP wire, with FIX compatibility. Supersedes LP-9002.

Category
Interface
Created
2026-06-24

Implementation status (code-audited 2026-07-03): SHIPPED dex_ensure_market/place/cancel/submit confirmed (dex/pkg/zapwire/zapwire.go:42-45; registration dchain/handler.go:48-67); CCXT adapter confirmed (sdk/lx-trading-go/adapters/ccxt.go). FIX 4.4 ships as a library (pkg/fix/acceptor.go), not a cmd/fix-gateway binary.

Source: github.com/luxfi/dex

Supersedes LP-9002: that LP framed the DEX as an X-Chain DexFx plugin with X-Chain transaction types. The DEX is the D-Chain dexvm (see LP-9000); the wire below is its transport.

Abstract

Traders speak CCXT verbs. The DEX speaks one frozen ZAP frame internally. FIX clients connect through a gateway that translates to the same frame. One matcher, many dialects.

Public surface — CCXT

The surface a client codes against is the CCXT verb set: createOrder, cancelOrder, fetchOrderBook, fetchTicker, fetchTrades, fetchBalance. The Go SDK names them PlaceOrder, CancelOrder, GetOrderbook, GetTicker, GetTrades, GetBalances behind one venue-adapter interface (dex/sdk/lx-trading-go/adapter.go:71), and a CCXT adapter maps the standard verbs onto it. A bot written for any CCXT venue trades the Lux DEX unchanged.

Internal wire — dex_*, ZAP-canonical

Under the surface there is one wire. Its frozen source of truth is zapwire, a pure-Go leaf that imports only the standard library, so a public CGO-disabled build frames requests byte-identically to the venue without dragging in the matching engine (dex/pkg/zapwire/zapwire.go:4).

The method names use the dex_* namespace, renamed from clob_*. On the D-Chain the DEX is the central-limit order book, so the wire follows the luxd service-prefix convention (eth_, avm., platform.) and names the chain's purpose, not the internal engine (dex/pkg/zapwire/zapwire.go:36). The Go identifiers (MethodPlace, CLOB) keep the engine's name; only the on-wire strings changed.

dex_* methodoperation
dex_ensure_marketidempotently create a market/book
dex_placerest a limit order
dex_cancelcancel a resting order
dex_submitsubmit a marketable order, return its fills

(dex/pkg/zapwire/zapwire.go:41.) Reads use the same namespace — dex_get_book, dex_get_trades, dex_get_orders, dex_get_markets (dex/pkg/dchain/read.go:50).

The frame is frozen. The same bytes round-trip across every dialect, so a size or name change is a wire-breaking change and is versioned at the transport layer, never silently (dex/pkg/zapwire/zapwire.go:14).

FIX compatibility

cmd/fix-gateway is a FIX 4.4 acceptor in front of a running venue. A FIX client logs on and sends NewOrderSingle / OrderCancel; the gateway translates each into the same venue operation that the CCXT path and the 0x9999 precompile use, and renders the consensus-computed result back as a FIX ExecutionReport (dex/cmd/fix-gateway/main.go). It owns no matcher and no book — it dials the venue's ZAP endpoint and is a pure protocol front-end (dex/pkg/fix).

Rationale

One matcher, many dialects. The matcher lives in pkg/dchain; CCXT, FIX, and the precompile are dialects onto the one frozen dex_* frame. A new protocol is a new front-end, never a new book — so no dialect can disagree with another about a fill. Keeping zapwire a pure-Go leaf is what lets the public precompile frame requests identically to the venue without linking the engine.

LPRelationship
LP-9000DEX core; this LP is its transport
LP-9002Superseded by this LP
LP-9026Asset identity carried over this wire

Copyright and related rights waived via CC0.