#!/bin/bash # RIN Stratum Proxy Startup Script # Using Node.js and node-stratum library echo "🚀 Starting RIN Stratum Proxy (Node.js version)" echo "==============================================" # Check if Node.js is installed if ! command -v node &> /dev/null; then echo "❌ Node.js is not installed. Please install Node.js first." exit 1 fi # Check if npm is installed if ! command -v npm &> /dev/null; then echo "❌ npm is not installed. Please install npm first." exit 1 fi # Navigate to the proxy directory cd "$(dirname "$0")" echo "📁 Working directory: $(pwd)" # Install dependencies if node_modules doesn't exist if [ ! -d "node_modules" ]; then echo "📦 Installing dependencies..." npm install if [ $? -ne 0 ]; then echo "❌ Failed to install dependencies" exit 1 fi else echo "✅ Dependencies already installed" fi # Check if RIN node is running echo "🔍 Checking RIN node connection..." curl -s -u rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \ -d '{"jsonrpc":"1.0","id":"1","method":"getblockchaininfo","params":[]}' \ -H 'content-type: text/plain;' \ http://127.0.0.1:9556/ > /dev/null if [ $? -eq 0 ]; then echo "✅ RIN node is running and accessible" else echo "❌ RIN node is not accessible at 127.0.0.1:9556" echo " Please ensure RIN node is running with RPC enabled" exit 1 fi # Start the proxy server echo "🚀 Starting stratum proxy server..." echo " Stratum port: 3333" echo " RPC endpoint: 127.0.0.1:9556" echo " Target address: rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q" echo "" echo "🔧 To connect a miner, use:" echo " ./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u worker1 -p x -t 4" echo "" echo "Press Ctrl+C to stop the server" echo "==============================================" # Start with debug output DEBUG=stratum node server.js