# XMRig Mining

Mine Monero (XMR) and other cryptocurrencies using XMRig on Clore.ai's GPU and CPU servers.

{% hint style="info" %}
**XMRig** is the most widely used open-source cryptocurrency miner. It supports CPU mining (RandomX algorithm for Monero) and GPU mining (KawPow, Ethash, and others). This guide covers deployment on Clore.ai servers.
{% endhint %}

{% hint style="warning" %}
**Before you start**: Always calculate profitability before mining. Factor in Clore.ai rental costs, pool fees, and current coin prices. Use a mining profitability calculator to ensure you're generating positive returns.
{% endhint %}

***

## What Is XMRig?

XMRig is a high-performance, cross-platform miner for CPU and GPU:

| Feature         | Details                                             |
| --------------- | --------------------------------------------------- |
| **CPU mining**  | Monero (XMR) via RandomX — BEST use case            |
| **GPU mining**  | KawPow (RVN), Ethash variants, Octopus              |
| **Algorithms**  | RandomX, KawPow, Ethash, Autolykos2, Octopus + more |
| **Stratum V2**  | Modern pool protocol support                        |
| **TLS support** | Encrypted pool connections                          |
| **License**     | GPL 3.0, open source                                |

### Why Clore.ai for XMRig?

* **High-core-count CPUs**: Clore.ai servers often have 32-128 CPU cores — ideal for RandomX
* **Spot pricing**: Rent cheaply during off-peak hours
* **No hardware investment**: Mine without buying and maintaining hardware
* **Flexibility**: Switch algorithms or coins based on profitability

***

## Profitability Check First

{% hint style="danger" %}
**Do this before spending a single cent on rental costs!**

Mining profitability changes daily. Always verify before starting.
{% endhint %}

### Profitability Calculators

