Chronik and the old explorer API
Developers12.5.9+

Chronik and the old explorer API

The Chronik API of the older Lotus apps (chronik-client 0.x) and the old explorer API, served by the node itself: endpoints, client versions, examples, limits and the known gaps.

Since 12.5.9 every full node serves two older APIs itself, so that wallets, bots and scripts written for them keep working:

  • the Lotus Chronik API, the protobuf API that the npm package chronik-client 0.x speaks (Sendlotus, Lotus Vase, lotus-bot, the RANK extension and the Lotusia web wallet use it);
  • the old explorer API (the eiquidus explorer that ran at explorer.givelotus.org): /api/get... and /ext/....

No Chronik indexer runs. The answers come from the node's own indexes, the same ones the REST API reads. New code should use the REST API: it has more, it pages by cursor, and it is described by an OpenAPI document. Use this page to keep an existing app working, or to point it at a node of your own.

Endpoints #

WhatPublic endpointOn your own node
Chronik HTTPhttps://chronik.givelotus.org/xpi (also https://chronik.givelotus.org and https://givelotus.org/chronik)http://127.0.0.1:10604/chronik (the REST port)
Chronik WebSocketwss://chronik.givelotus.org/xpi/ws (also /ws, and wss://givelotus.org/chronik/ws)ws://<push listener>/chronik/ws: the -wslisten port, or the browser miner port of -stratumwslisten
Old explorerhttps://explorer.givelotus.org/api/..., /ext/... (also on https://givelotus.org)http://127.0.0.1:10604/api/getblockcount, /ext/summary, ...

Testnet and regtest nodes serve the same paths on their own ports (11604, 12604). -chronik=0 and -explorercompat=0 turn the two APIs off on a node.

Warning

chronik-client builds the WebSocket address from the HTTP one: base URL + /ws. On a bare node the HTTP routes are on the REST port and the WebSocket is on the push listener, so http://127.0.0.1:10604/chronik/ws answers 426 upgrade-required. Put a reverse proxy in front that sends /chronik/ws to the push listener (see Running it on your node), or create a second client whose base URL points at the push listener, for the WebSocket only.

Which chronik-client versions work #

chronik-clientHTTPWebSocketNotes
0.26.2 (Sendlotus)yesyesTested in CI against a regtest node
0.19.0 (RANK extension, Lotusia web wallet)yesyesTested in CI
0.8.5yesyesTested in CI
0.4.0yes, except blockchainInfo(), which this version does not havenoThe client throws Unknown message on BlockConnected, a message its schema does not know. Use 0.8.5 or later for the WebSocket
1.x and later (ChronikClientNode)nonoA different protocol (the in-node Chronik of Bitcoin ABC). Not served

The versions above were checked against https://chronik.givelotus.org/xpi and against a regtest node of this release, WebSocket included, on 26 November 2026.

Use it from JavaScript #

Shell
npm install chronik-client@0.26.2
JavaScript
const { ChronikClient } = require('chronik-client');
const chronik = new ChronikClient('https://chronik.givelotus.org/xpi');

// Tip
const info = await chronik.blockchainInfo();
console.log(info.tipHeight, info.tipHash);

// A block, by height or hash
const block = await chronik.block(1433870);
console.log(block.blockInfo.numTxs, block.txs.length);

// A transaction
const tx = await chronik.tx('133d43d6249a12197575abe90d08ee08a6279995e58794b86f754e6943eb23b9');
console.log(tx.block.height, tx.outputs.length);

// History and coins of a P2PKH address: the 20-byte key hash, in hex
const script = chronik.script('p2pkh', '57c67658d282726af1f68e5cd2bd13b3c18b9bdd');
const page = await script.history(0, 25);     // page 0, 25 per page
console.log(page.numPages, page.txs.map(t => t.txid));
const utxos = await script.utxos();           // [{outputScript, utxos: [...]}]
console.log(utxos[0].utxos.length);

The key hash is bytes 3 to 22 of the address's scriptPubKey. The node gives it to you: GET /api/v1/rpc/validateaddress?0=<address> returns scriptPubKey (76a914 + key hash + 88ac).

WebSocket #

JavaScript
const ws = chronik.ws({
  onMessage: msg => console.log(msg),          // AddedToMempool, Confirmed, BlockConnected, ...
  onReconnect: () => console.log('reconnecting'),
});
await ws.waitForOpen();
ws.subscribe('p2pkh', '57c67658d282726af1f68e5cd2bd13b3c18b9bdd');
JSON
{"type":"BlockConnected","blockHash":"00000000010a91044765d9881cbbf632938a469799a80a161c25175d7e4cc359"}
MessageWhenSent to
AddedToMempool, RemovedFromMempool, Confirmed, Reorg (with txid)A transaction of a subscribed scriptThe connections subscribed to that script
BlockConnected, BlockDisconnected (with blockHash)Every blockEvery connection with at least one script subscription

