success log
This commit is contained in:
@@ -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:
|
||||
|
@@ -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")
|
||||
|
Reference in New Issue
Block a user