wip
This commit is contained in:
47
startup/solo_mining.sh
Normal file
47
startup/solo_mining.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Solo Mining Script for RinCoin
|
||||
# Uses local RinCoin node for solo mining
|
||||
|
||||
echo "=== RinCoin Solo Mining Setup ==="
|
||||
echo ""
|
||||
|
||||
# Check if rincoin-node container 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
|
||||
|
||||
# Get wallet address
|
||||
RIN_ADDRESS=$(sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf -rpcwallet=main getnewaddress 2>/dev/null)
|
||||
|
||||
if [ -z "$RIN_ADDRESS" ]; then
|
||||
echo "Error: Could not get RinCoin address!"
|
||||
echo "Make sure the wallet is created and the node is synced."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "RinCoin Address: $RIN_ADDRESS"
|
||||
echo ""
|
||||
|
||||
# Check node sync status
|
||||
SYNC_STATUS=$(sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf getblockchaininfo | grep -o '"initialblockdownload": [^,]*' | cut -d' ' -f2)
|
||||
|
||||
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 solo mining with cpuminer-opt-rin..."
|
||||
echo "Algorithm: rinhash"
|
||||
echo "Target: Local RinCoin node (127.0.0.1:9555)"
|
||||
echo "Wallet: $RIN_ADDRESS"
|
||||
echo ""
|
||||
echo "Press Ctrl+C to stop mining"
|
||||
echo ""
|
||||
|
||||
# Start solo mining
|
||||
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:9555 -u $RIN_ADDRESS -p x -t 32"
|
||||
171
startup/solo_mining_core.sh
Normal file
171
startup/solo_mining_core.sh
Normal file
@@ -0,0 +1,171 @@
|
||||
#!/bin/bash
|
||||
|
||||
# RinCoin Solo Mining using Built-in Core Mining
|
||||
# Uses RinCoin Core's generatetoaddress command
|
||||
|
||||
# Default address (can be overridden with command line parameter)
|
||||
DEFAULT_ADDRESS="rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q"
|
||||
|
||||
# Get total CPU cores for default thread count
|
||||
TOTAL_CORES=$(nproc)
|
||||
DEFAULT_THREADS=$TOTAL_CORES
|
||||
|
||||
# Parse command line arguments
|
||||
RIN_ADDRESS=""
|
||||
THREAD_COUNT=""
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-a|--address)
|
||||
RIN_ADDRESS="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t|--threads)
|
||||
THREAD_COUNT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -a, --address ADDRESS RinCoin address to mine to (default: $DEFAULT_ADDRESS)"
|
||||
echo " -t, --threads COUNT Number of threads to use (default: $DEFAULT_THREADS)"
|
||||
echo " -h, --help Show this help message"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 # Use defaults (all cores, default address)"
|
||||
echo " $0 -a rin1q... -t 16 # Custom address and 16 threads"
|
||||
echo " $0 --address rin1q... --threads 8 # Custom address and 8 threads"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Use -h or --help for usage information"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Set defaults if not provided
|
||||
if [ -z "$RIN_ADDRESS" ]; then
|
||||
RIN_ADDRESS="$DEFAULT_ADDRESS"
|
||||
echo "No address provided, using default: $RIN_ADDRESS"
|
||||
fi
|
||||
|
||||
if [ -z "$THREAD_COUNT" ]; then
|
||||
THREAD_COUNT="$DEFAULT_THREADS"
|
||||
echo "No thread count provided, using all cores: $THREAD_COUNT"
|
||||
fi
|
||||
|
||||
# Validate thread count
|
||||
if ! [[ "$THREAD_COUNT" =~ ^[0-9]+$ ]] || [ "$THREAD_COUNT" -lt 1 ] || [ "$THREAD_COUNT" -gt "$TOTAL_CORES" ]; then
|
||||
echo "❌ Error: Invalid thread count: $THREAD_COUNT"
|
||||
echo "Thread count must be between 1 and $TOTAL_CORES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== RinCoin Solo Mining (Built-in Core Mining) ==="
|
||||
echo "CPU Cores Available: $TOTAL_CORES"
|
||||
echo "Threads to Use: $THREAD_COUNT"
|
||||
echo "Target Address: $RIN_ADDRESS"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# Configuration
|
||||
RPC_HOST="127.0.0.1"
|
||||
RPC_PORT="9556"
|
||||
RPC_USER="rinrpc"
|
||||
RPC_PASS="745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90"
|
||||
|
||||
# Function to call RPC
|
||||
call_rpc() {
|
||||
local method="$1"
|
||||
local params="$2"
|
||||
|
||||
curl -s --user "$RPC_USER:$RPC_PASS" \
|
||||
-H 'content-type: text/plain' \
|
||||
--data "{\"jsonrpc\":\"1.0\",\"id\":\"curl\",\"method\":\"$method\",\"params\":$params}" \
|
||||
"http://$RPC_HOST:$RPC_PORT/"
|
||||
}
|
||||
|
||||
# Wait for node to be ready
|
||||
echo "Waiting for RinCoin node to be ready..."
|
||||
while true; do
|
||||
response=$(call_rpc "getblockchaininfo" "[]")
|
||||
if [[ $response != *"Loading block index"* ]]; then
|
||||
break
|
||||
fi
|
||||
echo "Node still loading... waiting 10 seconds"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
echo "✅ Node is ready!"
|
||||
echo ""
|
||||
|
||||
# Load wallet if not already loaded
|
||||
echo "Loading wallet..."
|
||||
wallet_response=$(call_rpc "loadwallet" "[\"main\"]")
|
||||
if [[ $wallet_response == *"error"* ]] && [[ $wallet_response == *"already loaded"* ]]; then
|
||||
echo "✅ Wallet already loaded"
|
||||
else
|
||||
echo "✅ Wallet loaded successfully"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Validate the provided address (basic check)
|
||||
if [[ ! "$RIN_ADDRESS" =~ ^rin1[a-zA-Z0-9]{25,}$ ]]; then
|
||||
echo "❌ Error: Invalid RinCoin address format: $RIN_ADDRESS"
|
||||
echo "RinCoin addresses should start with 'rin1' and be ~30 characters long"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Using RinCoin Address: $RIN_ADDRESS"
|
||||
echo ""
|
||||
|
||||
# Get blockchain info
|
||||
echo "Blockchain Status:"
|
||||
blockchain_info=$(call_rpc "getblockchaininfo" "[]")
|
||||
blocks=$(echo "$blockchain_info" | grep -o '"blocks":[^,]*' | cut -d':' -f2)
|
||||
headers=$(echo "$blockchain_info" | grep -o '"headers":[^,]*' | cut -d':' -f2)
|
||||
difficulty=$(echo "$blockchain_info" | grep -o '"difficulty":[^,]*' | cut -d':' -f2)
|
||||
|
||||
echo "Blocks: $blocks"
|
||||
echo "Headers: $headers"
|
||||
echo "Difficulty: $difficulty"
|
||||
echo ""
|
||||
|
||||
echo "⚠️ IMPORTANT: Built-in Core Mining Limitations:"
|
||||
echo "1. Uses CPU only (not GPU)"
|
||||
echo "2. Very low hashpower compared to specialized miners"
|
||||
echo "3. Extremely low chance of finding blocks solo"
|
||||
echo "4. Best for testing, not profitable mining"
|
||||
echo "5. Thread count affects mining attempts per cycle"
|
||||
echo ""
|
||||
|
||||
echo "🚀 Starting Built-in Solo Mining..."
|
||||
echo "Target Address: $RIN_ADDRESS"
|
||||
echo "Threads: $THREAD_COUNT"
|
||||
echo "Press Ctrl+C to stop mining"
|
||||
echo ""
|
||||
|
||||
# Start built-in mining with specified thread count
|
||||
# Note: RinCoin Core's generatetoaddress doesn't directly support thread count
|
||||
# but we can run multiple instances or adjust the maxtries parameter
|
||||
while true; do
|
||||
echo "Attempting to mine 1 block with $THREAD_COUNT threads..."
|
||||
|
||||
# Adjust maxtries based on thread count for better distribution
|
||||
adjusted_tries=$((1000000 * THREAD_COUNT / TOTAL_CORES))
|
||||
|
||||
mining_result=$(call_rpc "generatetoaddress" "[1, \"$RIN_ADDRESS\", $adjusted_tries]")
|
||||
|
||||
if [[ $mining_result == *"result"* ]] && [[ $mining_result != *"[]"* ]]; then
|
||||
echo "🎉 BLOCK FOUND!"
|
||||
echo "Result: $mining_result"
|
||||
break
|
||||
else
|
||||
echo "No block found in this attempt (tries: $adjusted_tries). Retrying..."
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
81
startup/solo_mining_remote.sh
Normal file
81
startup/solo_mining_remote.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/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"
|
||||
76
startup/solo_mining_rpc.sh
Normal file
76
startup/solo_mining_rpc.sh
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
# RinCoin Solo Mining via RPC
|
||||
# This script uses RinCoin's RPC interface for solo mining
|
||||
|
||||
echo "=== RinCoin Solo Mining via RPC ==="
|
||||
echo ""
|
||||
|
||||
# Configuration
|
||||
RPC_HOST="127.0.0.1"
|
||||
RPC_PORT="9556"
|
||||
RPC_USER="rinrpc"
|
||||
RPC_PASS="745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90"
|
||||
|
||||
# Function to call RPC
|
||||
call_rpc() {
|
||||
local method="$1"
|
||||
local params="$2"
|
||||
|
||||
curl -s --user "$RPC_USER:$RPC_PASS" \
|
||||
-H 'content-type: text/plain' \
|
||||
--data "{\"jsonrpc\":\"1.0\",\"id\":\"curl\",\"method\":\"$method\",\"params\":$params}" \
|
||||
"http://$RPC_HOST:$RPC_PORT/"
|
||||
}
|
||||
|
||||
# Wait for node to be ready
|
||||
echo "Waiting for RinCoin node to be ready..."
|
||||
while true; do
|
||||
response=$(call_rpc "getblockchaininfo" "[]")
|
||||
if [[ $response != *"Loading block index"* ]]; then
|
||||
break
|
||||
fi
|
||||
echo "Node still loading... waiting 10 seconds"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
echo "✅ Node is ready!"
|
||||
echo ""
|
||||
|
||||
# Get wallet address
|
||||
echo "Getting wallet address..."
|
||||
wallet_response=$(call_rpc "getnewaddress" "[]")
|
||||
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"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ RinCoin Address: $rin_address"
|
||||
echo ""
|
||||
|
||||
# Get blockchain info
|
||||
echo "Blockchain Status:"
|
||||
blockchain_info=$(call_rpc "getblockchaininfo" "[]")
|
||||
blocks=$(echo "$blockchain_info" | grep -o '"blocks":[^,]*' | cut -d':' -f2)
|
||||
headers=$(echo "$blockchain_info" | grep -o '"headers":[^,]*' | cut -d':' -f2)
|
||||
difficulty=$(echo "$blockchain_info" | grep -o '"difficulty":[^,]*' | cut -d':' -f2)
|
||||
|
||||
echo "Blocks: $blocks"
|
||||
echo "Headers: $headers"
|
||||
echo "Difficulty: $difficulty"
|
||||
echo ""
|
||||
|
||||
echo "⚠️ IMPORTANT: RinCoin solo mining requires:"
|
||||
echo "1. A fully synced node (currently at block $blocks of $headers)"
|
||||
echo "2. Mining software that supports RinCoin's RPC mining protocol"
|
||||
echo "3. Very high hashpower to find blocks solo"
|
||||
echo ""
|
||||
echo "For now, we recommend pool mining for consistent rewards:"
|
||||
echo ""
|
||||
echo "Pool Mining Command:"
|
||||
echo "sudo docker exec -it amd-strix-halo-llama-rocm bash -c \"/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://rinhash.mine.zergpool.com:7148 -u bc1qjn4m6rmrveuxhk02a5qhe4r6kdcsvvt3vhdn9j -p c=BTC,mc=RIN,ID=StrixHalo -t 32\""
|
||||
echo ""
|
||||
echo "Your RinCoin address for solo mining: $rin_address"
|
||||
83
startup/start_mining_pool.sh
Normal file
83
startup/start_mining_pool.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
# RinCoin Mining Pool Server Startup Script
|
||||
# Distributes block rewards among multiple miners
|
||||
|
||||
echo "=== RinCoin Mining Pool Server ==="
|
||||
echo ""
|
||||
|
||||
# Check if RinCoin node is running
|
||||
echo "Checking RinCoin node status..."
|
||||
if ! curl -s -u rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \
|
||||
-H 'content-type: text/plain' \
|
||||
--data '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}' \
|
||||
http://127.0.0.1:9556/ > /dev/null; then
|
||||
echo "❌ RinCoin node is not running!"
|
||||
echo "Start it first with: docker start rincoin-node"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ RinCoin node is running"
|
||||
|
||||
# Check Python dependencies
|
||||
echo "Checking Python dependencies..."
|
||||
python3 -c "import requests, sqlite3" 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 3333 is already in use
|
||||
if netstat -tln | grep -q ":3333 "; then
|
||||
echo ""
|
||||
echo "⚠️ Port 3333 is already in use!"
|
||||
echo ""
|
||||
echo "🔍 Process using port 3333:"
|
||||
sudo netstat -tlnp | grep ":3333 " || echo "Could not determine process"
|
||||
echo ""
|
||||
echo "🛑 To kill existing process:"
|
||||
echo "sudo lsof -ti:3333 | 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 3333..."
|
||||
sudo lsof -ti:3333 | xargs sudo kill -9 2>/dev/null || echo "No processes to kill"
|
||||
sleep 2
|
||||
else
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🚀 Starting Mining Pool Server..."
|
||||
echo "This will distribute block rewards among multiple miners"
|
||||
echo ""
|
||||
echo "Pool Features:"
|
||||
echo "- Multiple miner support"
|
||||
echo "- Share-based reward distribution"
|
||||
echo "- Pool fee: 1%"
|
||||
echo "- Real-time statistics"
|
||||
echo "- Web dashboard on port 8083"
|
||||
echo ""
|
||||
|
||||
echo "After it starts, miners can connect with:"
|
||||
echo ""
|
||||
echo "Option 1: Address as username"
|
||||
echo "./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q -p x"
|
||||
echo ""
|
||||
echo "Option 2: Address.workername format"
|
||||
echo "./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q.worker1 -p x"
|
||||
echo ""
|
||||
echo "Option 3: Traditional username (rewards to pool address)"
|
||||
echo "./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u username.workername -p x"
|
||||
echo ""
|
||||
echo "🌐 Web Dashboard: http://YOUR_IP:8083"
|
||||
echo "📊 View real-time pool statistics, miners, and blocks"
|
||||
echo ""
|
||||
echo "Press Ctrl+C to stop the pool"
|
||||
|
||||
# Start the mining pool
|
||||
python3 MINE/rin/stratum_pool.py
|
||||
81
startup/start_mining_with_address.sh
Normal file
81
startup/start_mining_with_address.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/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
|
||||
69
startup/start_stratum_proxy.sh
Normal file
69
startup/start_stratum_proxy.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/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 3333 is already in use
|
||||
if netstat -tln | grep -q ":3333 "; then
|
||||
echo ""
|
||||
echo "⚠️ Port 3333 is already in use!"
|
||||
echo ""
|
||||
echo "🔍 Process using port 3333:"
|
||||
sudo netstat -tlnp | grep ":3333 " || echo "Could not determine process"
|
||||
echo ""
|
||||
echo "🛑 To kill existing process:"
|
||||
echo "sudo lsof -ti:3333 | 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 3333..."
|
||||
sudo lsof -ti:3333 | 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:3333 -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
|
||||
Reference in New Issue
Block a user