A transaction that touches two scripts subscribed on one connection gives one message, not two. Nothing is answered to a subscription that succeeds; a refused one gets an Error message. A connection whose queue overflows is closed with code 1008 (the protocol has no resync message); chronik-client reconnects and subscribes again by itself.

Supported calls #

RouteAnswerNotes
GET /blockchain-infoBlockchainInfoTip hash and height
GET /block/<hash or height>BlockInfo, details, raw header, every transaction (at most 20,000: 400 block-too-large)
GET /blocks/<start>/<end>BlocksAt most 500 blocks, stops at the tip
GET /tx/<txid>TxMempool or chain
GET /raw-tx/<txid>raw bytes
GET /script/<type>/<payload>/history?page=&page_size=TxHistoryPageMempool first (newest first), then confirmed, newest first
GET /script/<type>/<payload>/utxosUtxosUnconfirmed coins have blockHeight -1
POST /validate-utxosValidateUtxoResponseUNSPENT, SPENT, NO_SUCH_TX, NO_SUCH_OUTPUT; at most 1,000 outpoints
POST /broadcast-txBroadcastTxResponseRefuses a transaction that burns SLP or ALP tokens unless skip_slp_check is set
POST /broadcast-txsBroadcastTxsResponseAt most 100, sent one after the other
GET /wsWebSocketOn the push listener

Script types: p2pkh and p2sh (20-byte hash), p2pk (33 or 65-byte key), p2tr-commitment (33 bytes), other (the raw script, for scripts of a standard form only). Every Tx says network XPI.

Raw protobuf #

Without chronik-client, the wire format is protobuf over HTTP, with the schema chronik.proto of the Lotus Chronik (LotusiaStewardship chronik_nng, chronik-http/proto/chronik.proto). Every answer has Content-Type: application/x-protobuf; a POST must send that type too (else 400 invalid-content-type). Txids and block hashes are in internal byte order: reverse the 32 bytes to get the hex explorers show.

BlockchainInfo is field 1 (bytes, the tip hash) and field 2 (varint, the height). Decoded by hand in Python:

Python
import urllib.request

req = urllib.request.Request("https://chronik.givelotus.org/xpi/blockchain-info",
                             headers={"User-Agent": "my-app/1.0"})
b = urllib.request.urlopen(req).read()

def varint(b, i):
    v = s = 0
    while True:
        c = b[i]; i += 1; v |= (c & 0x7f) << s; s += 7
        if c < 0x80:
            return v, i

i, fields = 0, {}
while i < len(b):
    key, i = varint(b, i)
    if key & 7 == 2:                      # length-delimited
        n, i = varint(b, i); fields[key >> 3] = b[i:i + n]; i += n
    else:                                 # varint
        fields[key >> 3], i = varint(b, i)
print(fields[1][::-1].hex(), fields[2])   # tip hash (display order), height

For anything larger, generate a decoder from chronik.proto with your protobuf tool.

Errors #

A non-200 answer carries an Error message (error_code, msg, is_user_error), which chronik-client turns into an exception whose text holds the code.

HTTPerror_codeMeaning
400invalid-field, invalid-hash-or-height, invalid-script-payload-length, invalid-tx-encoding, bad-protobuf, invalid-content-typeMalformed request
400page-size-too-large, page-too-deep, too-many-utxos, block-too-largeOver a bound (below)
400unsupported-script-typep2tr-state is not served
400script-not-indexedA script with no address (an OP_RETURN, bare multisig)
400broadcast-rejectedThe node refused the transaction; msg says why
404not-found, block-not-found, tx-not-foundUnknown route or object
404not-emulatedGET /token/<id>: use the REST token routes
426upgrade-required/ws asked on the REST port
429rate-limitedToo many requests from your address; see Retry-After
503node_warming_up, syncing, explorer-indexing, busy, no-database, not-servedTemporary, or a thin node (not-served). Retry later or ask another node

Limits #

BoundValue
Requests per client address20 a second, burst 60 (-chronikrate); then 429
Requests reading blocks or indexes at once, for the whole node8 (-chronikmaxinflight); then 503 busy
History page size25 by default, at most 200
History depth by page numberthe first 50,000 confirmed transactions of a script; deeper, use GET /api/v1/addresses/<address>/history with its cursor
Unconfirmed transactions in a history10,000 per script
Coins per utxos answer10,000; more, use GET /api/v1/scripts/<script>/utxos with its cursor
Blocks per range, transactions per block500, 20,000
Outpoints per validate-utxos, transactions per broadcast-txs1,000, 100

WebSocket: the limits of the push endpoint (connections per address, subscriptions per connection and per address, messages per second, queue size); see Push interfaces. Public endpoints add the limits of their reverse proxy.

Known gaps #

