82 lines
2.5 KiB
Bash
82 lines
2.5 KiB
Bash
#!/bin/bash
|
|
|
|
# Start RinCoin Solo Mining with Custom Address
|
|
# Usage: ./start_mining_with_address.sh [rincoin_address] [threads]
|
|
|
|
# Default values
|
|
DEFAULT_ADDRESS="rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q"
|
|
DEFAULT_THREADS="28"
|
|
|
|
# Parse arguments
|
|
RINCOIN_ADDRESS="${1:-$DEFAULT_ADDRESS}"
|
|
THREADS="${2:-$DEFAULT_THREADS}"
|
|
|
|
echo "=== RinCoin Solo Mining Setup ==="
|
|
echo "RinCoin Address: $RINCOIN_ADDRESS"
|
|
echo "Threads: $THREADS"
|
|
echo ""
|
|
|
|
# Validate RinCoin address format
|
|
if [[ ! "$RINCOIN_ADDRESS" =~ ^rin1[a-zA-Z0-9]{25,}$ ]]; then
|
|
echo "❌ Error: Invalid RinCoin address format: $RINCOIN_ADDRESS"
|
|
echo "RinCoin addresses should start with 'rin1' and be ~30 characters long"
|
|
exit 1
|
|
fi
|
|
|
|
# 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: sudo docker start rincoin-node"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ RinCoin node is running"
|
|
|
|
# Check dependencies
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "❌ Error: python3 is not installed!"
|
|
exit 1
|
|
fi
|
|
|
|
python3 -c "import requests" 2>/dev/null || {
|
|
echo "Installing python3-requests..."
|
|
sudo apt-get update && sudo apt-get install -y python3-requests
|
|
}
|
|
|
|
echo "✅ Dependencies ready"
|
|
echo ""
|
|
|
|
# Create temporary proxy script with custom address
|
|
TEMP_PROXY="/tmp/rincoin_proxy_${RANDOM}.py"
|
|
sed "s/target_address='[^']*'/target_address='$RINCOIN_ADDRESS'/" MINE/rin/stratum_proxy.py > "$TEMP_PROXY"
|
|
|
|
echo "🚀 Starting Stratum Proxy with address: $RINCOIN_ADDRESS"
|
|
echo ""
|
|
|
|
# Start proxy in background
|
|
python3 "$TEMP_PROXY" &
|
|
PROXY_PID=$!
|
|
|
|
# Wait for proxy to start
|
|
sleep 3
|
|
|
|
echo "📋 Mining Commands:"
|
|
echo ""
|
|
echo "1. For Docker container mining:"
|
|
echo "sudo docker exec -it amd-strix-halo-llama-rocm bash -c \"/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://172.17.0.1:3333 -u user -p pass -t $THREADS\""
|
|
echo ""
|
|
echo "2. For native mining (if cpuminer is installed locally):"
|
|
echo "/home/db/Downloads/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u user -p pass -t $THREADS"
|
|
echo ""
|
|
echo "💡 Tips:"
|
|
echo "- Use 172.17.0.1:3333 from Docker containers"
|
|
echo "- Use 127.0.0.1:3333 from host system"
|
|
echo "- All block rewards will go to: $RINCOIN_ADDRESS"
|
|
echo ""
|
|
echo "Press Ctrl+C to stop the proxy and mining"
|
|
|
|
# Wait for user to stop
|
|
trap "echo ''; echo 'Stopping proxy...'; kill $PROXY_PID 2>/dev/null; rm -f '$TEMP_PROXY'; exit 0" INT
|
|
|
|
wait $PROXY_PID
|