323 lines
11 KiB
Markdown
323 lines
11 KiB
Markdown
# RinCoin Mining Setup Complete! 🎉
|
|
|
|
## 🎯 **Choose Your Mining Strategy:**
|
|
|
|
### **Option 1: Solo Mining (Single Miner, All Rewards to You)**
|
|
```bash
|
|
# Start solo mining proxy
|
|
cd /mnt/shared/DEV/repos/d-popov.com/scripts
|
|
|
|
./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 their RinCoin addresses:
|
|
# Option 1: Address as username
|
|
./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q -p x
|
|
|
|
# Option 2: Address.workername format
|
|
./cpuminer -a rinhash -o stratum+tcp://YOUR_IP:3333 -u rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q.worker1 -p x
|
|
|
|
# Option 3: Traditional username (rewards to pool address)
|
|
./cpuminer -a rinhash -o stratum+tcp://192.168.0.188:3333 -u username.workername -p x -t 4
|
|
```
|
|
**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:**
|
|
|
|
### **1. RinCoin Node Container**
|
|
- **Container**: `rincoin-node` (ID: 87b5f74a2472)
|
|
- **Status**: ✅ **RUNNING**
|
|
- **Ports**: 9555 (P2P), 9556 (RPC)
|
|
- **Version**: v1.0.1.0-5cf3d4a11
|
|
- **Sync Status**: ✅ **FULLY SYNCED** (blocks: 228,082, headers: 228,082)
|
|
|
|
### **2. Wallet Setup**
|
|
- **Wallet Name**: `main`
|
|
- **Default RinCoin Address**: `rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q`
|
|
- **RPC Credentials**:
|
|
- User: `rinrpc`
|
|
- Password: `745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90`
|
|
|
|
### **3. Configuration Files**
|
|
- **Config**: `/mnt/data/docker_vol/rincoin/rincoin-node/rincoin.conf`
|
|
- **Data Directory**: `/mnt/data/docker_vol/rincoin/rincoin-node/data`
|
|
- **Docker Compose**: `MINE/rin/container.yml`
|
|
|
|
## 🚀 **Ready for Mining:**
|
|
|
|
### **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) - With Stratum Proxy ⭐ RECOMMENDED**
|
|
```bash
|
|
# Start mining with your RinCoin address (rewards go to this address!)
|
|
./MINE/rin/start_mining_with_address.sh rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q 28
|
|
|
|
# Or use the default address
|
|
./MINE/rin/start_mining_with_address.sh
|
|
```
|
|
|
|
### **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
|
|
```
|
|
|
|
### **Why cpuminer-opt-rin Can't Mine Directly to Node**
|
|
```bash
|
|
# This command will fail:
|
|
sudo docker exec -it amd-strix-halo-llama-rocm bash -c "/mnt/dl/rinhash/cpuminer-opt-rin/cpuminer -a rinhash -o http://127.0.0.1:9556 -u rinrpc -p 745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90 -t 28 --coinbase-addr=bc1qjn4m6rmrveuxhk02a5qhe4r6kdcsvvt3vhdn9j"
|
|
|
|
# Reason: Protocol mismatch
|
|
# - cpuminer-opt-rin uses Stratum protocol (for mining pools)
|
|
# - RinCoin node uses RPC protocol (for direct mining)
|
|
# - No built-in protocol conversion available
|
|
```
|
|
|
|
### **Direct CPU Mining Setup (Solo Mining - No Container Needed)**
|
|
```bash
|
|
# 1. Start stratum proxy (solo mining)
|
|
./MINE/rin/start_stratum_proxy.sh
|
|
|
|
# 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 (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"
|
|
|
|
|
|
## start container
|
|
sudo docker run -d --name rincoin-node \
|
|
-p 9555:9555 -p 9556:9556 \
|
|
-v /mnt/data/docker_vol/rincoin/rincoin-node/data:/data \
|
|
-v /mnt/data/docker_vol/rincoin/rincoin-node/rincoin.conf:/data/rincoin.conf:ro \
|
|
rincoin-node:latest -datadir=/data -conf=/data/rincoin.conf -printtoconsole
|
|
|
|
|
|
|
|
## check if running
|
|
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 wallet
|
|
sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf createwallet "main"
|
|
sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf -rpcwallet=main getnewaddress
|
|
rin1qahvvv9d5f3443wtckeqavwp9950wacxfmwv20q
|
|
|
|
|
|
|
|
```bash
|
|
# Solo mining to your RinCoin wallet
|
|
./MINE/rin/solo_mining.sh
|
|
```
|
|
|
|
## 📊 **Performance Comparison:**
|
|
|
|
| Mining Type | Algorithm | Hashrate | Target | Status |
|
|
|-------------|-----------|----------|---------|---------|
|
|
| **Pool Mining** | RinHash | ~80 kH/s | Zergpool | ✅ Working |
|
|
| **Solo Mining** | RinHash | Built-in CPU | Local Node | ✅ Working |
|
|
| **GPU Mining** | Equihash 125,4 | 28.8 Sol/s | Zergpool | ✅ Working |
|
|
|
|
## 🔧 **Management Commands:**
|
|
|
|
### **Node Management**
|
|
```bash
|
|
# Start node
|
|
sudo docker start rincoin-node
|
|
|
|
# Stop node
|
|
sudo docker stop rincoin-node
|
|
|
|
# View logs
|
|
sudo docker logs -f rincoin-node
|
|
|
|
# Check sync status
|
|
sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf getblockchaininfo
|
|
```
|
|
|
|
### **Wallet Management**
|
|
```bash
|
|
# Get new address
|
|
sudo docker exec rincoin-node rincoin-cli -datadir=/data -conf=/data/rincoin.conf -rpcwallet=main getnewaddress
|
|
|
|
# Check balance
|
|
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**: ✅ **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**: ✅ **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:**
|
|
|
|
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
|