SmartMiner is a fully automated, containerized cryptocurrency mining system designed for CPU mining (RandomX algorithms). It doesn't just mine; it thinks.
By continuously scraping real-time network data and calculating profitability based on your hardware, SmartMiner autonomously switches your workers to the most profitable coin (Monero, Zephyr, Etica, QuantumRL, Dagger). This intelligent Docker orchestration ensures your mining operations are always optimized for maximum returns.
- 🚀 Core Features
- 🏗️ System Architecture
- 📁 Project Structure
- 🚀 Quick Start
- 🎮 Management & Control
- 🔧 Advanced Configuration
- 🔒 Security Considerations
- 🤝 Contributing
- 📄 License
- 🙏 Acknowledgments
- Real-time Market Analysis: Scrapes MiningPoolStats for network hashrate, difficulty, and coin emission data
- Profit Optimization: Automatically switches coins based on configurable profit thresholds (default 5% increase)
- Smart Scheduling: Analyzes profitability every 8 hours with configurable intervals
- Container Orchestration: Dynamic XMRig container lifecycle management with error recovery
- Real-time Monitoring: Streamlit-based web interface for farm-wide oversight
- Multi-worker Support: Monitor multiple mining rigs from a single dashboard
- Hardware Metrics: CPU/VRM temperatures, system uptime, and performance data
- Financial Tracking: USD and native coin profitability calculations
- Remote Management: One-click SSH access to worker nodes
- Docker-in-Docker: Manager controls worker containers with elevated privileges
- Optimized Workers: XMRig containers with HugePages and MSR optimizations
- Resource Management: Configurable thread allocation and resource monitoring
- Clean Switching: Seamless transitions between mining coins without downtime
- Headless Chromium: Selenium-based JavaScript rendering for dynamic content
- Anti-Bot Evasion: Stealth techniques with user agent spoofing
- Concurrent Processing: Multi-threaded scraping for faster data collection
- Error Recovery: Robust fallback mechanisms for failed requests
- Discord Integration: Real-time alerts for miner events and coin switches
- Command Interface: Named pipe control for manual mining operations
- API Wrapper: Enhanced HTTP API (port 4000) with system sensor integration
- Order Server: Serves
json/directory content (orders, status) via HTTP (port 16001) for external consumption. - Comprehensive Logging: Detailed operation logs with error tracking
┌─────────────────────────────────────────────────────────────────┐
│ SmartMiner Farm │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Manager │ │ Dashboard │ │ External XMRig │ │
│ │ (Port 4000) │ │ (Port 16000) │ │ Workers │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ │
│ │ Order Server │ │
│ │ (Port 16001) │ │
│ └─────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Discord Bot │ │ Web Scraper │ │ Docker Engine │ │
│ │ (Notifications) │ │ (Selenium) │ │ (Orchestration) │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Command Pipe │ │ API Wrapper │ │ Hardware Sensors│ │
│ │ (/tmp/miner) │ │ (Enhanced) │ │ (CPU/VRM Temp) │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Mining Pool Networks │
│ (Monero, Zephyr, Etica, QuantumRL, Dagger) │
└─────────────────────────────────────────────────────────────────┘
The `json/` directory acts as a central hub for inter-component communication, storing mining orders (`order.json`) and real-time status updates (`status.json`) consumed by both the Dashboard and external mining workers.
SmartMiner/
├── manager/ # 🧠 Autonomous "Brain"
│ ├── main.py # Main orchestrator loop
│ ├── strategy.py # Profitability analysis engine
│ ├── miner_controller.py # Docker container management
│ ├── api_wrapper.py # Enhanced API server (port 4000)
│ ├── discord_service.py # Discord bot integration
│ ├── jsTrigger.py # Selenium web scraper
│ ├── soupManager.py # BeautifulSoup data parser
│ ├── commands.py # Named pipe command interface
│ ├── utils.py # Logging and utilities
│ └── config.py # Configuration settings
├── dashboard/ # 📊 Monitoring "Eyes"
│ ├── app.py # Streamlit dashboard application
│ ├── ui_components.py # Dashboard UI components
│ ├── data_provider.py # API client for manager data
│ ├── config.py # Dashboard configuration
│ └── requirements.txt # Python dependencies
├── json/ # 📋 Configuration Files
│ ├── status.json # Real-time status for dashboard
│ └── order.json # Current mining orders
├── docker-compose.yml # 🐳 Defines and runs the multi-container SmartMiner application
└── README.md # 📖 Project documentation
- Operating System: Linux (Ubuntu/Debian recommended) with kernel 4.0+
- Docker: Engine 20.10.0+ and Docker Compose 2.0.0+
- Hardware: CPU with AES-NI support, 4GB+ RAM (8GB+ recommended)
- Network: Internet access for mining pool data scraping
- Optional: HugePages enabled for maximum performance
-
Clone the repository
git clone https://github.com/Bagguet/SmartMiner.git cd SmartMiner -
Set up Discord notifications (optional)
cp manager/.example.env manager/.env # Edit with your Discord bot token and user ID -
Set up config for dashboard
cp dashboard/config.example.py dashboard/config.py # Edit with your worker configurations -
Start the complete stack
docker compose up -d --build
-
Access the dashboard
http://YOUR_SERVER_IP:16000
# View manager logs (brain activity)
docker logs -f manager
# View dashboard logs (UI activity)
docker logs -f dashboard
# View all services status
docker ps
# Check real-time API data
curl http://localhost:4000/1/summary# Stop all mining operations
docker compose down
# Restart specific service
docker compose restart manager
# Update and rebuild
docker compose up -d --build# Performance Tuning
MY_HASHRATE_KH = 17.3 # Your hardware hashrate in kH/s
INCOME_TRESHOLD = 1.05 # Profit increase threshold (5%)
HOURS_INTERVAL = 8 # Analysis interval in hours
MINER_THREADS = 1 # XMRig thread count
# Container Configuration
CONTAINER_NAME = "active_miner_worker"
IMAGE_NAME = "smartminer_worker_img:latest"# Worker Configuration
MINERS_CONFIG = [
{
"name": "Rig1 - Ryzen 9 5950X",
"ip": "192.168.x.xx",
"port": 4000,
"ssh_user": "miner0"
}
]
# Refresh Settings
REFRESH_RATE_SECONDS = 60 # Dashboard refresh interval
API_TIMEOUT = 2 # API request timeout- Privileged Access: Manager runs with elevated privileges for Docker control
- Socket Access: Requires access to
/var/run/docker.sock - Hardware Access: Read access to
/sys/class/hwmonfor temperature monitoring
- Wallet Security: Wallet files are automatically excluded from git
- Token Protection: Discord tokens stored in
.envfiles - Network Security: Only run on trusted networks
- Use dedicated mining system with limited user access
- Regularly update Docker and system packages
- Monitor logs for unusual activity
- Consider firewall rules for dashboard access
We welcome contributions to improve SmartMiner!
- Fork and clone the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes and test thoroughly
- Submit pull request with detailed description
- Additional Coins: Support for more RandomX-based cryptocurrencies
- GPU Mining: Extend support for GPU mining algorithms
- Mobile App: React Native or Flutter mobile interface
- Database Integration: Historical data storage and trend analysis
- Alert System: Email/webhook notifications for worker issues
- Multi-User: Authentication and role-based access control
This project is licensed under the MIT License - see LICENSE for details.
- XMRig - High-performance CPU mining software
- Streamlit - Beautiful dashboard framework
- MiningPoolStats - Real-time mining pool statistics
- Selenium - Web automation and scraping
- Docker - Container orchestration platform
⚡ Powered by SmartMiner ⛏️
Made with ❤️ for the crypto mining community