Offers APIs to query indexed chain state
npm install
node index.js
curl "127.0.0.1:8081/v1/accounting/transaction-log?cid=u0qj944rhWE&start=1670000000000&end=1776250900000&account=DGeoBv3E9xniabhyWsSjd25Te8ZmjQ7zndc2VVbmU8zmZQB" > transaction-log.json
Copy .env.example to .env and fill in the values:
cp .env.example .env
| Variable | Required | Default | Description |
|---|---|---|---|
SECRET_KEY |
yes | — | HMAC secret for cookie-session signing |
DB_URL |
yes | — | MongoDB connection string |
ENCOINTER_RPC |
no | wss://kusama.api.encointer.org |
Polkadot RPC endpoint |
INDEXER_ENDPOINT |
no | http://localhost:3000 |
Indexer API URL |
Many endpoints (accounting data, rewards, volume reports) cache their results in MongoDB once the underlying data is immutable (past months, past ceremony indices). First requests for uncached data are slow (minutes for RPC-heavy endpoints). The warm-caches script pre-populates these caches and doubles as a smoke test.
All scripts load .env automatically via dotenv — no need to source .env.
node scripts/warm-caches.js --quickOnly tests the current year and skips RPC-heavy endpoints. Good for CI and verifying the server is healthy.
node scripts/warm-caches.jsThis hits every community × every year since 2022, including rewards-data, money-velocity, all-accounts-data, and sankey reports. On a cold cache this can take hours — individual RPC-heavy endpoints may need up to 10 minutes each.
If you don't have the SECRET_KEY but have user credentials:
BASE_URL=https://accounting.encointer.org \
AUTH_ADDRESS=<your-address> AUTH_PASSWORD=<your-password> \
node scripts/warm-caches.jsDrop all cached data from MongoDB (account_data, rewards_data, general_cache):
node scripts/purge-caches.jsnpm test # same as warm-caches --quick
npm run warm-caches # full warm-up
npm run purge-caches # drop all caches