* [minerstat.com/calc](https://minerstat.com/calc) — multi-algorithm
* [whattomine.com](https://whattomine.com) — comprehensive
* [xmrig.com/docs/algorithms](https://xmrig.com/docs/algorithms) — hashrate reference

### Quick Math

```
Daily profit = (Daily reward in USD) - (Daily rental cost)

Example (Monero, 32-core server):
- Hashrate: ~32,000 H/s (1,000 H/s per core)
- Daily XMR reward: ~0.001-0.003 XMR/day
- XMR price (example): $160
- Daily revenue: $0.16-0.48
- Server rental (32-core, ~$0.20/hr): $4.80/day

Result: NEGATIVE. High-core servers often not profitable for solo mining.

Better approach: Find cheap high-core-count servers where rental < daily reward
```

{% hint style="success" %}
**When it makes sense**: When you find a server with 64+ cores at $0.05-0.10/hr, or GPU servers at low spot prices for GPU-mineable coins. Always calculate first!
{% endhint %}

***

## Prerequisites

| Requirement         | Details                                     |
| ------------------- | ------------------------------------------- |
| Clore.ai account    | With CLORE balance                          |
| Mining pool account | Create at supportXMR.com, MoneroOcean, etc. |
| Monero wallet       | Download at getmonero.org (for XMR mining)  |
| SSH access          | Port 22                                     |

### Create a Monero Wallet

```bash
# Option 1: CLI wallet
wget https://downloads.getmonero.org/cli/linux64
tar xzf monero-linux-x64-*.tar.bz2
./monero-x86_64-linux-gnu-v*/monero-wallet-cli --generate-new-wallet mywallet

# Option 2: GUI wallet (local machine)
# Download from: https://www.getmonero.org/downloads/
```

Save your wallet address — it looks like:

```
43xxxx...long string...xxxx
```

***

## Step 1: Rent a Server

### For CPU Mining (Monero/RandomX)

1. Go to [clore.ai](https://clore.ai) → **Marketplace**
2. Filter by **CPU cores**: 32+ cores preferred
3. Look for servers with high CPU thread count
4. Port **22** is sufficient
5. Order the server

### For GPU Mining (KawPow, Octopus)

1. Filter by **GPU**: RTX 3080+, RTX 4090 for best performance
2. Ports needed: **22** only
3. NVIDIA GPUs only for CUDA mining

{% hint style="info" %}
**CPU vs GPU on Clore.ai**: Clore.ai is primarily a GPU marketplace. For Monero (RandomX), dedicated CPU servers may be cheaper. For GPU-mineable coins, NVIDIA servers offer better performance.
{% endhint %}

***

## Step 2: Deploy XMRig via Docker

### Custom Dockerfile

Create a `Dockerfile` on the server:

```dockerfile
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && apt-get install -y \
    wget \
    libssl-dev \
    libhwloc-dev \
    libuv1-dev \
    build-essential \
    cmake \
    git \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /opt/xmrig

# Download XMRig release
RUN wget https://github.com/xmrig/xmrig/releases/download/v6.21.3/xmrig-6.21.3-linux-static-x64.tar.gz \
    && tar xzf xmrig-*.tar.gz \
    && mv xmrig-*/xmrig . \
    && rm -rf xmrig-*.tar.gz xmrig-*/

# Create config directory
RUN mkdir -p /etc/xmrig

ENTRYPOINT ["/opt/xmrig/xmrig"]
```

### Build Image

```bash
docker build -t xmrig-miner .
```

### Run CPU Mining (Monero)

```bash
docker run -d \
  --name xmrig-cpu \
  --restart unless-stopped \
  --privileged \
  xmrig-miner \
  -o pool.supportxmr.com:443 \
  -u YOUR_MONERO_WALLET_ADDRESS \
  -p worker1 \
  -k \
  --tls \
  --cpu-max-threads-hint=100 \
  --log-file=/var/log/xmrig.log
```

### Run GPU Mining (KawPow - Ravencoin)

```bash
docker run -d \
  --name xmrig-gpu \
  --restart unless-stopped \
  --gpus all \
  xmrig-miner \
  -a kawpow \
  -o rvn.2miners.com:6060 \
  -u YOUR_RVN_WALLET.worker1 \
  --log-file=/var/log/xmrig.log
```

***

## Step 3: Configuration File Method

Using a config file is cleaner than command-line flags.

### Create `config.json`

```json
{
    "autosave": true,
    "background": false,
    "colors": true,
    "title": true,
    "api": {
        "id": null,
        "worker-id": "clore-worker-1",
        "port": 9090,
        "access-token": null,
        "restricted": true
    },
    "http": {
        "enabled": true,
        "host": "0.0.0.0",
        "port": 9090,
        "access-token": null,
        "restricted": true
    },
    "randomx": {
        "init": -1,
        "init-avx2": -1,
        "mode": "auto",
        "1gb-pages": false,
        "rdmsr": true,
        "wrmsr": true,
        "cache_qos": false,
        "numa": true,
        "scratchpad_prefetch_mode": 1
    },
    "cpu": {
        "enabled": true,
        "huge-pages": true,
        "huge-pages-jit": false,
        "hw-aes": null,
        "priority": null,
        "memory-pool": false,
        "yield": true,
        "max-threads-hint": 100,
        "asm": true,
        "argon2-impl": null,
        "astrobwt-max-size": 550,
        "astrobwt-avx2": false
    },
    "opencl": {
        "enabled": false,
        "cache": true,
        "loader": null,
        "platform": "AMD"
    },
    "cuda": {
        "enabled": true,
        "loader": null,
        "nvml": true
    },
    "log-file": null,
    "donate-level": 1,
    "donate-over-proxy": 1,
    "pools": [
        {
            "algo": null,
            "coin": "XMR",
            "url": "pool.supportxmr.com:443",
            "user": "YOUR_MONERO_WALLET_ADDRESS",
            "pass": "worker1",
            "rig-id": null,
            "nicehash": false,
            "keepalive": true,
            "enabled": true,
            "tls": true,
            "tls-fingerprint": null,
            "daemon": false,
            "socks5": null,
            "self-select": null,
            "submit-to-origin": false
        }
    ],
    "print-time": 60,
    "health-print-time": 60,
    "dmi": true,
    "retries": 5,
    "retry-pause": 5,
    "syslog": false,
    "tls": {
        "enabled": false,
        "protocols": null,
        "cert": null,
        "cert_key": null,
        "ciphers": null,
        "ciphersuites": null,
        "dhparam": null
    },
    "dns": {
        "ipv6": false,
        "ttl": 30
    },
    "user-agent": null,
    "verbose": 0,
    "watch": true
}
```

Replace `YOUR_MONERO_WALLET_ADDRESS` with your actual wallet address.

### Run with Config File

```bash
docker run -d \
  --name xmrig \
  --restart unless-stopped \
  --privileged \
  -v $(pwd)/config.json:/etc/xmrig/config.json \
  xmrig-miner \
  --config=/etc/xmrig/config.json
```

***

## Step 4: Enable Huge Pages (Performance Boost)

RandomX benefits significantly from 1GB huge pages. Enable on the host:

```bash
# Enable huge pages (run on Clore.ai server as root)
echo 1 > /proc/sys/vm/nr_hugepages

# For 1GB huge pages (if supported by CPU)
mkdir -p /mnt/hugepages-1g
mount -t hugetlbfs -o pagesize=1G none /mnt/hugepages-1g
echo 4 > /proc/sys/vm/nr_hugepages

# Make persistent
echo "vm.nr_hugepages = 128" >> /etc/sysctl.conf
sysctl -p
```

{% hint style="info" %}
**Performance impact**: Huge pages can increase Monero hashrate by 20-50% on some CPUs. Worth enabling if you have access to the host system.
{% endhint %}

***

## Step 5: Monitor Mining

### Check Container Status

```bash
# View real-time logs
docker logs xmrig -f

# Check stats via API
curl http://localhost:9090/2/summary | python3 -m json.tool
```

### Sample Log Output

```
[2024-03-01 10:15:23.456]  miner    speed 10s/60s/15m 31.2k 31.4k 31.1k H/s max 32.1k H/s
[2024-03-01 10:15:30.123]  net      accepted (1/0) diff 200001 (123 ms)
[2024-03-01 10:16:00.789]  miner    speed 10s/60s/15m 31.5k 31.3k 31.2k H/s max 32.1k H/s
```

### Key Metrics to Watch

| Metric          | What It Means                   |
| --------------- | ------------------------------- |
| H/s (hashrate)  | Mining speed — higher is better |
| Accepted shares | Valid work submitted to pool    |
| Rejected shares | Invalid work — should be near 0 |
| Latency         | Pool connection speed           |

### Pool Dashboard

Check your progress at your pool's website:

* **SupportXMR**: `https://supportxmr.com/#/dashboard?wallet=YOUR_ADDRESS`
* **MoneroOcean**: `https://moneroocean.stream/#/dashboard?wallet=YOUR_ADDRESS`
* **2Miners**: `https://xmr.2miners.com/account/YOUR_ADDRESS`

***

## Popular Mining Pools

### Monero (XMR) Pools

| Pool        | URL                         | Fee  | Min Payout |
| ----------- | --------------------------- | ---- | ---------- |
| SupportXMR  | pool.supportxmr.com:443     | 0.6% | 0.1 XMR    |
| MoneroOcean | gulf.moneroocean.stream:443 | 0%   | 0.003 XMR  |
| XMRig Pool  | pool.xmrig.com:443          | 1%   | 0.01 XMR   |
| MineXMR     | pool.minexmr.com:4444       | 1%   | 0.004 XMR  |

### GPU-Mineable Coins

| Coin                   | Algorithm  | Pool Example         |
| ---------------------- | ---------- | -------------------- |
| Ravencoin (RVN)        | KawPow     | rvn.2miners.com:6060 |
| Ergo (ERG)             | Autolykos2 | erg.2miners.com:8888 |
| Conflux (CFX)          | Octopus    | cfx.2miners.com:4040 |
| Ethereum Classic (ETC) | Etchash    | etc.2miners.com:1010 |

{% hint style="info" %}
**MoneroOcean is special**: It automatically switches your miner to the most profitable algorithm at any given time, while still paying in XMR. Great for maximizing returns.
{% endhint %}

***

## MoneroOcean: Auto-Profit Switching

MoneroOcean automatically mines the most profitable algorithm:

```bash
docker run -d \
  --name xmrig-mo \
  --restart unless-stopped \
  --privileged \
  xmrig-miner \
  --algo=rx/0 \
  -o gulf.moneroocean.stream:443 \
  -u YOUR_MONERO_WALLET \
  -p "YOUR_WORKER:PERFORMANCE_FEE" \
  --tls \
  --cpu-max-threads-hint=95
```

***

## Optimization Tips

### CPU Optimization

```bash
# Use all CPU threads
--cpu-max-threads-hint=100

# Set CPU priority (0=lowest, 5=highest)
--cpu-priority=3

# Disable yield (don't share CPU with other processes)
--no-yield

# Enable AVX2 for faster RandomX
# (automatic if CPU supports it)
```

### GPU Optimization (CUDA)

```json
"cuda": {
    "enabled": true,
    "loader": null,
    "nvml": true,
    "devices": [
        {
            "index": 0,
            "threads": 512,
            "blocks": 0,
            "bfactor": 0,
            "bsleep": 0,
            "affinity": -1
        }
    ]
}
```

### Dual Mining (CPU + GPU)

```json
"cpu": {
    "enabled": true,
    "max-threads-hint": 100
},
"cuda": {
    "enabled": true,
    "nvml": true
}
```

***

## Security Considerations

{% hint style="warning" %}
**Mining security checklist:**

* Never run miners as root if possible
* Don't expose the XMRig API port (9090) publicly
* Use TLS connections to pools (`--tls` flag)
* Keep XMRig updated to patch vulnerabilities
* Monitor for unusual CPU/GPU usage spikes
  {% endhint %}

### Protect API Endpoint

```json
"api": {
    "port": 9090,
    "access-token": "your-secret-token-here",
    "restricted": true
}
```

```bash
# Access with token
curl -H "Authorization: Bearer your-secret-token-here" \
     http://localhost:9090/2/summary
```

***

## Automated Profit Monitoring Script

```bash
#!/bin/bash
# monitor-mining.sh

WALLET="YOUR_WALLET_ADDRESS"
RENTAL_COST_PER_HOUR=0.50  # Your Clore.ai cost in USD

while true; do
  # Get current hashrate
  HASHRATE=$(curl -s http://localhost:9090/2/summary | \
             python3 -c "import sys,json; d=json.load(sys.stdin); print(d['hashrate']['total'][0])")
  
  echo "$(date): Hashrate: ${HASHRATE} H/s"
  echo "$(date): Hourly cost: \$${RENTAL_COST_PER_HOUR}"
  
  # Check accepted shares
  ACCEPTED=$(curl -s http://localhost:9090/2/summary | \
             python3 -c "import sys,json; d=json.load(sys.stdin); print(d['results']['shares_good'])")
  echo "$(date): Accepted shares: ${ACCEPTED}"
  
  sleep 300  # Check every 5 minutes
done
```

***

## Troubleshooting

### Low Hashrate

```bash
# Check CPU allocation in container
docker exec xmrig cat /proc/cpuinfo | grep processor | wc -l

# Ensure huge pages are enabled
cat /proc/sys/vm/nr_hugepages

# Check for thermal throttling
watch -n1 "sensors 2>/dev/null | grep temp || cat /sys/class/thermal/thermal_zone*/temp"
```

### Connection Issues

```bash
# Test pool connectivity
curl -k telnet://pool.supportxmr.com:443

# Use alternative pool if blocked
# Try: xmr.pool.minergate.com:443
```

### CUDA Errors

```bash
# Verify GPU access in container
docker exec xmrig-gpu nvidia-smi

# If missing, add --gpus all to docker run
docker stop xmrig-gpu
docker rm xmrig-gpu
# Re-run with --gpus all
```

### Container Keeps Restarting

```bash
# Check exit code
docker inspect xmrig --format='{{.State.ExitCode}}'

# View detailed logs
docker logs xmrig --since 5m

# Common causes:
# - Invalid wallet address
# - Pool connection failed
# - Config file syntax error
```

***

## Legal and Ethical Notes

{% hint style="info" %}
**Important considerations:**

1. **Check Clore.ai ToS**: Ensure mining is permitted on your rented servers
2. **Tax compliance**: Mined cryptocurrency may be taxable income in your jurisdiction
3. **Profitability**: Cloud mining is often unprofitable — do your math first
4. **Network effect**: Mining contributes to blockchain security (positive contribution)
   {% endhint %}

***

## Quick Reference

### Command-Line Flags

| Flag                       | Description                 |
| -------------------------- | --------------------------- |
| `-o URL`                   | Pool address                |
| `-u ADDRESS`               | Wallet address              |
| `-p WORKER`                | Worker name                 |
| `-a ALGO`                  | Algorithm (rx/0 for Monero) |
| `--tls`                    | Enable TLS encryption       |
| `-k`                       | Keepalive connection        |
| `--cpu-max-threads-hint=N` | Use N% of CPU threads       |
| `--donate-level=0`         | Disable dev donation        |

### Algorithm Reference

| Algorithm  | Coin            | Best Hardware |
| ---------- | --------------- | ------------- |
| rx/0       | Monero (XMR)    | CPU (RandomX) |
| kawpow     | Ravencoin (RVN) | GPU           |
| autolykos2 | Ergo (ERG)      | GPU           |
| octopus    | Conflux (CFX)   | GPU           |
| etchash    | ETC             | GPU           |

***

## Useful Links

* [XMRig GitHub](https://github.com/xmrig/xmrig)
* [XMRig Documentation](https://xmrig.com/docs)
* [WhatToMine Calculator](https://whattomine.com)
* [MoneroOcean Pool](https://moneroocean.stream)
* [SupportXMR Pool](https://supportxmr.com)
* [Clore.ai Marketplace](https://clore.ai)

***

## Summary

| Step | Action                                          |
| ---- | ----------------------------------------------- |
| 1    | Calculate profitability FIRST                   |
| 2    | Create Monero wallet at getmonero.org           |
| 3    | Register at a mining pool                       |
| 4    | Rent server (CPU cores for XMR, GPU for others) |
| 5    | Build XMRig Docker image                        |
| 6    | Configure config.json with wallet and pool      |
| 7    | Enable huge pages for 20-50% hashrate boost     |
| 8    | Start mining and monitor via pool dashboard     |

XMRig on Clore.ai gives you access to high-performance mining hardware on demand. Use it strategically — mine when prices are high and rental costs are low. Always do the math first. ⛏️

***

## Clore.ai GPU Recommendations

| Use Case                | Recommended GPU | Est. Cost on Clore.ai |
| ----------------------- | --------------- | --------------------- |
| Entry-level Mining      | RTX 3080 (10GB) | \~$0.08/gpu/hr        |
| Optimal Mining          | RTX 3090 (24GB) | \~$0.12/gpu/hr        |
| High-performance Mining | RTX 4090 (24GB) | \~$0.70/gpu/hr        |

> 💡 All examples in this guide can be deployed on [Clore.ai](https://clore.ai/marketplace) GPU servers. Browse available GPUs and rent by the hour — no commitments, full root access.
