How farcasterxyz/snapchain works
Main Components
a) Core System Components:
• Consensus Engine (/src/consensus)
• Network Layer (/src/network)
• Storage System (/src/storage)
• Mempool (/src/mempool)
• Core Business Logic (/src/core)
• External Connectors (/src/connectors)
b) Data Flow Components:
• Protocol Buffers Interface (/src/proto)
• RPC Services
• Admin Interface
• Blockchain Events Integration
┌─ External Interface Layer ─────────────────────┐
• Admin Server │
• gRPC Interface │
• Protocol Buffers │
• Network Layer ──────────────────────────────┐ │
• P2P Gossip Protocol │ │
• RPC Extensions │ │
• Server Implementation │ │
• Core Processing Layer ────────────────────┐ │ │
• Consensus Engine │ │ │
• Message Validation │ │ │
• Mempool Management │ │ │
• Storage Layer ─────────────────────────┐ │ │ │
• RocksDB Backend │ │ │ │
• Merkle Trie Implementation │ │ │ │
• Block Store │ │ │ │
• Account Store │ │ │ │
• ┘
Key Relationships to Highlight
• Bidirectional communication between Network Layer and External Interface
• Data flow from Network Layer through Consensus to Storage
• Demonstrate how the Mempool interacts with both Consensus and Network layers
• Integration with blockchain events through connectors
Implementation Details
• RocksDB as the underlying database
• Protocol Buffers for serialization
• gRPC for API communication
• Merkle trie for state management
• P2P gossip protocol for network communication
Specific Elements
□ Rectangles: Core services
○ Circles: External interfaces
◇ Diamonds: Decision points
⬡ Hexagons: Storage components
→ Synchronous calls
⇢ Asynchronous communication
⇄ Bidirectional data flow
Additional Notes
• A clear indication of the 10,000 TPS throughput target
• How the system scales horizontally
• Configuration management points
• Test coverage points