# Mining on CPU

This tutorial is divided into Windows and Docker, Docker is also suitable for running in the server.

The mining pools currently supporting STC are as follows:

<table><thead><tr><th width="180" align="center"></th><th width="166" align="center">Kelepool</th><th width="167" align="center">Dxpool</th><th width="173" align="center">Poolin</th><th align="center">ViaBTC</th></tr></thead><tbody><tr><td align="center"></td><td align="center"><a href="https://www.bixin.im/">Click</a></td><td align="center"><a href="https://www.dxpool.com/register/phone">Click</a></td><td align="center"><a href="https://www.poolin.com/">Click</a></td><td align="center"><a href="https://www.viabtc.com/signup">Click</a></td></tr><tr><td align="center">Pool Address</td><td align="center"><p>ccc.zxxx123.com</p><p>port: 22</p></td><td align="center"><p>stc.ss.dxpool.net</p><p>port: 9977 </p></td><td align="center"><p>stc.ss.poolin.com</p><p>port: 443</p></td><td align="center"><p>stc.viabtc.com</p><p>port: 3005</p></td></tr><tr><td align="center">Initial Difficulty</td><td align="center">7000</td><td align="center">10000</td><td align="center"><p>8192</p><p>Adjustable, for example, fill in the password: fixed=3000</p></td><td align="center">Adjustable, for example, fill in the password: d=3000</td></tr></tbody></table>

## For Windows User <a href="#bwkcd" id="bwkcd"></a>

### Download XMRig

Select and download the win64 version of the XMRig program.

![](/files/vqXMLYTLldtwHIWhb1ZK)

### Modify script <a href="#otcrt" id="otcrt"></a>

After downloading the XMRig program, unzip and right-click to "edit" the `start.cmd` file.

![](/files/vdYWvgrFnyaBdCheAzlh)

Modify the content of the `start.cmd` file:

```powershell
@echo off
xmrig.exe --donate-level 1 -a cn/r -o ccc.zxxx123.com:22 -u an.1 -p x -k --user-agent Ibctminer/1.0.0
pause
```

The modified result is shown in the following figure:

![](/files/LVMCQWujnSwLx8ena2RX)

### Double-click to run <a href="#l7yut" id="l7yut"></a>

double-click the `start.cmd` file.

![](/files/ECdj53w46l9jPKvMV0Xq)

## For Docker User <a href="#bucys" id="bucys"></a>

```bash
sudo docker run -d -it \
    --name starcoin-xmr \
    --restart=always \
    z0re/xmrig-stc \
    -o ccc.zxxx123.com:22 \
    -u an.1 \
    -p x \
    -a cn/r \
    --donate-level 1 \
    --cpu-max-threads-hint 90
```

Command Explanation:

* `-d`: run the container in the background;
* `--name starcoin-xmr`: specify the container name;
* `--restart=always`: If the container exits unexpectedly, it will automatically restart;
* `-o ccc.zxxx123.com:22`: mining pool address, such as cola ccc.zxxx123.com:22;
* `-u an.1`: \<sub-account name>.\<number>, such as an.1;
* `-p x` : password, just fill `x`;
* `-a cn/r`: algorithm, cn/r, do not change, only use this;
* `--donate-level`: dev fee;
* `--cpu-max-threads-hint 90`: CPU usage ratio;

![](/files/yl6mTVAuZ2jL0VmDcwMD)

## Performance Optimization

### Enable Huge Pages

According to the official documentation of XMRig, enabling Huge Pages can increase the computing power by 20%\~30%. The tutorial is as follows.

#### For Windows

**Step 1:**

`Windows Server 2003 Resource Kit Tools` must be installed first (provides SeLockMemoryPrivilege function)

Download link: <https://wwa.lanzoui.com/b0f8hmm6b> password: star

![](/files/9ULRS62dIL9PfkElaq3I)

After downloading, unzip it, and install rktools as an administrator. If it prompts an incompatible popup, you can close it and ignore it.

**Step 2:**

Open a CMD window with administrator:

![](/files/l8SK9KlDh2ebgExBDaGV)

Enter the following command in the CMD window:

```powershell
ntrights -u "这里换成自己的Windows账户名" +r SeLockMemoryPrivilege
```

{% hint style="info" %}
Note:

Press and hold \[Ctrl+Alt+Delete] to open the task manager. You can see your account name in the task manager. The screenshot is as follows.
{% endhint %}

![](/files/6BongxV743LKDBljYeBl)

![](/files/z0kUD7RNGYnrtxOPmAXP)

The prompt "successful" is successful, and then you must restart the computer! ! !

**Step 3:**

After restarting the computer, run the script again to see the effect.

![](/files/mjC3Ho1i23DlxSmfGHmT)

#### For Linux <a href="#nblgs" id="nblgs"></a>

Temporarily enable:

```bash
sudo sysctl -w vm.nr_hugepages=1280
```

Persistence is enabled (it also takes effect after restart):

```bash
sudo bash -c "echo vm.nr_hugepages=1280 >> /etc/sysctl.conf"
```

### Modify the CPU thread usage occupancy ratio

Modify file: `start.cmd`

`--cpu-max-threads-hint 80`: The ratio of the maximum number of threads automatically configured.

![](/files/iDoolSLPPPhtgRY3clne)

### Modify the number of threads <a href="#vjrvf" id="vjrvf"></a>

Modify file: `start.cmd`

`-t 4`: specify 4 threads; don't tune too much, it may backfire;

![](/files/dwAUO3MWVVxRSOzquWJR)

Check the number of threads in effect:

![](/files/tqwcprFN2GXFj8CuyKfs)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.starcoin.movemove.org/english/mining/mining-on-cpu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
