Skip to content

Backend

Role: Indexer Only

The backend is a pure indexer. It reads events from the IOTA blockchain and caches them in SQLite for fast querying. It does not sign transactions or hold user private keys. The only wallet the server holds is for the faucet (dispensing test tokens).

Key Components

FileDescription
api/utility/ForumManager.jsSyncs blockchain events to SQLite, uses eventAuthor (verified on-chain)
api/utility/iota.jsIOTA SDK wrapper: query events, subscribe to new events
api/utility/db.jsSQLite schema definition and model factory
api/controllers/REST API controllers (read-only + faucet)
config/bootstrap.jsServer initialization: wallet, sync, polling

ForumManager

ForumManager.processTransaction() is the core indexing function. When processing events:

  • It reads the eventAuthor field from the blockchain event, which is verified on-chain by IOTA validators
  • It ignores any data.authorId from the event payload to prevent impersonation
  • It decompresses gzipped data and stores structured records in SQLite

SQLite Schema

The database is a rebuildable cache — it can be fully reconstructed by replaying blockchain events.

TableContents
usersRegistered users with roles and profiles
threadsForum threads with metadata
postsThread replies and content
votesUpvotes and downvotes
tipsTip records (sender, recipient, amount)
escrowsEscrow state (parties, amounts, status)
reputationsTrade ratings and reputation scores
badgesBadge ownership and configuration

REST API

All read endpoints serve cached data from SQLite. Write operations return 410 Gone — all writes happen directly on-chain.

See the API Reference for the full endpoint list.

Event Tags

The backend processes events based on their tag:

TagSource FunctionMin. Role
FORUM_USERregister()None
FORUM_THREADpost_event()USER
FORUM_POSTpost_event()USER
FORUM_VOTEpost_event()USER
FORUM_CATEGORYmod_post_event()MODERATOR
FORUM_MODERATIONmod_post_event()MODERATOR
FORUM_ROLEadmin_post_event()ADMIN
FORUM_CONFIGadmin_post_event()ADMIN
FORUM_TIPOn-chain eventUSER
FORUM_SUBSCRIPTIONOn-chain eventUSER
FORUM_PURCHASEOn-chain eventUSER
FORUM_BADGEOn-chain eventUSER
FORUM_ESCROW_CREATEDOn-chain eventUSER
FORUM_ESCROW_UPDATEDOn-chain eventUSER
FORUM_RATINGOn-chain eventUSER