Skip to content

wind-network/sni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🌊 SNI - Solana Network Indexer

Rust License Build Status Solana

A fast Solana indexer powered by Tide engine

Features β€’ Quick Start β€’ Architecture β€’ Configuration β€’ API Reference


πŸš€ Overview

SNI (Solana Network Indexer) is a high-performance blockchain indexer designed specifically for the Solana network. Built with Rust and powered by the innovative Tide engine, SNI provides real-time indexing capabilities with minimal latency and maximum throughput.

Why SNI?

  • ⚑ Ultra-fast Processing: Built on the Tide engine for maximum performance
  • πŸ”„ Real-time Indexing: Live blockchain data streaming and processing
  • πŸ’Ύ Flexible Storage: SQLite support with planned PostgreSQL integration
  • πŸ›‘οΈ Production Ready: Robust error handling and comprehensive monitoring
  • 🧩 Modular Design: Clean architecture with pluggable components
  • πŸ“Š Rich Metrics: Detailed performance and health monitoring

✨ Features

Core Functionality

  • πŸ—οΈ Block Processing: Complete block data indexing with transaction details
  • πŸ’° Account Tracking: Real-time account state changes and updates
  • πŸ”— Transaction Indexing: Full transaction history with metadata
  • πŸ“ˆ Slot Monitoring: Slot progression and consensus tracking

Performance & Reliability

  • ⚑ High Throughput: Optimized for handling Solana's high TPS
  • πŸ”„ Automatic Recovery: Resilient to network interruptions
  • πŸ“Š Health Monitoring: Comprehensive network and system health checks
  • 🎯 Smart Buffering: Intelligent data buffering and batching

Developer Experience

  • πŸ› οΈ Easy Setup: Simple configuration and deployment
  • πŸ“ Rich Logging: Detailed tracing and debugging support
  • πŸ”§ CLI Interface: Intuitive command-line tools
  • πŸ“– Comprehensive Docs: Detailed documentation and examples

πŸ—οΈ Architecture

SNI is built on a modular architecture leveraging the powerful Tide engine:

graph TB
    subgraph "SNI Core"
        NM[Network Monitor]
        IE[Indexer Engine]
        SM[Storage Manager]
        API[API Layer]
    end
    
    subgraph "Tide Engine"
        TC[tide-core]
        TG[tide-geyser]
        TO[tide-output]
        TCONF[tide-config]
        TCOMM[tide-common]
    end
    
    subgraph "Solana Network"
        RPC[RPC Nodes]
        VAL[Validators]
        GEY[Geyser Streams]
    end
    
    subgraph "Storage Layer"
        SQLITE[(SQLite DB)]
        POSTGRES[(PostgreSQL)]
    end
    
    subgraph "Output Formats"
        JSON5[JSON5 Files]
        PARQUET[Parquet Files]
        METRICS[Metrics & Logs]
    end
    
    %% Core connections
    NM --> RPC
    NM --> VAL
    IE --> TC
    IE --> TG
    SM --> SQLITE
    SM --> POSTGRES
    
    %% Tide engine internal
    TC --> TO
    TC --> TCONF
    TC --> TCOMM
    TG --> GEY
    TO --> JSON5
    TO --> PARQUET
    TO --> METRICS
    
    %% Data flow
    GEY -.->|Stream Data| TG
    RPC -.->|Block Data| NM
    VAL -.->|Validator Info| NM
    
    %% Processing flow
    TG -->|Processed Data| IE
    IE -->|Indexed Data| SM
    TC -->|Formatted Output| TO
    
    %% Styling
    classDef coreComponent fill:#e1f5fe,stroke:#01579b,stroke-width:2px
    classDef tideComponent fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
    classDef solanaComponent fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
    classDef storageComponent fill:#fff3e0,stroke:#e65100,stroke-width:2px
    classDef outputComponent fill:#fce4ec,stroke:#880e4f,stroke-width:2px
    
    class NM,IE,SM,API coreComponent
    class TC,TG,TO,TCONF,TCOMM tideComponent
    class RPC,VAL,GEY solanaComponent
    class SQLITE,POSTGRES storageComponent
    class JSON5,PARQUET,METRICS outputComponent
Loading

Key Components

  • 🌊 Tide Engine: Core processing engine providing high-performance data streaming
  • πŸ“‘ Network Monitor: Real-time network health and validator tracking
  • βš™οΈ Indexer Engine: Main processing logic for blockchain data
  • πŸ’Ύ Storage Manager: Flexible data persistence layer
  • πŸ”§ Configuration: Comprehensive configuration management

πŸš€ Quick Start

Prerequisites

  • Rust 1.70+ - Install from rustup.rs
  • Git - For cloning the repository

