HOW MOGGI WORKS
A deep dive into the high-performance indexing engine built specifically for Monad's 10,000 TPS throughput.
The Fast Indexer
Standard indexers can't keep up with Monad. Our "Fast Indexer" is a custom-built engine written in TypeScript utilizing Bun for maximum I/O throughput.
Parallel RPC Fetching
Instead of serial requests, we fire 20+ concurrent batch requests. We use eth_getBlockByNumber with includeTransactions=true to minimize round-trips.
WebSocket Pulse
We subscribe to the `newHeads` WebSocket stream. The moment a block is mined on Monad, our indexer wakes up and processes it instantly (< 5ms overhead).
Non-Blocking Pipeline
To handle 10,000 TPS, we decoupled fetching from writing. The main loop never stops waiting for the database.
Real-Time Push
We don't poll the database. We use PostgreSQL's native LISTEN/NOTIFY channels to turn the database into a real-time message bus.
CREATE TRIGGER notify_new_tx
AFTER INSERT ON address_transactions
FOR EACH ROW EXECUTE FUNCTION notify_tx();// The API maintains a dedicated LISTEN connection
await sqlListen.listen('new_transaction', (payload) => {
// Instantly broadcast to 10,000+ connected WebSockets
websocketServer.publish(`address:${payload.address}`, payload);
});API Architecture
Bun Runtime
We use Bun for its blazing fast HTTP server and native WebSocket implementation.
Elysia Framework
A high-performance TypeScript framework optimized for speed and end-to-end type safety.
Smart Caching
Heavy queries like "Top Holders" are materialized and cached to ensure sub-millisecond response times.