diff --git a/rin/miner/cpuminer-opt-rin b/rin/miner/cpuminer-opt-rin new file mode 160000 index 0000000..42cf724 --- /dev/null +++ b/rin/miner/cpuminer-opt-rin @@ -0,0 +1 @@ +Subproject commit 42cf724c48506aed9dcb01c05a848d7c5c366945 diff --git a/rin/miner/cpuminer-opt-submodule b/rin/miner/cpuminer-opt-submodule new file mode 160000 index 0000000..132d398 --- /dev/null +++ b/rin/miner/cpuminer-opt-submodule @@ -0,0 +1 @@ +Subproject commit 132d3985e61e1430b47f718e32e27534d55243ac diff --git a/rin/miner/readme.md b/rin/miner/readme.md index 9234b88..b6b3bef 100644 --- a/rin/miner/readme.md +++ b/rin/miner/readme.md @@ -1,60 +1,26 @@ -# RinHash Miner +from https://github.com/StickyFingaz420/CPUminer-opt-rinhash -A comprehensive mining software supporting both CPU and GPU mining for the RinHash algorithm. -## ✅ VERIFIED SUCCESSFUL COMPILATIONS -### ROCm GPU Components ✅ FULLY VERIFIED & TESTED -- **GPU Miner Executable**: `rinhash-gpu-miner` (27KB, successfully compiled & tested) -- **GPU Library**: `librinhash_hip.so` (252KB, successfully compiled & tested) -- **GPU Headers**: All CUDA header files (*.cuh) compiled successfully -- **GPU Mining**: Successfully runs mining algorithm +Option 1: Build from Source (Recommended) +bash -## ⚠️ INTEGRATION STATUS: PARTIAL +Copy +# Install build dependencies +sudo apt update +sudo apt install build-essential autotools-dev autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev zlib1g-dev git automake libtool -### ✅ What's Working: -- ROCm GPU mining core (functional) -- GPU library loading and execution -- Basic mining algorithm execution +# Clone the repository (if you haven't already) +git clone https://github.com/rplant8/cpuminer-opt-rinhash.git +cd cpuminer-opt-rinhash -### ❌ What's Missing: -- **Stratum Protocol Support** (cannot connect to mining pools) -- **Real RinHash Algorithm** (cpuminer uses placeholder) -- **CPU-GPU Integration** (cpuminer build fails) +# Build it +./autogen.sh +./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer" +make -j$(nproc) -## Quick Start +# Test the newly built binary +./cpuminer -a rinhash -o stratum+tcp://192.168.0.188:3333 -u db.win -p x -t 4 +cpuminer-rinhash.exe -a rinhash -o stratum+tcp://192.168.0.188:3334 -u db.win -p x -t 4 -For detailed compilation instructions, see **[COMPILE_QUICKSTART.md](COMPILE_QUICKSTART.md)** - -## Current Status Summary - -| Component | Status | Details | -|-----------|--------|---------| -| **ROCm GPU Miner** | ✅ **VERIFIED** | Executable works, library loads, mining functional | -| **GPU Library** | ✅ **VERIFIED** | `librinhash_hip.so` compiled and tested | -| **RinHash Algorithm** | ⚠️ **PLACEHOLDER** | cpuminer uses dummy `memcpy()` implementation | -| **Stratum Protocol** | ❌ **MISSING** | No pool connection capability | -| **CPU-GPU Integration** | ❌ **MISSING** | cpuminer build fails, no GPU acceleration | - -## Testing Verified Components - -```bash -# Test GPU miner (runs successfully) -./rinhash-gpu-miner - -# Check GPU components -ls -la rinhash-gpu-miner -ls -la rocm-direct-output/gpu-libs/ - -# GPU runtime check (if ROCm installed) -rocm-smi -``` - -## 🎯 Next Development Steps - -1. **Implement Real RinHash Algorithm** in cpuminer -2. **Add Stratum Protocol Support** for pool connections -3. **Fix cpuminer Build Dependencies** -4. **Integrate GPU Acceleration** into cpuminer - -For complete documentation, see **[COMPILE_QUICKSTART.md](COMPILE_QUICKSTART.md)** \ No newline at end of file +/mnt/shared/DEV/repos/d-popov.com/mines/rin/miner/cpuminer-opt-rin/cpuminer -q -a rinhash -o stratum+tcp://localhost:3333 -u db.win -p x -t 30 \ No newline at end of file diff --git a/rin/proxy/README.md b/rin/proxy/README.md index 7988a6a..b89c996 100644 --- a/rin/proxy/README.md +++ b/rin/proxy/README.md @@ -64,7 +64,9 @@ The original code didn't show the actual hash vs target comparison, making it di /mnt/shared/DEV/repos/d-popov.com/mines/rin/proxy/ ├── custom/ # Our implementation │ ├── stratum_proxy.py # Fixed version with all issues resolved -│ └── start_stratum_proxy.sh # Startup script +│ ├── start_stratum_proxy.sh # Startup script +│ ├── view_mining_log.sh # Script to view mining log +│ └── mining_log.txt # Mining log file (created when running) ├── third-party/ # External stratum implementations │ └── [stratum library files] # Node.js stratum implementation ├── README.md # This file @@ -84,6 +86,55 @@ cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/proxy/custom 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:3334 -u user -p pass -t 28" ``` +### 3. Monitor Mining Progress +```bash +# View mining log summary +./view_mining_log.sh + +# Watch live mining log +tail -f mining_log.txt + +# View full log +cat mining_log.txt +``` + +## Mining Log Feature + +The stratum proxy now includes comprehensive logging: + +### **What Gets Logged** +- **Found Hashes**: Every valid block hash with difficulty, height, reward, nonce, and timestamp +- **Wallet Balance**: Current balance logged every 10 minutes and after each successful block +- **Mining Session**: Start time, target address, and configuration details + +### **Log File Format** +``` +================================================================================ +RinCoin Mining Log +================================================================================ +Started: 2025-09-15 22:45:30 +Target Address: rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q +Stratum: 0.0.0.0:3334 +RPC: 127.0.0.1:9556 +================================================================================ + +[2025-09-15 22:50:15] 💰 Wallet Balance: 0.00000000 RIN +[2025-09-15 23:15:30] 🎉 HASH FOUND! + Hash: 0000000123456789abcdef... + Difficulty: 0.544320 + Height: 246531 + Reward: 12.50000000 RIN + Nonce: 12345678 + Time: 68c86788 +---------------------------------------- +[2025-09-15 23:15:35] 💰 Wallet Balance: 12.50000000 RIN +``` + +### **Monitoring Commands** +- `./view_mining_log.sh` - Summary of mining activity +- `tail -f mining_log.txt` - Live log monitoring +- `grep "HASH FOUND" mining_log.txt` - Count blocks found + ## Expected Behavior with Fixed Version With your ~750 kH/s hashrate and network difficulty of 0.544320: diff --git a/rin/proxy/custom/stratum_proxy.py b/rin/proxy/custom/stratum_proxy.py index c605f1a..e9e4bd6 100644 --- a/rin/proxy/custom/stratum_proxy.py +++ b/rin/proxy/custom/stratum_proxy.py @@ -33,11 +33,57 @@ class RinCoinStratumProxy: self.running = True self.extranonce1_counter = 0 + # Logging setup + self.log_file = "mining_log.txt" + self.init_log_file() + print(f"RinCoin Stratum Proxy Server") print(f"Stratum: {stratum_host}:{stratum_port}") print(f"RPC: {rpc_host}:{rpc_port}") print(f"Target: {target_address}") + def init_log_file(self): + """Initialize mining log file with header""" + try: + with open(self.log_file, 'w') as f: + f.write("=" * 80 + "\n") + f.write("RinCoin Mining Log\n") + f.write("=" * 80 + "\n") + f.write(f"Started: {time.strftime('%Y-%m-%d %H:%M:%S')}\n") + f.write(f"Target Address: {self.target_address}\n") + f.write(f"Stratum: {self.stratum_host}:{self.stratum_port}\n") + f.write(f"RPC: {self.rpc_host}:{self.rpc_port}\n") + f.write("=" * 80 + "\n\n") + except Exception as e: + print(f"Failed to initialize log file: {e}") + + def log_hash_found(self, hash_hex, difficulty, height, reward, nonce, ntime): + """Log found hash to file""" + try: + timestamp = time.strftime('%Y-%m-%d %H:%M:%S') + with open(self.log_file, 'a') as f: + f.write(f"[{timestamp}] 🎉 HASH FOUND!\n") + f.write(f" Hash: {hash_hex}\n") + f.write(f" Difficulty: {difficulty:.6f}\n") + f.write(f" Height: {height}\n") + f.write(f" Reward: {reward:.8f} RIN\n") + f.write(f" Nonce: {nonce}\n") + f.write(f" Time: {ntime}\n") + f.write("-" * 40 + "\n") + except Exception as e: + print(f"Failed to log hash: {e}") + + def log_wallet_balance(self): + """Log current wallet balance to file""" + try: + balance = self.rpc_call("getbalance") + if balance is not None: + timestamp = time.strftime('%Y-%m-%d %H:%M:%S') + with open(self.log_file, 'a') as f: + f.write(f"[{timestamp}] 💰 Wallet Balance: {balance:.8f} RIN\n") + except Exception as e: + print(f"Failed to log wallet balance: {e}") + def rpc_call(self, method, params=[]): """Make RPC call to RinCoin node""" try: @@ -357,6 +403,10 @@ class RinCoinStratumProxy: print(f" 📊 Block height: {job['height']}") print(f" 🔍 Difficulty: {share_difficulty:.6f} (target: {network_difficulty:.6f})") + # Log the found hash + reward_rin = job['coinbasevalue'] / 100000000 + self.log_hash_found(block_hash_hex, share_difficulty, job['height'], reward_rin, nonce, ntime) + # Build complete block block = header @@ -379,6 +429,8 @@ class RinCoinStratumProxy: if result is None: print(f" ✅ Block accepted by network!") + # Log wallet balance after successful block submission + self.log_wallet_balance() return True, "Block found and submitted" else: print(f" ❌ Block rejected: {result}") @@ -563,6 +615,7 @@ class RinCoinStratumProxy: def job_updater(self): """Periodically update mining jobs""" + balance_log_counter = 0 while self.running: try: time.sleep(30) # Update every 30 seconds @@ -574,6 +627,12 @@ class RinCoinStratumProxy: if new_height > old_height: print(f"New block detected! Broadcasting new job...") self.broadcast_new_job() + + # Log wallet balance every 10 minutes (20 cycles of 30 seconds) + balance_log_counter += 1 + if balance_log_counter >= 20: + self.log_wallet_balance() + balance_log_counter = 0 except Exception as e: print(f"Job updater error: {e}") @@ -591,6 +650,9 @@ class RinCoinStratumProxy: print(f"Current height: {blockchain_info.get('blocks', 'unknown')}") print(f"Chain: {blockchain_info.get('chain', 'unknown')}") + # Log initial wallet balance + self.log_wallet_balance() + # Get initial block template if not self.get_block_template(): print("Failed to get initial block template!") @@ -611,6 +673,7 @@ class RinCoinStratumProxy: print(f" 📡 Listening on {self.stratum_host}:{self.stratum_port}") print(f" 💰 Mining to: {self.target_address}") print(f" 📊 Current job: {self.current_job['job_id'] if self.current_job else 'None'}") + print(f" 📝 Mining log: {self.log_file}") print("") print(" 🔧 Miner command:") print(f" ./cpuminer -a rinhash -o stratum+tcp://{self.stratum_host}:{self.stratum_port} -u worker1 -p x -t 4")