Skip to content
TariTalk
Go back

How to Build XMRig Without the Developer Donation

Published
Mining

Table of contents

Open Table of contents

Introduction

XMRig donates 1% of mining time to its developers by default. Some mining pools charge an additional 3%–5%, and withdrawal charges and other fees can leave miners with very little of their earnings. This guide walks you through building XMRig without the developer donation and running it as a systemd service, so your computing power works for you.

1. Install dependencies

apt update
apt install git build-essential cmake automake libtool autoconf -y

2. Download the source code

git clone https://github.com/xmrig/xmrig.git

3. Modify the source: disable the developer donation

Edit src/donate.h and set both of the following values to 0:

kMinimumDonateLevel = 0
kDefaultDonateLevel = 0

4. Modify the source: block or redirect donation connections

Edit src/net/strategies/DonateStrategy.cpp and change the following addresses to a local address or your own proxy address:

static constexpr const char *kDonateHost = "127.0.0.1";
static constexpr const char *kDonateHostTls = "127.0.0.1";

If you run your own XMRig Proxy, you can use a custom address instead. For example:

static constexpr const char *kDonateHost = "proxy.example.com";
static constexpr const char *kDonateHostTls = "proxy.example.com";

For custom ports, for example:

m_pools.emplace_back(kDonateHostTls, 443;
m_pools.emplace_back(kDonateHost, 3333;

5. Build with static linking

mkdir xmrig/build && cd xmrig/scripts
./build_deps.sh && cd ../build
cmake .. -DXMRIG_DEPS=scripts/deps
make -j$(nproc)

6. Edit the configuration file

Edit src/config.json:

"url": "donate.v2.xmrig.com:3333",     // Replace with your mining pool's address and port
"user": "YOUR_WALLET_ADDRESS"          // Replace with your wallet address

7. Set up a system service (optional)

Assuming you have placed both xmrig and config.json in /root/, create a systemd service:

cat > /etc/systemd/system/xmrig.service << EOF
[Unit]
Description=miner service
[Service]
ExecStart=/root/xmrig --config=/root/config.json
Restart=always
Nice=10
CPUWeight=1
[Install]
WantedBy=multi-user.target
EOF

8. Common commands


9. Enable HugePages (improve hashrate)

Enabling HugePages is recommended and can improve hashrate by 20%–30%, but it reserves about 2.5 GB of memory:

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

The setting takes effect after a reboot.


Share this post:

Previous post
The Tari Genesis Block Manifesto
Next post
XMRig Proxy Deployment Guide