stratum working, implement mining pool, support "extranonce"

This commit is contained in:
Dobromir Popov
2025-09-02 11:54:15 +03:00
parent e816c04c8b
commit 8bdf9bf9eb
10 changed files with 1339 additions and 25 deletions

View File

@@ -1,4 +1,39 @@
# RinCoin Solo Mining Setup Complete! 🎉
# RinCoin Mining Setup Complete! 🎉
## 🎯 **Choose Your Mining Strategy:**
### **Option 1: Solo Mining (Single Miner, All Rewards to You)**
```bash
# Start solo mining proxy
./MINE/rin/start_stratum_proxy.sh
# Run your miner
./cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u user -p pass -t 28
```
**Result**: 100% of block rewards go to your wallet
### **Option 2: Mining Pool (Multiple Miners, Distributed Rewards)**
```bash
# Start mining pool
./MINE/rin/start_mining_pool.sh
# Miners connect with:
./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u username.workername -p x
```
**Result**: Block rewards distributed among all miners based on shares
### **Key Differences:**
| Feature | Solo Mining (`stratum_proxy`) | Mining Pool (`stratum_pool`) |
|---------|--------------------------------|------------------------------|
| **Rewards** | 100% to you | Distributed among miners |
| **Miners** | Single | Multiple |
| **Setup** | Simple | More complex |
| **Consistency** | Rare big payouts | Regular small payments |
| **Risk** | High variance | Lower variance |
| **Public** | No | Yes, can be published |
---
## ✅ **Successfully Built and Running:**
@@ -21,23 +56,35 @@
- **Data Directory**: `/mnt/data/docker_vol/rincoin/rincoin-node/data`
- **Docker Compose**: `MINE/rin/container.yml`
## 🚀 **Ready for Solo Mining:**
## 🚀 **Ready for Mining:**
### **Pool Mining (Zergpool)**
### **Pool Mining (Zergpool) - Recommended for Consistent Rewards**
```bash
# CPU Mining RinHash to BTC
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)**
### **Solo Mining (Local Node) - With Stratum Proxy ⭐ RECOMMENDED**
```bash
# Solo mining with default address and all cores
bash MINE/rin/solo_mining_core.sh
# Start mining with your RinCoin address (rewards go to this address!)
./MINE/rin/start_mining_with_address.sh rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q 28
# Solo mining with custom address and thread count
bash MINE/rin/solo_mining_core.sh -a rin1qkeweeh2agurz5af3eullkvtl34kcmrwl2ytkvn -t 16
# Or use the default address
./MINE/rin/start_mining_with_address.sh
```
# Solo mining with 28 threads (like your cpuminer attempt)
### **Manual Solo Mining Setup (Stratum Proxy)**
```bash
# 1. Start Stratum proxy (solo mining)
./MINE/rin/start_stratum_proxy.sh
# 2. In another terminal, connect cpuminer-opt-rin
sudo docker exec -it amd-strix-halo-llama-rocm bash -c "/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://172.17.0.1:3333 -u user -p pass -t 28"
```
### **Built-in Core Mining (Low Performance)**
```bash
# Solo mining with built-in RinCoin core (not recommended)
bash MINE/rin/solo_mining_core.sh -t 28
```
@@ -52,19 +99,96 @@ sudo docker exec -it amd-strix-halo-llama-rocm bash -c "/mnt/dl/rinhash/cpuminer
# - No built-in protocol conversion available
```
### ** we do not need a container for the cpu, so we can run it directly if we want**
1. we run stratum proxy
### **Direct CPU Mining Setup (Solo Mining - No Container Needed)**
```bash
# 1. Start stratum proxy (solo mining)
./MINE/rin/start_stratum_proxy.sh
2. we run the cpuminer
# OR run in background with logging
nohup python3 MINE/rin/stratum_proxy.py > stratum_proxy.log 2>&1 &
# 2. Run cpuminer directly on host
/home/db/Downloads/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://127.0.0.1:3333 -u user -p pass -t 28
# 3. Clean up when done
./MINE/rin/kill_stratum_proxy.sh
```
### **Mining Options Explained**
1. **Built-in Core Mining**: Uses RinCoin's `generatetoaddress` RPC command
2. **Pool Mining**: Uses cpuminer-opt-rin with Stratum pools (Zergpool)
1. **Built-in Core Mining**: Uses RinCoin's `generatetoaddress` RPC command (low performance)
2. **Pool Mining**: Uses cpuminer-opt-rin with Stratum pools (Zergpool) - consistent rewards
3. **Direct RPC Mining**: Would require custom miner implementing `getblocktemplate`
4. **Solo Mining (Stratum Proxy)**: Uses Stratum proxy to bridge cpuminer-opt-rin to RinCoin node - all rewards to you
5. **Mining Pool (Stratum Pool)**: Distributes block rewards among multiple miners - share-based rewards
## 🏊‍♂️ **Mining Pool Setup (Multiple Miners)**
Your Stratum proxy can be enhanced to work as a **full mining pool** that distributes block rewards among multiple miners!
### **Pool Features:**
-**Multiple Miner Support**: Unlimited miners can connect
-**Share-Based Rewards**: Rewards distributed based on share contributions
-**Pool Fee**: 1% fee for pool maintenance
-**Real-Time Statistics**: Web dashboard with live stats
-**Block Reward Distribution**: Automatic distribution when blocks are found
### **Quick Start Pool:**
```bash
# 1. Start the mining pool
./MINE/rin/start_mining_pool.sh
# 2. Miners connect with:
./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u username.workername -p x
```
### **Pool vs Solo Mining:**
| Feature | Solo Mining | Mining Pool |
|---------|-------------|-------------|
| **Block Rewards** | 100% to you | Distributed among miners |
| **Consistency** | Rare blocks | Regular small payments |
| **Setup** | Simple | More complex |
| **Miners** | Single | Multiple |
| **Risk** | High variance | Lower variance |
### **Publishing Your Pool:**
#### **1. Public IP Setup:**
```bash
# Get your public IP
curl ifconfig.me
# Configure firewall (if needed)
sudo ufw allow 3333/tcp
sudo ufw allow 8080/tcp # Web interface
```
#### **2. Pool Connection String:**
```
stratum+tcp://YOUR_PUBLIC_IP:3333
```
#### **3. Web Dashboard:**
- **URL**: `http://YOUR_PUBLIC_IP:8080`
- **Features**: Real-time stats, miner rankings, block history
#### **4. Pool Announcement:**
Share your pool details:
- **Algorithm**: RinHash
- **Port**: 3333
- **Fee**: 1%
- **Payout**: Automatic distribution
- **Web**: `http://YOUR_PUBLIC_IP:8080`
### **Pool Configuration:**
```python
# Edit MINE/rin/stratum_pool.py
pool_address = 'rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q' # Pool wallet
pool_fee_percent = 1.0 # Pool fee percentage
```
## build image
sudo bash -lc "cd /mnt/shared/DEV/repos/d-popov.com/scripts/MINE/rin && docker build -t rincoin-node:latest . | cat"
@@ -150,6 +274,36 @@ curl --user rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 \
2. **Solo Mining**: Very low chance of finding blocks solo. Consider pool mining for consistent rewards.
3. **RPC Access**: ✅ **WORKING** - RPC is accessible on port 9556
4. **Address Parameter**: Solo mining script accepts custom addresses or uses default
5. **Block Rewards**: When solo mining, ALL block rewards go to your specified RinCoin address
## 🛠️ **Troubleshooting:**
### **Port 3333 Already in Use**
```bash
# Check what's using the port
sudo netstat -tlnp | grep :3333
# Kill existing processes
./MINE/rin/kill_stratum_proxy.sh
# Or manually kill
sudo lsof -ti:3333 | xargs sudo kill -9
```
### **Container Can't Connect to Proxy**
```bash
# Use Docker gateway IP instead of localhost
sudo docker exec -it amd-strix-halo-llama-rocm bash -c "/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o stratum+tcp://172.17.0.1:3333 -u user -p pass -t 28"
```
### **Check Proxy Logs**
```bash
# View real-time logs
tail -f stratum_proxy.log
# Check if proxy is running
ps aux | grep stratum_proxy
```
## 🎯 **Next Steps:**