Real-time Solana program monitoring and alerting system with advanced security rules and multi-channel notifications.
Solana Watchtower is an open-source, production-ready monitoring system for Solana programs. It provides real-time WebSocket monitoring, custom alerting rules, performance metrics, and comprehensive notification channels.
- WebSocket and Geyser plugin integration for live program event tracking
- Account and instruction monitoring with configurable filters
- Transaction pattern analysis and anomaly detection
- Program state change tracking
- Built-in security rules (liquidity drops, large transactions, oracle deviations)
- Custom rule engine with Rust-based rule development
- Alert batching and rate limiting to prevent spam
- Severity-based alert routing and escalation
- Email: SMTP with HTML/text templates
- Telegram: Bot integration with rich formatting
- Slack: Webhook and app integrations
- Discord: Webhook notifications with embeds
- Prometheus integration with custom metrics
- Real-time performance tracking and analytics
- Historical data analysis with configurable retention
- Grafana-ready dashboards and visualizations
- Real-time monitoring dashboard with WebSocket updates
- Alert management and configuration interface
- Historical metrics and trend analysis
- Responsive design for mobile and desktop
- Modular Rust crate architecture
- Comprehensive error handling and logging
- Configuration validation and testing tools
- Docker containers with orchestration support
- Rust: 1.80+ (for local builds)
- Docker: 20.10+ (recommended for deployment)
- Solana RPC: Access to Solana RPC and WebSocket endpoints
# Clone the repository
git clone https://github.com/hasip-timurtas/solana-watchtower.git
cd solana-watchtower
# Copy and configure environment
cp docker/env.example .env
nano .env # Configure RPC URLs and notification settings
# Start with Docker Compose
docker-compose -f docker/docker-compose.yml up -d
# Access the dashboard
open http://localhost:8080
# Build from source
git clone https://github.com/hasip-timurtas/solana-watchtower.git
cd solana-watchtower
cargo build --release
# Copy example configuration
cp configs/watchtower.toml ./my-config.toml
nano my-config.toml # Edit with your settings
# Start monitoring
./target/release/watchtower start --config ./my-config.toml
# Start monitoring with default configuration
watchtower start
# Start with custom configuration and verbose logging
watchtower start --config ./custom.toml --verbose
# Test notification channels
watchtower test-notifications --config ./config.toml
# Validate configuration file
watchtower validate-config --config ./config.toml
# List available monitoring rules
watchtower rules list
# Get detailed help
watchtower --help
Access the dashboard at http://localhost:8080
to:
- Monitor real-time alerts and program activity
- Configure monitoring rules and thresholds
- Manage notification channels and settings
- View historical metrics and performance data
Create a watchtower.toml
configuration file:
# Solana connection settings
[solana]
rpc_url = "https://api.mainnet-beta.solana.com"
ws_url = "wss://api.mainnet-beta.solana.com"
# Programs to monitor
[[programs]]
name = "my-defi-protocol"
address = "YourProgramPublicKey..."
monitor_accounts = true
monitor_instructions = true
# Monitoring rules
[[rules]]
name = "large-transaction"
type = "transaction_size"
threshold = 1000000 # 1M lamports
severity = "high"
# Notification settings
[notifications]
[[notifications.channels]]
name = "telegram-alerts"
type = "telegram"
enabled = true
bot_token = "your-bot-token"
chat_id = "your-chat-id"
See examples/configs/
for comprehensive configuration examples:
basic-mainnet.toml
- Simple mainnet monitoringdefi-focused.toml
- DeFi protocol monitoringproduction-multi-program.toml
- Enterprise setup
Solana Watchtower maintains a strong security posture:
- β 60% reduction in security vulnerabilities through recent updates
- β Updated dependencies: Solana SDK 1.16β1.18, Prometheus, Validator
- β
Documented risks: All remaining issues documented in
SECURITY.md
- β Low risk profile: Read-only monitoring, no private key handling
Component | Improvement | Impact |
---|---|---|
Solana SDK | 1.16 β 1.18 | Fixed multiple cryptographic vulnerabilities |
Prometheus | 0.13 β 0.14 | Updated to secure version |
Validator | 0.16 β 0.20 | Resolved IDNA vulnerability |
Docker | Rust nightly | Support for latest security features |
3 remaining low-risk vulnerabilities from Solana ecosystem dependencies. See SECURITY.md
for complete details and mitigation strategies.
solana-watchtower/
βββ crates/
β βββ cli/ # Command-line interface
β βββ engine/ # Core monitoring engine and rules
β βββ subscriber/ # Solana WebSocket client and event processing
β βββ notifier/ # Multi-channel notification system
β βββ dashboard/ # Web dashboard and API
βββ configs/ # Configuration examples
βββ docker/ # Docker deployment files
βββ examples/ # Usage examples and templates
- Subscriber: Connects to Solana RPC/WebSocket, processes events
- Engine: Applies monitoring rules, generates alerts
- Notifier: Manages notification channels and rate limiting
- Dashboard: Web interface and metrics API
Create custom monitoring rules by implementing the Rule
trait:
use watchtower_engine::{Rule, RuleContext, AlertSeverity};
pub struct CustomLiquidationRule {
threshold: u64,
}
impl Rule for CustomLiquidationRule {
fn name(&self) -> &str {
"custom_liquidation"
}
fn check(&self, ctx: &RuleContext) -> Option<Alert> {
// Your custom logic here
if liquidation_detected(&ctx.event) {
Some(Alert {
severity: AlertSeverity::High,
message: "Large liquidation detected".to_string(),
program: ctx.program.clone(),
// ... more fields
})
} else {
None
}
}
}
# Development environment
docker-compose -f docker/docker-compose.yml up -d
# Production with nginx and monitoring
docker-compose -f docker/docker-compose.yml --profile production up -d
- Watchtower: Main monitoring application
- Redis: Alert deduplication and rate limiting
- Prometheus: Metrics storage and analysis
- Grafana: Visualization dashboards
- Nginx: Reverse proxy (production profile)
See docker/README.md
for detailed deployment instructions.
- Program activity rates and transaction volumes
- Alert generation rates and severity distribution
- WebSocket connection health and latency
- Notification delivery success rates
# Scrape configuration for Prometheus
scrape_configs:
- job_name: 'watchtower'
static_configs:
- targets: ['watchtower:9090']
Pre-configured dashboards available in docker/grafana/dashboards/
.
name: Watchtower Security Check
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Watchtower
run: |
docker build -f docker/Dockerfile .
- name: Security Audit
run: |
cargo audit
continue-on-error: true # Documented acceptable risks
The examples/
directory contains:
- Configuration Examples: Ready-to-use configs for different scenarios
- Custom Rules: Example rule implementations for specific use cases
- Notification Templates: Channel-specific message formatting
- Deployment Scripts: Infrastructure as Code examples
- Integration Examples: Webhook receivers and API clients
We welcome contributions! Please see our contributing guidelines.
# Clone and setup
git clone https://github.com/hasip-timurtas/solana-watchtower.git
cd solana-watchtower
# Install dependencies
cargo build
# Run tests
cargo test
# Check formatting and lints
cargo fmt --check
cargo clippy -- -D warnings
- Create a feature branch
- Implement your changes
- Add tests and documentation
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Project Wiki
- Security: Security Policy
- Docker: Deployment Guide
- Examples: Configuration Examples
- Issues: GitHub Issues
- The Solana Foundation for supporting monitoring infrastructure
- The Rust community for excellent tooling and libraries
- Contributors and early adopters who help improve the project
Built with β€οΈ by Hasip Timurtas for the Solana ecosystem*