Not the same as the original ChronikWhat to do
timeFirstSeen is 0 for confirmed transactions (the node does not keep it)Use the block time (tx.block.timestamp)
BlockInfo has no difficulty: only fields 1 to 13 (hashes, height, nBits, time, sizes, counts and sums) are filledCompute it from nBits, or read GET /api/v1/blocks/<id> (difficulty)
SLP fields (slpTxData, slpToken, slpBurn, slpMeta) are empty, and GET /token/<id> answers 404 not-emulatedUse the REST token routes /api/v1/slp/... and /api/v1/alp/...
p2tr-state queries and subscriptionsUse p2tr-commitment
The history of a p2pkh script also lists P2PK payments to the same key (and the reverse)Filter by output script; coins (utxos) are already exact
Inside one block, history is ordered by txid, not by positionSort by tx.block if you need the block order
broadcast-txs is not all-or-nothing: on the first refusal the answer is that error, and the transactions before it stay sentSend one at a time if you need to know each result
A thin node answers 503 not-servedUse a full node
chronik-client 0.4 WebSocket (see above)Use 0.8.5 or later

The old explorer API #

A thin layer over /api/v1, for code written against the eiquidus explorer. Plain values are text/plain, objects are JSON; amounts are in XPI, not satoshis. Like the old explorer, an unknown address or transaction answers 200 with {"error": ...}.

Shell
E=https://explorer.givelotus.org
curl -s $E/api/getblockcount                      # 1433883
curl -s "$E/api/getblockhash?index=1"
curl -s $E/ext/summary
curl -s $E/ext/getbalance/lotus_16PSJKoMbdnGyVQyxhuLuZxSuHvqKUy8nv98cXTVm
curl -s $E/ext/gettx/133d43d6249a12197575abe90d08ee08a6279995e58794b86f754e6943eb23b9
curl -s "$E/ext/getlastblocksajax?start=0&length=2&draw=1"
JSON
{"data":[{"difficulty":170.1241177902166,"hashrate":"6.6417","supply":2102062014.867416,"burned":28838342.25605,"blockcount":1433883,"connections":35,"lastPrice":0}]}
RouteAnswer
/api/getblockcount, getbestblockhash, getdifficulty, getnetworkhashps, getconnectioncountplain value
/api/getblockhash?index=Nplain hash
/api/getblock?hash=HJSON (as getblock)
/api/getrawtransaction?txid=T&decrypt=0 or 1hex, or JSON with decrypt=1
/api/getmininginfo, /api/getblockchaininfoJSON
/api/verifymessage?address=&signature=&message=true or false
/ext/summary{"data":[{difficulty, hashrate (GH/s, a string), supply, burned, blockcount, connections, lastPrice: 0}]}
/ext/getmoneysupply, /ext/getburnedsupplyplain XPI amount
/ext/getaddress/<address>{address, sent, received, balance, last_txs: [{txid, type}]}
/ext/getbalance/<address>plain XPI amount
/ext/gettx/<txid>{txid, timestamp, blockhash, blockindex, fee, vin: [{addresses, amount}], vout: [...], burned}
/ext/getlastblocksajax?start=&length=&draw=DataTables rows [height, hash, size, txcount, burned (0), date]
/ext/getlastprice/<market>{"error": ...}: no market is configured

Not served: /api/getpeerinfo, /api/gettxoutsetinfo, /api/getinfo, /ext/connections, /ext/getdistribution, /ext/getaddresstxsajax.

Running it on your node #

Both APIs are on by default on a full node. Behind a reverse proxy, let these paths through:

PathToNotes
/chronik/ (GET, POST, OPTIONS)the REST porta few MB of body is enough (broadcast-txs of 100 transactions)
/chronik/wsthe push listener, with the WebSocket upgrade headersthe same upstream as /api/v1/ws
/api/getblockcount, /api/getblockhash, /api/getblock, /api/getrawtransaction, /api/getdifficulty, /api/getnetworkhashps, /api/getconnectioncount, /api/getmininginfo, /api/getblockchaininfo, /api/getbestblockhash, /api/verifymessagethe REST portGET only
/ext/the REST portGET only

For clients configured with a bare Chronik host, map / to /chronik/ and /ws to /chronik/ws, and the same for /xpi/.... The per-client rate limit reads the client address from the proxy header named by -wsipheader (X-Real-IP by default). See Security.

OptionDefaultMeaning
-chronik1Serve the Chronik API
-chronikrate=<n>20Requests a second per client address
-chronikmaxinflight=<n>8Block and index reads at once
-chronikwspath=<path>/chronik/wsPath of the WebSocket on the push listeners; empty turns it off
-explorercompat1Serve the old explorer API
Source share/www/docs/chronik.md in the lotusd repository
Checked against doc/chronik-compat.md src/api/chronik_handler.cpp src/chronikcompat/proto.cpp src/chronikcompat/proto.h src/chronikcompat/ws.cpp src/api/explorer_compat_handler.cpp test/functional/interface_chronik_client.py test/functional/feature_chronik_compat.py