solo address param
This commit is contained in:
@@ -3,6 +3,23 @@
|
||||
# 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"
|
||||
|
||||
# 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
|
||||
RIN_ADDRESS="$DEFAULT_ADDRESS"
|
||||
echo "No address provided, using default: $RIN_ADDRESS"
|
||||
fi
|
||||
|
||||
echo "=== RinCoin Solo Mining (Built-in Core Mining) ==="
|
||||
echo ""
|
||||
|
||||
@@ -37,18 +54,24 @@ 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)
|
||||
# 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 ""
|
||||
|
||||
if [ -z "$rin_address" ]; then
|
||||
echo "❌ Error: Could not get RinCoin address!"
|
||||
echo "Response: $wallet_response"
|
||||
# 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 "✅ RinCoin Address: $rin_address"
|
||||
echo "✅ Using RinCoin Address: $RIN_ADDRESS"
|
||||
echo ""
|
||||
|
||||
# Get blockchain info
|
||||
@@ -71,7 +94,7 @@ echo "4. Best for testing, not profitable mining"
|
||||
echo ""
|
||||
|
||||
echo "🚀 Starting Built-in Solo Mining..."
|
||||
echo "Target Address: $rin_address"
|
||||
echo "Target Address: $RIN_ADDRESS"
|
||||
echo "Press Ctrl+C to stop mining"
|
||||
echo ""
|
||||
|
||||
@@ -79,7 +102,7 @@ echo ""
|
||||
while true; do
|
||||
echo "Attempting to mine 1 block..."
|
||||
|
||||
mining_result=$(call_rpc "generatetoaddress" "[1, \"$rin_address\", 1000000]")
|
||||
mining_result=$(call_rpc "generatetoaddress" "[1, \"$RIN_ADDRESS\", 1000000]")
|
||||
|
||||
if [[ $mining_result == *"result"* ]] && [[ $mining_result != *"[]"* ]]; then
|
||||
echo "🎉 BLOCK FOUND!"
|
||||
|
||||
Reference in New Issue
Block a user