#!/bin/bash # Remote Solo Mining Script for RinCoin # Connects to RinCoin node over network/RPC # Configuration RPC_HOST="127.0.0.1" # Change to your server IP for remote access RPC_PORT="9556" RPC_USER="rinrpc" RPC_PASS="745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90" echo "=== Remote RinCoin Solo Mining Setup ===" echo "RPC Host: $RPC_HOST:$RPC_PORT" echo "" # Test RPC connection echo "Testing RPC connection..." RPC_RESPONSE=$(curl -s --user "$RPC_USER:$RPC_PASS" \ -H 'content-type: text/plain' \ --data '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}' \ "http://$RPC_HOST:$RPC_PORT/") if [[ $RPC_RESPONSE == *"error"* ]]; then echo "❌ Error: Could not connect to RinCoin RPC!" echo "Response: $RPC_RESPONSE" echo "" echo "Check:" echo "1. RinCoin node is running" echo "2. RPC port $RPC_PORT is accessible" echo "3. Firewall allows connections to port $RPC_PORT" exit 1 fi echo "✅ RPC connection successful!" echo "" # Get wallet address via RPC echo "Getting wallet address..." WALLET_RESPONSE=$(curl -s --user "$RPC_USER:$RPC_PASS" \ -H 'content-type: text/plain' \ --data '{"jsonrpc":"1.0","id":"curl","method":"getnewaddress","params":[]}' \ "http://$RPC_HOST:$RPC_PORT/") RIN_ADDRESS=$(echo "$WALLET_RESPONSE" | grep -o '"result":"[^"]*"' | cut -d'"' -f4) if [ -z "$RIN_ADDRESS" ]; then echo "❌ Error: Could not get RinCoin address!" echo "Response: $WALLET_RESPONSE" echo "" echo "Make sure wallet 'main' exists:" echo "curl --user $RPC_USER:$RPC_PASS -H 'content-type: text/plain' --data '{\"jsonrpc\":\"1.0\",\"id\":\"curl\",\"method\":\"createwallet\",\"params\":[\"main\"]}' http://$RPC_HOST:$RPC_PORT/" exit 1 fi echo "✅ RinCoin Address: $RIN_ADDRESS" echo "" # Check node sync status SYNC_RESPONSE=$(curl -s --user "$RPC_USER:$RPC_PASS" \ -H 'content-type: text/plain' \ --data '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}' \ "http://$RPC_HOST:$RPC_PORT/") SYNC_STATUS=$(echo "$SYNC_RESPONSE" | grep -o '"initialblockdownload":[^,]*' | cut -d':' -f2 | tr -d ' ') if [ "$SYNC_STATUS" = "true" ]; then echo "⚠️ WARNING: Node is still syncing (initialblockdownload: true)" echo "Solo mining may not work properly until sync is complete." echo "" fi echo "Starting remote solo mining with cpuminer-opt-rin..." echo "Algorithm: rinhash" echo "Target: RinCoin node at $RPC_HOST:9555" echo "Wallet: $RIN_ADDRESS" echo "" echo "Press Ctrl+C to stop mining" echo "" # Start solo mining (connect to P2P port, not RPC) sudo docker exec -it amd-strix-halo-llama-rocm bash -c "/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://$RPC_HOST:9555 -u $RIN_ADDRESS -p x -t 32"