Mining Monero with 0% Dev fee

Mining Monero with 0% Dev fee

This is a quick guide on how to start mining Monero on Linux and configure the dev tax to 0%. 

Go to XMRig.com -> docs -> XMRrig miner (https://xmrig.com/docs/miner) -> Ubuntu (https://xmrig.com/docs/miner/build/ubuntu)

We'll be using the code in the Advanced build section

Only run the first 3 commands:

terminal

sudo apt install git build-essential cmake automake libtool autoconf
git clone https://github.com/xmrig/xmrig.git
mkdir xmrig/build && cd xmrig

Once that's done you'll need to go into the src folder that's located inside xmrig. Inside src, locate the donate.h file

terminal

cd src
sudo nano donate.h

Go to the bottom of the file and change the values of kDefaultDonateLevel and kMinimumDonateLevel to 0:

c/c++

constexpr const int kDefaultDonateLevel = 0;
constexpr const int kMinimumDonateLevel = 0;

Save the file (write out), go back to the scripts folder and run:

terminal

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

After compiling you should see this in the /xmrig/build folder

terminal

CMakeCache.txt  CMakeFiles  cmake_install.cmake  libxmrig-asm.a  Makefile  src  xmrig

There is your 0% dev tax XMRig program, move the file to the main folder and create the config.json file. Run this while inside the build folder:

terminal

sudo mv -v xmrig ..
cd ..
sudo touch config.json
sudo nano config.json

This is the config.json that I used. You'll need to change some of the pool entries (url, user, etc., unless you want me to receive your mining rewards)

json

{
    "api": {
        "id": null,
        "worker-id": null
    },
    "http": {
        "enabled": false,
        "host": "127.0.0.1",
        "port": 0,
        "access-token": null,
        "restricted": true
    },
    "autosave": false,
    "background": false,
    "colors": true,
    "title": true,
    "randomx": {
        "init": -1,
        "init-avx2": -1,
        "mode": "auto",
        "1gb-pages": true,
        "rdmsr": true,
        "wrmsr": true,
        "cache_qos": false,
        "numa": true,
        "scratchpad_prefetch_mode": 1
    },
    "cpu": {
        "enabled": true,
        "huge-pages": true,
        "huge-pages-jit": true,
        "hw-aes": true,
        "priority": null,
        "memory-pool": false,
        "yield": true,
        "max-threads-hint": 85,
        "asm": true,
        "argon2-impl": null,
        "cn/0": false,
        "cn-lite/0": false
    },
    "opencl": {
        "enabled": false,
        "cache": true,
        "loader": null,
        "platform": "AMD",
        "adl": true,
        "cn-lite/0": false,
        "cn/0": false
    },
    "cuda": {
        "enabled": false,
        "loader": null,
        "nvml": true,
        "cn": [
            {
                "index": 0,
                "threads": 66,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "cn-heavy": [
            {
                "index": 0,
                "threads": 32,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "cn-lite": [
            {
                "index": 0,
                "threads": 128,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "cn-pico": [
            {
                "index": 0,
                "threads": 128,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "cn/2": [
            {
                "index": 0,
                "threads": 66,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "cn/upx2": [
            {
                "index": 0,
                "threads": 128,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "kawpow": [
            {
                "index": 0,
                "threads": 256,
                "blocks": 10240,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "rx": [
            {
                "index": 0,
                "threads": 32,
                "blocks": 10,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
        ],
        "cn-lite/0": false,
        "cn/0": false
    },
    "log-file": null,
    "donate-level": 0,
    "donate-over-proxy": 0,
    "pools": [
        {
            "algo": "rx/0",
            "coin": null,
            "url": "stratum+ssl://xmr.tallhatdoug.com:4244",
            "user": "89oXy589apZc8RKEN7Y3tc5NxqNTH6ucp4vmTceFziKhRJUxbmsgJCHA5DbQUitcxVRjjc3kiqP5iSLs4FXk5pPHUb1qQDB",
            "pass": "x",
            "rig-id": "fleebr",
            "nicehash": false,
            "keepalive": false,
            "enabled": true,
            "tls": true,
            "sni": false,
            "tls-fingerprint": null,
            "daemon": false,
            "socks5": null,
            "self-select": null,
            "submit-to-origin": false
        }
    ],
    "retries": 5,
    "retry-pause": 5,
    "print-time": 60,
    "health-print-time": 60,
    "dmi": true,
    "syslog": false,
    "tls": {
        "enabled": false,
        "protocols": null,
        "cert": null,
        "cert_key": null,
        "ciphers": null,
        "ciphersuites": null,
        "dhparam": null
    },
    "dns": {
        "ip_version": 0,
        "ttl": 30
    },
    "user-agent": null,
    "verbose": 0,
    "watch": true,
    "pause-on-battery": false,
    "pause-on-active": false
}

Once the json file is created and in the same folder as the xmrig executable, you'll be ready to go. To start mining run:

terminal

sudo ./xmrig

If you have an NVIDIA GPU and would like to use that to mine as well, then you'll have to install the NVIDIA and CUDA drivers first. I followed this resource to install the drivers on Kali: Install NVIDIA GPU Drivers

If you're on another distribution you can use this: https://developer.nvidia.com/cuda-downloads

Once you've installed the drivers and made sure they are working properly, you can run the following in a separate folder:

terminal

git clone https://github.com/xmrig/xmrig-cuda.git
mkdir xmrig-cuda/build && cd xmrig-cuda/build
CC=gcc-13 CXX=g++-13 cmake .. -DCUDA_LIB=/usr/lib/x86_64-linux-gnu/stubs/libcuda.so -DCUDA_TOOLKIT_ROOT_DIR=/usr/lib/cuda/
make -j$(nproc)

You might need to change the path to libcuda.so, so make sure you find that file in your device and place the correct path in the command.


Compiling might take a while, once it's done, locate and copy the libxmrig-cuda.so file in the same folder as your xmrig executable. Edit the config.json file to enable cuda:

json


    "cuda": {
        "enabled": true,
        "loader": null,
        "nvml": true,
        "cn": [
            {
                "index": 0,
                "threads": 66,
                "blocks": 15,
                "bfactor": 0,
                "bsleep": 0,
                "affinity": -1,
                "dataset_host": false
            }
          }

If you did everything right you should be seeing something like this:

 

Back to blog