Indexer API
The public market-data HTTP API: status, assets, pairs, trades, candles, launches and pools.
On this page
General#
GETonly (other methods return405). JSON. Every response, including errors ({ error, tipHeight }), carriestipHeight.- Unknown or repeated query parameters, out-of-range values and malformed ids return
400; unknown routes and pairs404; URLs over 2,048 bytes414. Error text never echoes request input. - Amounts are decimal strings in base units. Counts, heights, sequence numbers and unix times are JSON integers.
- A price is an exact reduced fraction
{ num, den }, quote units per base unit.priceChange24his a reduced signed fraction, not a percentage. - Time on a v4 chain is the validator-signed header time, served as unix seconds.
- Candles start at
floor(time / interval) * interval; empty buckets are not emitted, so carry the previous close forward. - The 24-hour window is relative to the tip block's time, never the server clock.
- Headers sent:
Cache-Control: no-store,X-Content-Type-Options: nosniff,Vary: Origin. The server logs nothing per request. - It binds 127.0.0.1 by default. Browser access is closed by default; an operator can allow exact origins or, explicitly, any origin. The
nullorigin cannot be allowed alone.
Pair endpoints#
Pairs cover public exchanges only. Pool trades are not merged into pairs.
| Endpoint | Parameters | Response |
|---|---|---|
/status | { chainId, tipHeight, tipTime, pairs, trades, verifier, finality }, and on a v4 chain statementVersion, pools, poolTrades. tipTime is null at height 0. | |
/assets | { tipHeight, assets: [{ assetId, symbol, name, decimals }] }. Plain assets have symbol and name null and decimals 0; launch tokens carry their public ticker, name and decimals. Tickers are not unique. | |
/pairs | { tipHeight, pairs: [{ pairId, baseAsset, quoteAsset, lastPrice, lastTradeHeight, trades24h, baseVolume24h, quoteVolume24h, priceChange24h }] } | |
/pairs/:pairId/trades | limit 1 to 500 (default 50), before (exclusive seq) | { tipHeight, trades: [{ seq, height, txIndex, time, baseAmount, quoteAmount, price }] }, newest first |
/pairs/:pairId/candles | interval one of 1m 5m 15m 1h 4h 1d (default 1h), from, to, limit 1 to 1,000 (default 300) | { tipHeight, interval, candles: [{ t, open, high, low, close, baseVolume, quoteVolume, trades }] } |
pairId is 32 lowercase hex characters. The quote asset of a pair is the one that appears earliest in the operator's quote list; if neither is listed, the lexicographically larger asset id is the quote.
Pool endpoints#
Served for every v4 chain. Every pool response also carries feed, a label saying where the data came from (it names the verifier).
| Endpoint | Parameters | Response |
|---|---|---|
/launches | { tipHeight, feed, launches: [{ poolId, tokenAsset, quoteAsset, paramsHash, name, ticker, decimals, metadataHash, curveSupply, virtualQuote, feeBps, protocolFeeShareBps, graduationQuote, launchSalt, launchIndex, launchHeight, launchTime, launchFeeAsset, launchFeeAmount, assetClass }] } in launch order | |
/pools | { tipHeight, feed, tipTime, pools: [pool] } | |
/pools/:poolId | { tipHeight, feed, tipTime, pool: { ...pool, launch } } | |
/pools/:poolId/trades | limit, before | { ..., trades: [{ sequence, height, time, side, tokenAmount, quoteAmount, fee, price, tokenReserve, quoteReserve, virtualQuote, phase, graduated, burned }] }, newest first |
/pools/:poolId/series | limit, before | { ..., series: [{ sequence, height, time, phase, tokenReserve, quoteReserve, virtualQuote, price }] }, ascending; sequence 0 is the launch state |
/pools/:poolId/candles | interval, from, to, limit | { ..., candles: [{ t, open, high, low, close, tokenVolume, quoteVolume, trades, buys, sells }] } |
A pool object holds: poolId, tokenAsset, quoteAsset, name, ticker, decimals, assetClass, feeBps, protocolFeeShareBps, launchHeight, launchTime, phase ("curve" or "graduated"), graduationQuote, graduationHeight, graduationProgressBps, curveSupply, circulatingSupply, burned, tokenReserve, quoteReserve, virtualQuote, protocolFees, price, sequence, lastTradeHeight, trades24h, buys24h, sells24h, tokenVolume24h, quoteVolume24h, priceChange24h.
poolId is 64 lowercase hex characters. The pool price is the reserve price (quoteReserve + virtualQuote) / tokenReserve after the trade, not the amount ratio, because trade amounts include the fee.
What produces no record#
Spends, plain-asset creations (which appear only in /assets) and private exchanges produce no record. A launch produces a launch record and a pool; nothing says who launched.
How the indexer checks the chain#
On a v4 chain the indexer is a verifying follower. For each block it recomputes the commitment, checks the validator signature, re-runs the market rules and compares the market root with the signed header, applies the block through every ledger rule including every proof, and requires its launch and pool-trade records to equal what the market rules produce. A block that fails changes nothing. Persistence is a block log of its own; rollback is a manual operation.
Running it#
node indexer/cli.mjs --genesis <v4 genesis.json> --node <http://host:port>
[--state-dir <directory>] [--port 4880] [--host 127.0.0.1]
[--quote-asset <assetId>]... [--allow-origin <origin>]... [--public-cors]
[--poll-ms 5000] [--finality-depth 0]With xlh node start --with-market the launcher starts it for you. Pass the designated quote asset with --quote-asset so it is on the quote side of every pair.