diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..8164b4b --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,360 @@ +# RustChain Miner Installation Guide + +This guide covers installation and setup of the RustChain miner on Linux and macOS systems. + +## Quick Install (Recommended) + +### Default Installation +```bash +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash +``` + +The installer will: +1. Auto-detect your platform (OS and architecture) +2. Create an isolated Python virtualenv at `~/.rustchain/venv` +3. Install required dependencies (requests) in the virtualenv +4. Download the appropriate miner for your hardware +5. Prompt for your wallet name (or auto-generate one) +6. Ask if you want to set up auto-start on boot +7. Display wallet balance check commands + +### Installation with Specific Wallet +```bash +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --wallet my-miner-wallet +``` + +This skips the interactive wallet prompt and uses the specified wallet name. + +## Supported Platforms + +### Linux +- ✅ Ubuntu 20.04, 22.04, 24.04 +- ✅ Debian 11, 12 +- ✅ Fedora 38, 39, 40 +- ✅ RHEL 8, 9 +- ✅ Other systemd-based distributions + +**Architectures:** +- x86_64 (Intel/AMD 64-bit) +- ppc64le (PowerPC 64-bit Little-Endian) +- ppc (PowerPC 32-bit) + +### macOS +- ✅ macOS 12 (Monterey) and later +- ✅ macOS 11 (Big Sur) with limitations + +**Architectures:** +- arm64 (Apple Silicon M1/M2/M3) +- x86_64 (Intel Mac) +- powerpc (PowerPC G3/G4/G5) + +### Special Hardware +- ✅ IBM POWER8 systems +- ✅ PowerPC G4/G5 Macs +- ✅ Vintage x86 CPUs (Pentium 4, Core 2 Duo, etc.) + +## Requirements + +### System Requirements +- Python 3.6+ (or Python 2.5+ for vintage PowerPC systems) +- curl or wget +- 50 MB disk space +- Internet connection + +### Linux-Specific +- systemd (for auto-start feature) +- python3-venv or virtualenv package + +### macOS-Specific +- Command Line Tools (installed automatically if needed) +- launchd (built into macOS) + +## Installation Directory Structure + +After installation, you'll have the following structure at `~/.rustchain/`: + +``` +~/.rustchain/ +├── venv/ # Isolated Python virtualenv +│ ├── bin/ +│ │ ├── python # Virtualenv Python interpreter +│ │ └── pip # Virtualenv pip +│ └── lib/ # Installed packages (requests, etc.) +├── rustchain_miner.py # Main miner script +├── fingerprint_checks.py # Hardware attestation module +├── start.sh # Convenience start script +└── miner.log # Miner logs (if auto-start enabled) +``` + +## Auto-Start Configuration + +### Linux (systemd) + +The installer creates a user service at: +``` +~/.config/systemd/user/rustchain-miner.service +``` + +**Service Management Commands:** +```bash +# Check miner status +systemctl --user status rustchain-miner + +# Start mining +systemctl --user start rustchain-miner + +# Stop mining +systemctl --user stop rustchain-miner + +# Restart mining +systemctl --user restart rustchain-miner + +# Disable auto-start +systemctl --user disable rustchain-miner + +# Enable auto-start +systemctl --user enable rustchain-miner + +# View logs +journalctl --user -u rustchain-miner -f +``` + +### macOS (launchd) + +The installer creates a launch agent at: +``` +~/Library/LaunchAgents/com.rustchain.miner.plist +``` + +**Service Management Commands:** +```bash +# Check if miner is running +launchctl list | grep rustchain + +# Start mining +launchctl start com.rustchain.miner + +# Stop mining +launchctl stop com.rustchain.miner + +# Disable auto-start +launchctl unload ~/Library/LaunchAgents/com.rustchain.miner.plist + +# Enable auto-start +launchctl load ~/Library/LaunchAgents/com.rustchain.miner.plist + +# View logs +tail -f ~/.rustchain/miner.log +``` + +## Checking Your Wallet + +### Balance Check +```bash +# Note: Using -k flag because node may use self-signed SSL certificate +curl -sk "https://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET_NAME" +``` + +Example output: +```json +{ + "miner_id": "my-miner-wallet", + "amount_rtc": 12.456, + "amount_i64": 12456000 +} +``` + +### Active Miners +```bash +curl -sk https://50.28.86.131/api/miners +``` + +### Node Health +```bash +curl -sk https://50.28.86.131/health +``` + +### Current Epoch +```bash +curl -sk https://50.28.86.131/epoch +``` + +## Manual Operation + +If you chose not to set up auto-start, you can run the miner manually: + +### Using the Start Script +```bash +cd ~/.rustchain && ./start.sh +``` + +### Direct Python Execution +```bash +cd ~/.rustchain +./venv/bin/python rustchain_miner.py --wallet YOUR_WALLET_NAME +``` + +### Using Convenience Command (if available) +```bash +rustchain-mine +``` + +Note: The convenience command is only available if `/usr/local/bin` was writable during installation. + +## Uninstallation + +### Complete Uninstall +```bash +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --uninstall +``` + +This will: +1. Stop and remove the systemd/launchd service +2. Remove the entire `~/.rustchain` directory (including virtualenv) +3. Remove the convenience symlink (if it exists) +4. Clean up all configuration files + +### Manual Uninstall + +If the automated uninstall doesn't work, you can manually remove: + +**Linux:** +```bash +# Stop and disable service +systemctl --user stop rustchain-miner +systemctl --user disable rustchain-miner +rm ~/.config/systemd/user/rustchain-miner.service +systemctl --user daemon-reload + +# Remove files +rm -rf ~/.rustchain +rm -f /usr/local/bin/rustchain-mine +``` + +**macOS:** +```bash +# Stop and remove service +launchctl unload ~/Library/LaunchAgents/com.rustchain.miner.plist +rm ~/Library/LaunchAgents/com.rustchain.miner.plist + +# Remove files +rm -rf ~/.rustchain +rm -f /usr/local/bin/rustchain-mine +``` + +## Troubleshooting + +### Python virtualenv creation fails + +**Error:** `Could not create virtual environment` + +**Solution:** +```bash +# Ubuntu/Debian +sudo apt-get install python3-venv + +# Fedora/RHEL +sudo dnf install python3-virtualenv + +# macOS +pip3 install --user virtualenv +``` + +### Permission denied when creating symlink + +**Error:** `ln: /usr/local/bin/rustchain-mine: Permission denied` + +This is normal. The installer will continue without the convenience command. You can still use the start script: +```bash +~/.rustchain/start.sh +``` + +### systemd service fails to start + +**Check the logs:** +```bash +journalctl --user -u rustchain-miner -n 50 +``` + +Common issues: +- Network not available at boot: The service will retry automatically +- Python path incorrect: Reinstall the miner +- Wallet name with special characters: Use alphanumeric characters only + +### launchd service not loading on macOS + +**Check if it's loaded:** +```bash +launchctl list | grep rustchain +``` + +**Reload manually:** +```bash +launchctl load ~/Library/LaunchAgents/com.rustchain.miner.plist +``` + +**Check the logs:** +```bash +cat ~/.rustchain/miner.log +``` + +### Connection to node fails + +**Error:** `Could not connect to node` + +**Check:** +1. Internet connection is working +2. Node is accessible: `curl -sk https://50.28.86.131/health` +3. Firewall isn't blocking HTTPS (port 443) + +### Miner not earning rewards + +**Check:** +1. Miner is actually running: `systemctl --user status rustchain-miner` or `launchctl list | grep rustchain` +2. Wallet balance: `curl -sk "https://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET_NAME"` +3. Miner logs for errors: `journalctl --user -u rustchain-miner -f` or `tail -f ~/.rustchain/miner.log` +4. Hardware attestation passes: Look for "fingerprint validation" messages in logs + +### Running Multiple Miners + +To run multiple miners on different hardware: + +1. Install on each machine separately +2. Use different wallet names for each miner +3. Each miner will be independently tracked by the network + +### Updating the Miner + +To update to the latest version: +```bash +# Uninstall old version +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --uninstall + +# Install new version +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --wallet YOUR_WALLET_NAME +``` + +## Getting Help + +- **Documentation:** https://github.com/Scottcjn/Rustchain +- **Issues:** https://github.com/Scottcjn/Rustchain/issues +- **Explorer:** http://50.28.86.131/explorer +- **Bounties:** https://github.com/Scottcjn/rustchain-bounties + +## Security Notes + +1. The installer uses HTTPS to download files from GitHub +2. Python dependencies are installed in an isolated virtualenv (no system pollution) +3. The miner runs as your user (not root) +4. Services are user-level (systemd --user, ~/Library/LaunchAgents) +5. All logs are stored in your home directory +6. **SSL Certificate:** The RustChain node (50.28.86.131) may use a self-signed SSL certificate. The `-k` flag in curl commands bypasses certificate verification. This is a known limitation of the current infrastructure. In production, you should verify the node's identity through other means (community consensus, explorer verification, etc.). + +## Contributing + +Found a bug or want to improve the installer? Submit a PR to: +https://github.com/Scottcjn/Rustchain + +## License + +RustChain is licensed under the MIT License. See LICENSE file for details. diff --git a/README.md b/README.md index 4fa1083..25b8bf6 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,75 @@ ## ⚡ Quick Start -### One-Line Install +### One-Line Install (Recommended) ```bash curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash ``` -The installer auto-detects your platform and configures everything. +The installer: +- ✅ Auto-detects your platform (Linux/macOS, x86_64/ARM/PowerPC) +- ✅ Creates an isolated Python virtualenv (no system pollution) +- ✅ Downloads the correct miner for your hardware +- ✅ Sets up auto-start on boot (systemd/launchd) +- ✅ Provides easy uninstall + +### Installation with Options + +**Install with a specific wallet:** +```bash +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --wallet my-miner-wallet +``` + +**Uninstall:** +```bash +curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --uninstall +``` + +### Supported Platforms +- ✅ Ubuntu 20.04+, Debian 11+, Fedora 38+ (x86_64, ppc64le) +- ✅ macOS 12+ (Intel, Apple Silicon, PowerPC) +- ✅ IBM POWER8 systems + +### After Installation + +**Check your wallet balance:** +```bash +# Note: Using -sk flags because the node may use a self-signed SSL certificate +curl -sk "https://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET_NAME" +``` + +**List active miners:** +```bash +curl -sk https://50.28.86.131/api/miners +``` + +**Check node health:** +```bash +curl -sk https://50.28.86.131/health +``` + +**Get current epoch:** +```bash +curl -sk https://50.28.86.131/epoch +``` + +**Manage the miner service:** + +*Linux (systemd):* +```bash +systemctl --user status rustchain-miner # Check status +systemctl --user stop rustchain-miner # Stop mining +systemctl --user start rustchain-miner # Start mining +journalctl --user -u rustchain-miner -f # View logs +``` + +*macOS (launchd):* +```bash +launchctl list | grep rustchain # Check status +launchctl stop com.rustchain.miner # Stop mining +launchctl start com.rustchain.miner # Start mining +tail -f ~/.rustchain/miner.log # View logs +``` ### Manual Install ```bash @@ -135,19 +198,19 @@ This provides cryptographic proof that RustChain state existed at a specific tim ```bash # Check network health -curl http://50.28.86.131/health +curl -sk https://50.28.86.131/health # Get current epoch -curl http://50.28.86.131/epoch +curl -sk https://50.28.86.131/epoch # List active miners -curl http://50.28.86.131/api/miners +curl -sk https://50.28.86.131/api/miners # Check wallet balance -curl "http://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET" +curl -sk "https://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET" # Block explorer -open http://50.28.86.131/explorer +open https://50.28.86.131/explorer ``` ## 🖥️ Supported Platforms diff --git a/install.sh b/install.sh index c02355b..9b5a4e2 100755 --- a/install.sh +++ b/install.sh @@ -3,14 +3,17 @@ # RustChain Miner - One-Line Installer # curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash # -# Supports: Linux (x86_64, ppc64le), macOS (Intel, PPC), POWER8 +# Supports: Linux (x86_64, ppc64le), macOS (Intel, Apple Silicon, PPC), POWER8 +# Features: virtualenv isolation, systemd/launchd auto-start, clean uninstall # set -e REPO_BASE="https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners" INSTALL_DIR="$HOME/.rustchain" +VENV_DIR="$INSTALL_DIR/venv" NODE_URL="https://50.28.86.131" +SERVICE_NAME="rustchain-miner" # Colors RED='\033[0;31m' @@ -19,6 +22,71 @@ YELLOW='\033[1;33m' CYAN='\033[0;36m' NC='\033[0m' # No Color +# Parse command line arguments +UNINSTALL=false +WALLET_ARG="" + +while [[ $# -gt 0 ]]; do + case $1 in + --uninstall) + UNINSTALL=true + shift + ;; + --wallet) + WALLET_ARG="$2" + shift 2 + ;; + *) + echo "Unknown option: $1" + echo "Usage: $0 [--uninstall] [--wallet WALLET_NAME]" + exit 1 + ;; + esac +done + +# Uninstall mode +if [ "$UNINSTALL" = true ]; then + echo -e "${CYAN}[*] Uninstalling RustChain miner...${NC}" + + # Stop and remove systemd service (Linux) + if [ "$(uname -s)" = "Linux" ] && command -v systemctl &>/dev/null; then + if systemctl --user list-unit-files | grep -q "$SERVICE_NAME.service"; then + echo -e "${YELLOW}[*] Stopping systemd service...${NC}" + systemctl --user stop "$SERVICE_NAME.service" 2>/dev/null || true + systemctl --user disable "$SERVICE_NAME.service" 2>/dev/null || true + rm -f "$HOME/.config/systemd/user/$SERVICE_NAME.service" + systemctl --user daemon-reload 2>/dev/null || true + echo -e "${GREEN}[+] Systemd service removed${NC}" + fi + fi + + # Stop and remove launchd service (macOS) + if [ "$(uname -s)" = "Darwin" ]; then + PLIST_PATH="$HOME/Library/LaunchAgents/com.rustchain.miner.plist" + if [ -f "$PLIST_PATH" ]; then + echo -e "${YELLOW}[*] Stopping launchd service...${NC}" + launchctl unload "$PLIST_PATH" 2>/dev/null || true + rm -f "$PLIST_PATH" + echo -e "${GREEN}[+] Launchd service removed${NC}" + fi + fi + + # Remove installation directory + if [ -d "$INSTALL_DIR" ]; then + echo -e "${YELLOW}[*] Removing installation directory...${NC}" + rm -rf "$INSTALL_DIR" + echo -e "${GREEN}[+] Installation directory removed${NC}" + fi + + # Remove symlink + if [ -L "/usr/local/bin/rustchain-mine" ]; then + rm -f "/usr/local/bin/rustchain-mine" 2>/dev/null || true + fi + + echo -e "${GREEN}[✓] RustChain miner uninstalled successfully${NC}" + exit 0 +fi + echo -e "${CYAN}" echo "╔═══════════════════════════════════════════════════════════════╗" echo "║ RustChain Miner - Proof of Antiquity ║" @@ -99,18 +167,34 @@ check_python() { # Install dependencies install_deps() { local python_cmd=$1 - echo -e "${YELLOW}[*] Checking dependencies...${NC}" - - # Try to install requests if missing - $python_cmd -c "import requests" 2>/dev/null || { - echo -e "${YELLOW}[*] Installing requests module...${NC}" - $python_cmd -m pip install requests --user 2>/dev/null || \ - pip install requests --user 2>/dev/null || \ - pip3 install requests --user 2>/dev/null || { - echo -e "${RED}[!] Could not install requests. Please install manually:${NC}" - echo " pip install requests" + echo -e "${YELLOW}[*] Setting up Python virtual environment...${NC}" + + # Create virtualenv + if ! $python_cmd -m venv "$VENV_DIR" 2>/dev/null; then + echo -e "${YELLOW}[*] venv module not available, trying virtualenv...${NC}" + # Try installing virtualenv if not available + $python_cmd -m pip install --user virtualenv 2>/dev/null || pip install --user virtualenv 2>/dev/null || true + $python_cmd -m virtualenv "$VENV_DIR" 2>/dev/null || { + echo -e "${RED}[!] Could not create virtual environment${NC}" + echo -e "${RED}[!] Please install python3-venv or virtualenv${NC}" + exit 1 } + fi + + echo -e "${GREEN}[+] Virtual environment created${NC}" + + # Activate virtualenv and install dependencies + local venv_python="$VENV_DIR/bin/python" + local venv_pip="$VENV_DIR/bin/pip" + + echo -e "${YELLOW}[*] Installing dependencies in virtualenv...${NC}" + $venv_pip install --upgrade pip 2>/dev/null || true + $venv_pip install requests 2>/dev/null || { + echo -e "${RED}[!] Could not install requests. Please check your internet connection.${NC}" + exit 1 } + + echo -e "${GREEN}[+] Dependencies installed in isolated environment${NC}" } # Download miner files @@ -151,38 +235,41 @@ download_miner() { # Configure wallet (sets WALLET_NAME global) configure_wallet() { - echo "" - echo -e "${CYAN}[?] Enter your wallet name (or press Enter for auto-generated):${NC}" - read -r wallet_name + local wallet_name="" + + # Use wallet from argument if provided + if [ -n "$WALLET_ARG" ]; then + wallet_name="$WALLET_ARG" + echo -e "${GREEN}[+] Using wallet: ${wallet_name}${NC}" + else + echo "" + echo -e "${CYAN}[?] Enter your wallet name (or press Enter for auto-generated):${NC}" + read -r wallet_name < /dev/tty - if [ -z "$wallet_name" ]; then - wallet_name="miner-$(hostname)-$(date +%s | tail -c 6)" - echo -e "${YELLOW}[*] Using auto-generated wallet: ${wallet_name}${NC}" + if [ -z "$wallet_name" ]; then + wallet_name="miner-$(hostname)-$(date +%s | tail -c 6)" + echo -e "${YELLOW}[*] Using auto-generated wallet: ${wallet_name}${NC}" + fi + fi + + if [[ ! "$wallet_name" =~ ^[a-zA-Z0-9_-]+$ ]]; then + echo -e "${RED}[!] Wallet name must be alphanumeric (hyphens and underscores allowed)${NC}" + exit 1 fi # Set global for use by other functions WALLET_NAME="$wallet_name" - - # Save config - cat > "$INSTALL_DIR/config.json" << EOF -{ - "wallet": "$wallet_name", - "node_url": "$NODE_URL", - "auto_start": true -} -EOF - echo -e "${GREEN}[+] Config saved to $INSTALL_DIR/config.json${NC}" } # Create start script create_start_script() { - local python_cmd=$1 - local wallet=$2 + local wallet=$1 + local venv_python="$VENV_DIR/bin/python" cat > "$INSTALL_DIR/start.sh" << EOF #!/bin/bash cd "$INSTALL_DIR" -$python_cmd rustchain_miner.py --wallet "$wallet" +$venv_python rustchain_miner.py --wallet "$wallet" EOF chmod +x "$INSTALL_DIR/start.sh" @@ -192,9 +279,104 @@ EOF fi } +# Setup systemd service (Linux) +setup_systemd_service() { + local wallet=$1 + local venv_python="$VENV_DIR/bin/python" + + echo -e "${YELLOW}[*] Setting up systemd service for auto-start...${NC}" + + # Create systemd user directory if it doesn't exist + mkdir -p "$HOME/.config/systemd/user" + + # Create service file + cat > "$HOME/.config/systemd/user/$SERVICE_NAME.service" << EOF +[Unit] +Description=RustChain Miner - Proof of Antiquity +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=$INSTALL_DIR +ExecStart=$venv_python $INSTALL_DIR/rustchain_miner.py --wallet $wallet +Restart=always +RestartSec=10 +StandardOutput=append:$INSTALL_DIR/miner.log +StandardError=append:$INSTALL_DIR/miner.log + +[Install] +WantedBy=default.target +EOF + + # Reload systemd and enable service + systemctl --user daemon-reload + systemctl --user enable "$SERVICE_NAME.service" + systemctl --user start "$SERVICE_NAME.service" + + echo -e "${GREEN}[+] Systemd service installed and started${NC}" + echo -e "${CYAN}[i] Service commands:${NC}" + echo -e " Start: systemctl --user start $SERVICE_NAME" + echo -e " Stop: systemctl --user stop $SERVICE_NAME" + echo -e " Status: systemctl --user status $SERVICE_NAME" + echo -e " Logs: journalctl --user -u $SERVICE_NAME -f" +} + +# Setup launchd service (macOS) +setup_launchd_service() { + local wallet=$1 + local venv_python="$VENV_DIR/bin/python" + + echo -e "${YELLOW}[*] Setting up launchd service for auto-start...${NC}" + + # Create LaunchAgents directory if it doesn't exist + mkdir -p "$HOME/Library/LaunchAgents" + + # Create plist file + cat > "$HOME/Library/LaunchAgents/com.rustchain.miner.plist" << EOF + + + + + Label + com.rustchain.miner + ProgramArguments + + $venv_python + -u + $INSTALL_DIR/rustchain_miner.py + --wallet + $wallet + + WorkingDirectory + $INSTALL_DIR + RunAtLoad + + KeepAlive + + StandardOutPath + $INSTALL_DIR/miner.log + StandardErrorPath + $INSTALL_DIR/miner.log + + +EOF + + # Load the service + launchctl load "$HOME/Library/LaunchAgents/com.rustchain.miner.plist" + + echo -e "${GREEN}[+] Launchd service installed and started${NC}" + echo -e "${CYAN}[i] Service commands:${NC}" + echo -e " Start: launchctl start com.rustchain.miner" + echo -e " Stop: launchctl stop com.rustchain.miner" + echo -e " Status: launchctl list | grep rustchain" + echo -e " Logs: tail -f $INSTALL_DIR/miner.log" +} + # Test connection test_connection() { echo -e "${YELLOW}[*] Testing connection to RustChain node...${NC}" + # Note: Using -k to bypass SSL verification as node may use self-signed cert if curl -sSk "$NODE_URL/health" | grep -q '"ok":true'; then echo -e "${GREEN}[+] Node connection successful!${NC}" return 0 @@ -218,7 +400,7 @@ main() { fi echo -e "${GREEN}[+] Using: ${python_cmd}${NC}" - # Install deps + # Install deps in virtualenv install_deps "$python_cmd" # Download miner @@ -227,33 +409,76 @@ main() { # Configure configure_wallet - # Create start script - create_start_script "$python_cmd" "$WALLET_NAME" + # Create start script (now uses virtualenv python) + create_start_script "$WALLET_NAME" # Test connection test_connection + # Setup auto-start service + echo "" + echo -e "${CYAN}[?] Set up auto-start on boot? (y/n):${NC}" + read -r setup_autostart < /dev/tty + if [ "$setup_autostart" = "y" ] || [ "$setup_autostart" = "Y" ]; then + local os=$(uname -s) + case "$os" in + Linux) + if command -v systemctl &>/dev/null; then + setup_systemd_service "$WALLET_NAME" + else + echo -e "${YELLOW}[!] systemd not found. Auto-start not configured.${NC}" + fi + ;; + Darwin) + setup_launchd_service "$WALLET_NAME" + ;; + *) + echo -e "${YELLOW}[!] Auto-start not supported on this platform${NC}" + ;; + esac + fi + echo "" echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════╗${NC}" echo -e "${GREEN}║ Installation Complete! ║${NC}" echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════╝${NC}" echo "" - echo -e "${CYAN}To start mining:${NC}" + echo -e "${CYAN}To start mining manually:${NC}" echo -e " ${YELLOW}cd $INSTALL_DIR && ./start.sh${NC}" echo "" - echo -e "${CYAN}Or if symlink was created:${NC}" - echo -e " ${YELLOW}rustchain-mine${NC}" + if [ -L "/usr/local/bin/rustchain-mine" ]; then + echo -e "${CYAN}Or use the convenience command:${NC}" + echo -e " ${YELLOW}rustchain-mine${NC}" + echo "" + fi + echo -e "${CYAN}Check your wallet balance:${NC}" + echo -e " ${YELLOW}curl -sk \"$NODE_URL/wallet/balance?miner_id=$WALLET_NAME\"${NC}" + echo "" + echo -e "${CYAN}View active miners:${NC}" + echo -e " ${YELLOW}curl -sk $NODE_URL/api/miners${NC}" + echo "" + echo -e "${CYAN}Check node health:${NC}" + echo -e " ${YELLOW}curl -sk $NODE_URL/health${NC}" + echo "" + echo -e "${CYAN}Check current epoch:${NC}" + echo -e " ${YELLOW}curl -sk $NODE_URL/epoch${NC}" echo "" echo -e "${CYAN}Miner files installed to:${NC} $INSTALL_DIR" + echo -e "${CYAN}Python environment:${NC} Isolated virtualenv at $VENV_DIR" + echo "" + echo -e "${CYAN}To uninstall:${NC}" + echo -e " ${YELLOW}curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install.sh | bash -s -- --uninstall${NC}" echo "" - # Ask to start now - echo -e "${CYAN}[?] Start mining now? (y/n):${NC}" - read -r start_now - if [ "$start_now" = "y" ] || [ "$start_now" = "Y" ]; then - echo -e "${GREEN}[+] Starting miner...${NC}" - cd "$INSTALL_DIR" - exec $python_cmd rustchain_miner.py + # Ask to start now if service wasn't set up + if [ "$setup_autostart" != "y" ] && [ "$setup_autostart" != "Y" ]; then + echo -e "${CYAN}[?] Start mining now? (y/n):${NC}" + read -r start_now < /dev/tty + if [ "$start_now" = "y" ] || [ "$start_now" = "Y" ]; then + echo -e "${GREEN}[+] Starting miner...${NC}" + cd "$INSTALL_DIR" + exec "$VENV_DIR/bin/python" rustchain_miner.py --wallet "$WALLET_NAME" + fi fi }