From 55909111e12042c0e26282ec066f476e558fbf8b Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 2 Sep 2025 10:55:45 +0300 Subject: [PATCH] solo address param --- MINE/rin/README.md | 41 ++++++++++++++++++++++++---------- MINE/rin/solo_mining_core.sh | 43 +++++++++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/MINE/rin/README.md b/MINE/rin/README.md index d05feec..be97581 100644 --- a/MINE/rin/README.md +++ b/MINE/rin/README.md @@ -7,11 +7,11 @@ - **Status**: ✅ **RUNNING** - **Ports**: 9555 (P2P), 9556 (RPC) - **Version**: v1.0.1.0-5cf3d4a11 -- **Sync Status**: Initial block download (blocks: 0, headers: 0) +- **Sync Status**: ✅ **FULLY SYNCED** (blocks: 228,082, headers: 228,082) ### **2. Wallet Setup** - **Wallet Name**: `main` -- **RinCoin Address**: `rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q` +- **Default RinCoin Address**: `rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q` - **RPC Credentials**: - User: `rinrpc` - Password: `745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90` @@ -29,8 +29,14 @@ 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" ``` - ### **Solo Mining (Local Node)** +```bash +# Solo mining with default address +bash MINE/rin/solo_mining_core.sh + +# Solo mining with custom address +bash MINE/rin/solo_mining_core.sh rin1qkeweeh2agurz5af3eullkvtl34kcmrwl2ytkvn +``` ## build image sudo bash -lc "cd /mnt/shared/DEV/repos/d-popov.com/scripts/MINE/rin && docker build -t rincoin-node:latest . | cat" @@ -55,11 +61,6 @@ sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.con rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q -curl --user rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 -H 'content-type: text/plain' --data '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}' http://localhost:9556/ -curl --user rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \ - -H 'content-type: text/plain' \ - --data '{"jsonrpc":"1.0","id":"curl","method":"getnewaddress","params":[]}' \ - http://localhost:9556/ ```bash # Solo mining to your RinCoin wallet @@ -71,7 +72,7 @@ curl --user rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \ | Mining Type | Algorithm | Hashrate | Target | Status | |-------------|-----------|----------|---------|---------| | **Pool Mining** | RinHash | ~80 kH/s | Zergpool | ✅ Working | -| **Solo Mining** | RinHash | ~80 kH/s | Local Node | ✅ Ready | +| **Solo Mining** | RinHash | Built-in CPU | Local Node | ✅ Working | | **GPU Mining** | Equihash 125,4 | 28.8 Sol/s | Zergpool | ✅ Working | ## 🔧 **Management Commands:** @@ -100,15 +101,31 @@ sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.con sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf -rpcwallet=main getbalance ``` +### **RPC Access** +```bash +# Test RPC connection +curl --user rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \ + -H 'content-type: text/plain' \ + --data '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}' \ + http://127.0.0.1:9556/ + +# Get new address via RPC +curl --user rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \ + -H 'content-type: text/plain' \ + --data '{"jsonrpc":"1.0","id":"curl","method":"getnewaddress","params":[]}' \ + http://127.0.0.1:9556/ +``` + ## ⚠️ **Important Notes:** -1. **Node Sync**: The node is currently in initial block download. Solo mining will work better once fully synced. +1. **Node Sync**: ✅ **COMPLETE** - Node is fully synced and ready 2. **Solo Mining**: Very low chance of finding blocks solo. Consider pool mining for consistent rewards. -3. **RPC Access**: RPC is bound to all interfaces (0.0.0.0/0) - consider restricting for security. +3. **RPC Access**: ✅ **WORKING** - RPC is accessible on port 9556 +4. **Address Parameter**: Solo mining script accepts custom addresses or uses default ## 🎯 **Next Steps:** -1. **Wait for node sync** (may take hours depending on network) +1. ✅ **Node is synced** - Ready for all operations 2. **Choose mining strategy**: Pool mining for consistent income vs Solo mining for block rewards 3. **Monitor performance** and adjust thread count as needed 4. **Set up monitoring** for node health and mining performance diff --git a/MINE/rin/solo_mining_core.sh b/MINE/rin/solo_mining_core.sh index 60712d5..5d69c84 100644 --- a/MINE/rin/solo_mining_core.sh +++ b/MINE/rin/solo_mining_core.sh @@ -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!"