rincoin node wip
This commit is contained in:
92
MINE/rin/solo_mining_core.sh
Normal file
92
MINE/rin/solo_mining_core.sh
Normal file
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
|
||||
# RinCoin Solo Mining using Built-in Core Mining
|
||||
# Uses RinCoin Core's generatetoaddress command
|
||||
|
||||
echo "=== RinCoin Solo Mining (Built-in Core Mining) ==="
|
||||
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: 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 ""
|
||||
|
||||
echo "🚀 Starting Built-in Solo Mining..."
|
||||
echo "Target Address: $rin_address"
|
||||
echo "Press Ctrl+C to stop mining"
|
||||
echo ""
|
||||
|
||||
# Start built-in mining (1 block at a time, 1000000 tries max)
|
||||
while true; do
|
||||
echo "Attempting to mine 1 block..."
|
||||
|
||||
mining_result=$(call_rpc "generatetoaddress" "[1, \"$rin_address\", 1000000]")
|
||||
|
||||
if [[ $mining_result == *"result"* ]] && [[ $mining_result != *"[]"* ]]; then
|
||||
echo "🎉 BLOCK FOUND!"
|
||||
echo "Result: $mining_result"
|
||||
break
|
||||
else
|
||||
echo "No block found in this attempt. Retrying..."
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user