$ show logos-messaging/logos-delivery-js
This repository is a TypeScript monorepo implementing the Waku v2 protocol stack for decentralized, peer-to-peer messaging. It provides a comprehensive SDK (`@waku/sdk`) for building light nodes that support relay, filter, light push, and store protocols, along with advanced features like rate-limiting nullifiers (RLN) for spam protection, structured data synchronization (SDS) for reliable ordered delivery, and message encryption (ECIES/symmetric). The architecture is modular, with separate packages for core protocol logic, peer discovery (DNS, peer exchange, local cache), Ethereum Node Records (ENR), protobuf definitions, React hooks, and a local development environment via Docker Compose. The codebase targets both Node.js and browser environments, with extensive unit and integration tests using Mocha, Karma, and Playwright. While the core protocols are mature, some packages (SDS, RLN) are experimental and show signs of rapid iteration, with skipped tests and generated code that may drift from upstream specifications.
The LLM identified 5 files worth highlighting for reuse:
Implements a reusable stream pool for managing libp2p streams. Provides locking, creation, and peer update handling, allowing multiple protocol handlers (filter, light push, peer exchange) to share a single stream per peer. The pattern is isolated and could be extracted for any libp2p-based project needing stream multiplexing with concurrency control.
A queue-based dialer that manages outbound connections with cooldowns, shard validation, and immediate dialing for high-priority peers. It decouples dialing logic from connection management, making it reusable in any p2p system requiring rate-limited, prioritized peer connections.
A generic Bloom filter implementation with configurable capacity and false-positive rate. Supports serialization/deserialization and is used in the SDS protocol for probabilistic acknowledgments. The implementation is self-contained and could be reused in any project needing efficient set membership testing.
A factory for creating routing information from content topics, shard indices, or pubsub topics. It encapsulates the logic for mapping content topics to shards using SHA-256 hashing, and provides type-safe creation methods. This pattern is reusable in any Waku-compatible application or library needing shard routing.
A peer manager that selects peers based on supported protocols, with locking/unlocking to prevent concurrent use of the same peer. It emits typed events for peer changes and integrates with connection management. The design is reusable in any libp2p-based system requiring protocol-aware peer selection with concurrency control.