thread count solo mine
This commit is contained in:
@@ -6,21 +6,70 @@
|
||||
# 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=""
|
||||
if [ $# -eq 1 ]; then
|
||||
RIN_ADDRESS="$1"
|
||||
echo "Using provided address: $RIN_ADDRESS"
|
||||
elif [ $# -gt 1 ]; then
|
||||
echo "Usage: $0 [rincoin_address]"
|
||||
echo "If no address is provided, will use default: $DEFAULT_ADDRESS"
|
||||
exit 1
|
||||
else
|
||||
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
|
||||
@@ -91,25 +140,32 @@ 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 (1 block at a time, 1000000 tries max)
|
||||
# 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..."
|
||||
echo "Attempting to mine 1 block with $THREAD_COUNT threads..."
|
||||
|
||||
mining_result=$(call_rpc "generatetoaddress" "[1, \"$RIN_ADDRESS\", 1000000]")
|
||||
# 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. Retrying..."
|
||||
echo "No block found in this attempt (tries: $adjusted_tries). Retrying..."
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user