Installation

  1. Clone the repository

    git clone https://github.com/your-org/sni.git
    cd sni
  2. Build the project

    cargo build --release
  3. Run health check

    ./target/release/sni health
  4. Start indexing (with default config)

    ./target/release/sni start

Development Setup

For development with the Tide workspace:

# Navigate to the project directory
cd /path/to/your/windexer/sni

# Build with development dependencies
cargo build

# Run with debug logging
./target/debug/sni start --debug

# Check project status
cargo check

βš™οΈ Configuration

SNI uses TOML configuration files for easy customization:

Basic Configuration (sni.toml)

[network]
rpc_url = "https://api.mainnet-beta.solana.com"
websocket_url = "wss://api.mainnet-beta.solana.com"
commitment = "confirmed"
timeout_seconds = 30

[storage]
database_url = "sqlite:sni.db"
batch_size = 1000
max_connections = 10

[indexer]
start_slot = "latest"
enable_account_indexing = true
enable_transaction_indexing = true
buffer_size = 10000

[logging]
level = "info"
file = "sni.log"

Advanced Configuration

For production deployments, see config/production.toml for advanced settings including:

  • Custom RPC endpoints
  • Performance tuning parameters
  • Monitoring and alerting configuration
  • Database optimization settings

πŸ“š Usage Examples

Basic Operations

# Check network connectivity
sni health

# Start indexing from latest slot
sni start

# Start with custom config
sni start --config custom.toml

# Enable debug logging
sni start --debug

# Show version information
sni version

Programmatic Usage

use sni::{SolanaIndexer, config::SniConfig};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Load configuration
    let config = SniConfig::load("sni.toml")?;
    
    // Create and start indexer
    let mut indexer = SolanaIndexer::new(config).await?;
    indexer.start().await?;
    
    Ok(())
}

πŸ“Š Monitoring & Metrics

SNI provides comprehensive monitoring out of the box:

Built-in Metrics

  • πŸ“ˆ Processing Stats: Blocks, transactions, and accounts processed
  • ⏱️ Performance: Processing latency and throughput metrics
  • 🌐 Network Health: RPC connectivity and validator status
  • πŸ’Ύ Storage: Database size and query performance
  • πŸ”„ System: Memory usage and resource utilization

Health Check Output

βœ… Network Status:
   Current Slot: 245123456
   Current Epoch: 567
   Slot in Epoch: 123456/432000
   Solana Version: 1.18.22
   Block Lag: 2s
βœ… Network is healthy and reachable

SNI Stats - Uptime: 3600s | Blocks: 1234 | Transactions: 45678 | Accounts: 12345 | Latency: 15ms

πŸ› οΈ Development

Project Structure

sni/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs          # CLI interface and application entry
β”‚   β”œβ”€β”€ config.rs        # Configuration management
β”‚   β”œβ”€β”€ indexer.rs       # Core indexing engine
β”‚   β”œβ”€β”€ network.rs       # Network monitoring and RPC client
β”‚   β”œβ”€β”€ storage.rs       # Data persistence layer
β”‚   └── api.rs          # API endpoints (future)
β”œβ”€β”€ config/             # Configuration templates
β”œβ”€β”€ docs/              # Documentation
└── tests/             # Integration tests

Building from Source

# Development build
cargo build

# Release build with optimizations
cargo build --release

# Run tests
cargo test

# Check code quality
cargo clippy
cargo fmt

# Generate documentation
cargo doc --open

Running Tests

# Unit tests
cargo test --lib

# Integration tests
cargo test --test integration

# All tests with output
cargo test -- --nocapture

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Contribution Steps

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite (cargo test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

πŸ“‹ Roadmap

Current Version (v0.1.0)

  • βœ… Basic block and transaction indexing
  • βœ… SQLite storage backend
  • βœ… Network health monitoring
  • βœ… CLI interface

Upcoming Features

  • πŸ”„ v0.2.0: PostgreSQL support, enhanced metrics
  • πŸ”„ v0.3.0: GraphQL API, advanced querying
  • πŸ”„ v0.4.0: Distributed processing, horizontal scaling
  • πŸ”„ v0.5.0: Real-time WebSocket API, pub/sub system

πŸ“„ License

This project is dual-licensed under:

You may choose either license at your option.


πŸ™ Acknowledgments

  • Solana Foundation - For the overall support and amazing docs and platform
  • Tide Engine - For the high-performance processing framework
  • Rust Community - For the incredible tools and ecosystem
  • Contributors - For making this project better

πŸ“ž Support


Built with ❀️ by the Wind Network team

⭐ Star this repo if you find it useful! ⭐

About

solana network indexer, built on top of tide

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages