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-client0.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 #
| What | Public endpoint | On your own node |
|---|---|---|
| Chronik HTTP | https://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 WebSocket | wss://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 explorer | https://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.
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-client | HTTP | WebSocket | Notes |
|---|---|---|---|
| 0.26.2 (Sendlotus) | yes | yes | Tested in CI against a regtest node |
| 0.19.0 (RANK extension, Lotusia web wallet) | yes | yes | Tested in CI |
| 0.8.5 | yes | yes | Tested in CI |
| 0.4.0 | yes, except blockchainInfo(), which this version does not have | no | The 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) | no | no | A 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 #
npm install chronik-client@0.26.2const { 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 #
const ws = chronik.ws({
onMessage: msg => console.log(msg), // AddedToMempool, Confirmed, BlockConnected, ...
onReconnect: () => console.log('reconnecting'),
});
await ws.waitForOpen();
ws.subscribe('p2pkh', '57c67658d282726af1f68e5cd2bd13b3c18b9bdd');{"type":"BlockConnected","blockHash":"00000000010a91044765d9881cbbf632938a469799a80a161c25175d7e4cc359"}| Message | When | Sent to |
|---|---|---|
AddedToMempool, RemovedFromMempool, Confirmed, Reorg (with txid) | A transaction of a subscribed script | The connections subscribed to that script |
BlockConnected, BlockDisconnected (with blockHash) | Every block | Every 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 #
| Route | Answer | Notes |
|---|---|---|
GET /blockchain-info | BlockchainInfo | Tip hash and height |
GET /block/<hash or height> | Block | Info, details, raw header, every transaction (at most 20,000: 400 block-too-large) |
GET /blocks/<start>/<end> | Blocks | At most 500 blocks, stops at the tip |
GET /tx/<txid> | Tx | Mempool or chain |
GET /raw-tx/<txid> | raw bytes | |
GET /script/<type>/<payload>/history?page=&page_size= | TxHistoryPage | Mempool first (newest first), then confirmed, newest first |
GET /script/<type>/<payload>/utxos | Utxos | Unconfirmed coins have blockHeight -1 |
POST /validate-utxos | ValidateUtxoResponse | UNSPENT, SPENT, NO_SUCH_TX, NO_SUCH_OUTPUT; at most 1,000 outpoints |
POST /broadcast-tx | BroadcastTxResponse | Refuses a transaction that burns SLP or ALP tokens unless skip_slp_check is set |
POST /broadcast-txs | BroadcastTxsResponse | At most 100, sent one after the other |
GET /ws | WebSocket | On 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:
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), heightFor 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.
| HTTP | error_code | Meaning |
|---|---|---|
| 400 | invalid-field, invalid-hash-or-height, invalid-script-payload-length, invalid-tx-encoding, bad-protobuf, invalid-content-type | Malformed request |
| 400 | page-size-too-large, page-too-deep, too-many-utxos, block-too-large | Over a bound (below) |
| 400 | unsupported-script-type | p2tr-state is not served |
| 400 | script-not-indexed | A script with no address (an OP_RETURN, bare multisig) |
| 400 | broadcast-rejected | The node refused the transaction; msg says why |
| 404 | not-found, block-not-found, tx-not-found | Unknown route or object |
| 404 | not-emulated | GET /token/<id>: use the REST token routes |
| 426 | upgrade-required | /ws asked on the REST port |
| 429 | rate-limited | Too many requests from your address; see Retry-After |
| 503 | node_warming_up, syncing, explorer-indexing, busy, no-database, not-served | Temporary, or a thin node (not-served). Retry later or ask another node |
Limits #
| Bound | Value |
|---|---|
| Requests per client address | 20 a second, burst 60 (-chronikrate); then 429 |
| Requests reading blocks or indexes at once, for the whole node | 8 (-chronikmaxinflight); then 503 busy |
| History page size | 25 by default, at most 200 |
| History depth by page number | the first 50,000 confirmed transactions of a script; deeper, use GET /api/v1/addresses/<address>/history with its cursor |
| Unconfirmed transactions in a history | 10,000 per script |
Coins per utxos answer | 10,000; more, use GET /api/v1/scripts/<script>/utxos with its cursor |
| Blocks per range, transactions per block | 500, 20,000 |
Outpoints per validate-utxos, transactions per broadcast-txs | 1,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 Chronik | What 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 filled | Compute 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-emulated | Use the REST token routes /api/v1/slp/... and /api/v1/alp/... |
p2tr-state queries and subscriptions | Use 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 position | Sort 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 sent | Send one at a time if you need to know each result |
A thin node answers 503 not-served | Use 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": ...}.
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"const E = 'https://explorer.givelotus.org';
const height = Number(await (await fetch(`${E}/api/getblockcount`)).text());
const {data: [summary]} = await (await fetch(`${E}/ext/summary`)).json();
console.log(height, summary.supply, summary.burned);{"data":[{"difficulty":170.1241177902166,"hashrate":"6.6417","supply":2102062014.867416,"burned":28838342.25605,"blockcount":1433883,"connections":35,"lastPrice":0}]}| Route | Answer |
|---|---|
/api/getblockcount, getbestblockhash, getdifficulty, getnetworkhashps, getconnectioncount | plain value |
/api/getblockhash?index=N | plain hash |
/api/getblock?hash=H | JSON (as getblock) |
/api/getrawtransaction?txid=T&decrypt=0 or 1 | hex, or JSON with decrypt=1 |
/api/getmininginfo, /api/getblockchaininfo | JSON |
/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/getburnedsupply | plain 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:
| Path | To | Notes |
|---|---|---|
/chronik/ (GET, POST, OPTIONS) | the REST port | a few MB of body is enough (broadcast-txs of 100 transactions) |
/chronik/ws | the push listener, with the WebSocket upgrade headers | the 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/verifymessage | the REST port | GET only |
/ext/ | the REST port | GET 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.
| Option | Default | Meaning |
|---|---|---|
-chronik | 1 | Serve the Chronik API |
-chronikrate=<n> | 20 | Requests a second per client address |
-chronikmaxinflight=<n> | 8 | Block and index reads at once |
-chronikwspath=<path> | /chronik/ws | Path of the WebSocket on the push listeners; empty turns it off |
-explorercompat | 1 | Serve the old explorer API |
