Derived Indexes

Faster reads without changing chain truth

Vorliq still stores canonical blockchain history in chain.json. The index file is a rebuildable read cache that speeds up explorer, address, transaction, block, leaderboard, and health lookups.

Source of Truth

blockchain/data/chain.json remains the source of truth for historical blocks, hashes, transactions, balances, proof of work, and audit exports. blockchain/data/indexes.json is derived metadata only. If it is missing, stale, or corrupt, Vorliq rebuilds it from the current chain instead of rewriting history.

Included Indexes

  • Blocks by index and hash.
  • Transactions by ID, address, and block.
  • Address balances and confirmed balances.
  • Miner statistics, latest blocks, treasury ledger rows, and chain summary.

Safe Persistence

indexes.json includes a schema version, build time, chain height, latest block hash, and derived indexes. It uses the same atomic write, backup-before-write, safe load, and corruption fallback patterns as other JSON storage.

Health Checks

Operators and applications can call GET /api/indexes/health. The response contains safe metadata only: status, schema version, chain height, latest hash, build time, whether the chain matches, and whether a rebuild is needed.

Admin Rebuild

The protected endpoint POST /api/admin/indexes/rebuild rebuilds indexes from the current chain and writes a fresh indexes.json. It requires the server admin token and does not expose that token in logs or responses.

Maintenance

Production maintenance checks run every 15 minutes when installed by the deployment scripts. The job checks backend health, readiness, storage health, backup visibility, and index health. It triggers an admin rebuild only when index health reports a mismatch or rebuild need. It never runs destructive restore operations.

Future Database Migration

The index layer keeps route code moving toward explicit read models while preserving JSON persistence. A later database migration can map these same read models to tables or materialized views, but this pass intentionally keeps chain.json and historical block hashes unchanged.

See Storage Adapters for the adapter policy and Schema Map for future table mappings. Index tables should be rebuilt from canonical data after migration, not imported as authority.