A comprehensive command-line tool for managing fleets of Bitcoin miners, PDUs, and managed switches. Supports multiple firmware types, IP ranges in CIDR notation, and provides real-time monitoring with multiple output formats.
Miner CLI is a unified management interface designed for Bitcoin mining operations of any scale. It provides a single tool to:
- Manage Bitcoin Miners: Support for CGMiner API, Braiins OS, Vnish firmware, and more
- Monitor Performance: Real-time hashrate, temperature, power consumption, and tuning status
- Control Infrastructure: PDU power management and network switch configuration (coming soon)
- Fleet Operations: Execute commands across hundreds of devices simultaneously
- CGMiner API: Full support for standard CGMiner-compatible miners
- Braiins OS/OS+: Native integration with Braiins GraphQL API for advanced monitoring
- Firmware version detection
- Real-time power consumption (kW)
- Chip temperature monitoring
- Autotuner status tracking
- Vnish Firmware: Advanced tuning and performance profiles (library available, integration pending)
- Stock Firmware: Fallback support for standard miners
The scan command provides comprehensive fleet visibility:
miner-cli scan 10.45.9.0/24Output includes:
- IP address and firmware version (e.g., Braiins OS+ 25.01, Braiins OS+ 25.07)
- Switch port (when
--switchflag is used) - Real-time hashrate (GH/s)
- Power consumption (kW) - for Braiins OS miners
- Chip temperature (°C)
- Autotuner status (STABLE, TUNING, TESTING)
- Share statistics (Accepted, Rejected, HW Errors)
- Uptime
Integrate with Cisco switches via SNMP to show which port each miner is connected to:
miner-cli scan 192.168.1.0/24 --switch 10.110.101.6 --community publicFeatures:
- Queries switch MAC address table via SNMP v2c
- Matches miner MAC addresses to switch ports
- Works with same-subnet deployments (ARP-based)
- For Braiins OS miners on different subnets, use gRPC authentication:
miner-cli scan 10.45.6.0/24 --switch 10.110.101.6 --braiins-user root --braiins-pass root
- Displays port names (e.g., FastEthernet0/17, GigabitEthernet1/0/24)
- Supports Cisco VLAN-aware MAC lookup
- CIDR notation:
192.168.1.0/24,10.0.0.0/20 - IP ranges:
10.45.1.0-10.45.20.254 - Single IPs:
192.168.1.100 - Multiple ranges: Combine any format in a single command
- Color: Beautiful colored terminal output with status indicators
- JSON: Machine-readable output for automation and scripting
- Table: Structured format for easy reading
- Concurrent execution with configurable worker pools (default: 255 workers)
- Automatic firmware detection via API probing
- Configurable timeouts for fast scanning
- Efficient bulk operations
cd miner-cli
go mod download
go build -o miner-cliOr install directly:
go install github.com/sinkers/miner-cli@latestOr use the Makefile:
make install # Install to $GOPATH/bin
make build # Build binary only
make cross-compile # Build for multiple platforms# Scan a subnet and show all miner details
miner-cli scan 192.168.1.0/24
# Scan with verbose output
miner-cli scan 10.0.0.0/20 -v
# JSON output for automation
miner-cli scan 192.168.1.0/24 -o json
# Scan with switch port mapping (requires SNMP access to switch)
miner-cli scan 192.168.1.0/24 --switch 10.110.101.6 --community public
# With Braiins authentication for MAC address retrieval
miner-cli scan 192.168.1.0/24 --switch 10.110.101.6 --braiins-user root --braiins-pass root# Summary for specific miners
miner-cli summary 192.168.1.100 192.168.1.101
# Summary for subnet with JSON output
miner-cli summary 192.168.1.0/24 -o json
# Multiple ranges
miner-cli summary 192.168.1.0/24 10.45.0.0/24# Get device/hashboard information
miner-cli devs 192.168.1.0/24
# Get detailed statistics
miner-cli stats 10.0.0.1-10.0.0.50 -o json
# Check pool status
miner-cli pools 192.168.1.0/24| Command | Description |
|---|---|
scan |
Scan network for miners with comprehensive status |
summary |
Get mining summary statistics |
devs |
Get device/hashboard information |
pools |
Get pool configuration and status |
stats |
Get detailed mining statistics |
version |
Get miner firmware version |
config |
Get miner configuration |
# Add a new pool
miner-cli addpool 192.168.1.0/24 \
--url stratum+tcp://pool.example.com:3333 \
--user myworker \
--pass x
# Switch to pool ID 1
miner-cli switchpool 192.168.1.0/24 --pool 1
# Enable/disable pools
miner-cli enablepool 192.168.1.0/24 --pool 2
miner-cli disablepool 192.168.1.0/24 --pool 0
# Remove a pool
miner-cli removepool 192.168.1.0/24 --pool 3# Restart miners
miner-cli restart 192.168.1.0/24
# Stop miners (use with caution!)
miner-cli quit 192.168.1.100
# Zero statistics
miner-cli zero 192.168.1.0/24 --which all --all# Execute any CGMiner API command
miner-cli custom 192.168.1.100 --cmd "asccount"
# List all available commands
miner-cli list-i, --ips: IP ranges (can be specified multiple times)-p, --port: API port (default: 4028)-t, --timeout: Connection timeout in seconds (default: 5)-w, --workers: Number of concurrent workers (default: 255)-o, --output: Output format: color, json, table (default: color)-v, --verbose: Verbose output
Monitor a large mining fleet across multiple subnets:
# Scan entire facility
miner-cli scan 10.45.0.0/16 -w 500 -t 2
# Get performance summary with JSON output for analysis
miner-cli summary 10.45.0.0/16 -o json | jq '.[] | select(.Error == null)'
# Monitor specific temperature ranges
miner-cli scan 192.168.1.0/24 -o json | \
jq '.[] | select(.response.chip_temp_c > 75)'# Switch all miners to failover pool
miner-cli switchpool 10.45.0.0/20 --pool 1 -w 100
# Verify pool configuration
miner-cli pools 10.45.0.0/20 -o json | \
jq '.[] | {ip: .ip, active_pool: .response.POOLS[0].URL}'Scanning 255 hosts for active miners...
Active Miners Found: 23 out of 255 scanned
================================================================================
IP Firmware Hashrate (GH/s) Power (kW) Temp (°C) Tuning Accepted Rejected HW Errors Uptime
--- -------- -------------- ---------- --------- ------ -------- -------- --------- ------
10.45.9.1 Braiins OS+ 25.01 110776.91 3.28 62.0 STABLE 880 3 0 4h 41m
10.45.9.2 Braiins OS+ 25.01 111639.79 3.29 62.5 STABLE 1600 8 0 4h 41m
10.45.9.3 Braiins OS+ 25.07 102588.56 3.06 62.0 STABLE 1456 6 0 4h 41m
...
================================================================================
# High concurrency for large networks
miner-cli scan 10.0.0.0/16 -w 500 -t 2
# Reduce timeout for fast detection
miner-cli scan 192.168.1.0/24 -t 1# Parallel pool updates
for pool in pool1.example.com pool2.example.com pool3.example.com; do
miner-cli addpool 192.168.1.0/24 \
--url "stratum+tcp://${pool}:3333" \
--user myworker \
--pass x
doneThe project includes a unified API abstraction layer for seamless integration across different miner types:
- CGMiner Adapter: Standard CGMiner API support
- Braiins Adapter: gRPC-based Braiins OS integration
- Vnish Adapter: Vnish firmware API support
See docs/unified-api-abstraction-*.md for implementation details.
- Direct API Integration: The scan command uses direct GraphQL/HTTP APIs for optimal performance
- Worker Pool Architecture: Configurable concurrency for handling large fleets
- Automatic Firmware Detection: Queries Braiins GraphQL API to detect firmware type
- Fallback Support: Standard CGMiner API fallback for non-Braiins miners
git clone https://github.com/sinkers/miner-cli
cd miner-cli
make buildmake test # Run tests
make test-coverage # Generate coverage report
make test-verbose # Detailed test outputmake dev-setup # Install development tools (includes golangci-lint)
make fmt # Format code
make lint # Run linter
make check # Run all checks (fmt, vet, lint, test)Before pushing changes, always run:
make checkThis runs:
make fmt- Formats codemake vet- Runs go vetmake lint- Runs golangci-lint (must be installed viamake dev-setup)make test- Runs all tests
The CI pipeline runs these same checks. Running locally first saves time and prevents failed CI builds.
Note: golangci-lint is required for linting. Install it with:
make dev-setup
# or manually:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latestThe project uses GitHub Actions for:
- Automated testing with race detection
- Cross-platform builds (Linux, macOS, Windows)
- Code linting with golangci-lint
- Security scanning with Gosec and govulncheck
- Code coverage reporting
- PDU Management: Power distribution unit control and monitoring
- Switch Management: Network switch configuration and VLAN management
- Advanced Analytics: Historical performance tracking and alerting
- Web Dashboard: Real-time fleet visualization
- Firmware Management: Automated firmware updates and rollback
- This tool requires network access to miner API ports (default 4028)
- Braiins GraphQL API access (port 80/443) for advanced features
- Ensure API access is properly secured in production
- Some commands (like
quit) can stop miners - use with caution - Consider firewall rules and network segmentation for large deployments
Connection Issues:
- Ensure CGMiner API is enabled (
--api-listenin cgminer config) - Check firewall rules allow access to port 4028
- For Braiins: Verify HTTP/GraphQL access on port 80
Timeout Errors:
- Increase timeout:
-t 10 - Reduce worker count if network is saturated:
-w 50
Missing Temperature Data:
- Braiins OS miners: Temperature fetched from GraphQL API automatically
- Stock firmware: Use
--scan-tempsflag (deprecated, now automatic)
miner-cli scan 192.168.1.0/24 -vPull requests are welcome! For major changes, please open an issue first.
- Follow existing code style (use
make fmt) - Add tests for new features
- Update documentation
- Ensure CI passes
MIT License - See LICENSE file for details
- GitHub Issues: https://github.com/sinkers/miner-cli/issues
- Documentation:
docs/directory in repository
- CGMiner API by Con Kolivas
- Braiins OS by Braiins Systems
- Vnish firmware team