A comprehensive monitoring service for the Starcoin blockchain that tracks large transactions and provides real-time alerts via Telegram.
- 🔍 Real-time Monitoring: Continuously monitors Starcoin blockchain for large transactions
- 📱 Telegram Integration: Sends alerts to Telegram when large transactions are detected
- 🤖 Interactive Bot: Telegram bot with commands to query transaction data
- 📊 Query Capabilities: Query transactions by block range, get summaries, and check balances
- 🚀 PubSub Support: Real-time event-driven monitoring using WebSocket subscriptions
cargo run --release
/start
or/help
- Show help message with available commands/transactions <start_block> <end_block>
- Get large transactions in block range
-
Clone the repository
git clone <repository-url> cd starcoin-monitor
-
Install Rust dependencies
cargo build --release
-
Set up environment variables
cp env.example .env # Edit .env with your configuration
-
Configure your Telegram Bot
- Create a bot via @BotFather
- Get your bot token and chat ID
- Update the
.env
file with your credentials
Edit the .env
file with your settings:
# Starcoin RPC URL
STARCOIN_RPC_URL=ws://main.seed.starcoin.org:9870
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
# Database Configuration
DATABASE_URL=sqlite:starcoin_monitor.db
# Monitoring Configuration
MIN_TRANSACTION_AMOUNT=1000000000 # 1 STC in nano units
BLOCK_SUBSCRIPTION_INTERVAL=1000 # milliseconds (polling mode only)
# Start with default polling mode
cargo run --release
# With custom log level
cargo run --release -- --log-level debug
# Start with PubSub mode for real-time monitoring
cargo run --release -- --pubsub
# With debug logging
cargo run --release -- --pubsub --log-level debug
- Send
/start
to get help - Use commands to query transaction data
- Receive automatic alerts for large transactions
- Monitor Service: Continuously polls Starcoin RPC for new blocks and transactions
- PubSub Service: Real-time event-driven monitoring using WebSocket subscriptions
- Database Layer: SQLite database for storing transaction data and alerts
- Telegram Bot: Interactive bot for querying data and receiving alerts
- Configuration: Environment-based configuration management
- Rust 1.70+
- SQLite
- Telegram Bot Token
cargo build
cargo test
cargo run --release
The service uses structured logging with different levels:
info
: General operational informationwarn
: Warning messageserror
: Error messages
- Usage Guide - Detailed usage instructions
- PubSub Guide - PubSub mode documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.
For issues and questions:
- Create an issue on GitHub
- Contact the maintainers
- Check the documentation
- WebSocket subscription for real-time updates
- Support for multiple tokens
- Advanced filtering options
- Web dashboard
- Email notifications
- Slack integration