#!/bin/bash # Start RinCoin Stratum Proxy Server # Bridges cpuminer-opt-rin to RinCoin node echo "=== RinCoin Stratum Proxy Server ===" echo "" # Check if RinCoin node is running if ! sudo docker ps | grep -q "rincoin-node"; then echo "❌ Error: rincoin-node container is not running!" echo "Please start it first:" echo "sudo docker start rincoin-node" exit 1 fi echo "✅ RinCoin node is running" # Check if Python3 and requests are available if ! command -v python3 &> /dev/null; then echo "❌ Error: python3 is not installed!" echo "Please install it: sudo apt-get install python3" exit 1 fi # Install requests if not available python3 -c "import requests" 2>/dev/null || { echo "Installing python3-requests..." sudo apt-get update && sudo apt-get install -y python3-requests } echo "✅ Python dependencies ready" # Check if port 3334 is already in use if netstat -tln | grep -q ":3334 "; then echo "" echo "⚠️ Port 3334 is already in use!" echo "" echo "🔍 Process using port 3334:" sudo netstat -tlnp | grep ":3334 " || echo "Could not determine process" echo "" echo "🛑 To kill existing process:" echo "sudo lsof -ti:3334 | xargs sudo kill -9" echo "" read -p "Kill existing process and continue? (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Killing processes using port 3334..." sudo lsof -ti:3334 | xargs sudo kill -9 2>/dev/null || echo "No processes to kill" sleep 2 else echo "Exiting..." exit 1 fi fi echo "" echo "🚀 Starting Stratum Proxy Server..." echo "This will bridge cpuminer-opt-rin to your RinCoin node" echo "" echo "After it starts, connect your miner with:" echo "sudo docker exec -it amd-strix-halo-llama-rocm bash -c \"/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3334 -u user -p pass -t 28\"" echo "" echo "Press Ctrl+C to stop the proxy" echo "" # Start the proxy cd "$(dirname "$0")" python3 stratum_proxy.py