Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

msgindex

Indexer for msg, the on-chain messaging contracts for Antelope chains. msgindex follows a Roborovski action stream, stores every msg message action and the hook contracts' configuration actions in a Pebble database, and serves message history over HTTP and live events over WebSocket. It never talks to a node directly; the chain it indexes is whichever chain the action stream carries.

Building

Go 1.25 or later.

make build     # binary at ./msgindex
make install   # go install into GOPATH/bin
make test

Configuration

Configuration is INI and command-line flags; flags override the file. Copy config.ini.example to config.ini and set:

Key Meaning Default
db-path Pebble database directory ./msgindex.db
http-listen HTTP and WebSocket listen address (none to disable) :9460
http-socket Unix socket for the same API (none to disable) ./msgindex.sock
actionstream-source Roborovski actionstream URL (stream://host:port or stream:///path.sock) stream://localhost:9081
msg-contract Account holding the msg contract msg
hook-contracts Comma-separated hook accounts whose allow/disallow, block/unblock, setgate/removegate actions are indexed none
retention-hours Prune messages older than this; 0 keeps everything 0
batch-size Actions per write batch 1000
backfill-limit Messages sent on WebSocket subscribe 50
max-subs Subscriptions per WebSocket connection 50
workers GOMAXPROCS for the process 4
log-file, log-filter Log destination and category filter stdout, startup,sync,http

Run with ./msgindex --config config.ini; a config.ini in the working directory is read without the flag. A fresh database replays the stream from its first sequence; catch-up is index-driven on the stream side and fast.

API

HTTP: GET /v1/msg/get_messages, get_threads, get_tag_summary, get_channels, get_members, health. get_messages and get_tag_summary also take their arguments as a JSON body over POST. On forum channels, get_messages?tags=a,b,c returns the messages whose first three tags match in order, and get_tag_summary returns a count and latest-message preview per tuple.

WebSocket: /v1/msg/stream accepts subscribe (with channel, sub_id, and an optional backfill count), unsubscribe, and ping. A subscription receives a backfill batch, then live message, message_edited, message_deleted, reaction_added, reaction_removed, member_joined, and thread_metadata_updated events, with a heartbeat every 30 seconds.

Message ids are the action stream's global sequence, which is also the pagination cursor.

Upgrading a running instance

git pull && make build

Stop the process and start the new binary with the same configuration; the database cursor resumes from the last committed sequence.

About

Indexer and history API for msg, on-chain messaging on Antelope chains

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages