Mining - primecoin/primecoin GitHub Wiki

Pool Mining

Pool Mining with Mad Prime Miner

Configuration instructions of xpmclient

Mining Pools :

coinsforall

xpmforall

Pool Mining - Ubuntu 24.04 Noble Numbat

Ubuntu 24.04 instructions (verified on nVidia GeForce GTX 1060):
Ubuntu 20.04 instructions (verified on nVidia Tesla T4):
Ubuntu 18.04 instructions (verified on nVidia Tesla M60):

lspci command can confirm graphics hardware:

lspci | grep -i nvidia

The easiest way to install drivers is probably this:

# ppa was needed for 18.04 BionicBeaver, but not 20.04 FocalFossa
# sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install ubuntu-drivers-common -y
#Issues: https://www.nemotos.net/?p=5061
sudo apt install alsa-base
sudo ubuntu-drivers autoinstall

Then reboot the system:

sudo shutdown -r now

After reboot:

# If on 18.04 BionicBeaver:
# sudo apt install gcc-6
sudo apt install nvidia-cuda-toolkit -y
nvcc --version

WSL Ubuntu on Windows (verified on Windows 10 w/ GTX 1060):

AMD ROCm Ubuntu native tutorial is here.

AWS Ubuntu 18.04 instructions (verified on AMD):

Please follow the article here to install driver.

AMD Ubuntu 22.04 JammyJellyfish instructions (verified on AMD ryzen 7 4800u though xpmclient crashes. Still crashes with ROCm 6.2.4. mixbench opencl works though):

# Download latest radeon driver for ubuntu 22.04 from https://www.amd.com/en/support/linux-drivers
sudo dpkg -i amdgpu-install_5.4.50403-1_all.deb # this is the 24FEB2023 version
sudo amdgpu-install --usecase=workstation,rocm,opencl --opencl=rocr,legacy --vulkan=pro --accept-eula
sudo adduser $USER render # add to render group
# Reboot then clinfo should show the amd gpu

Then follow the configuration instructions of xpmclient and begin mining!

AMD Ubuntu 24.04 (verified on AMD Ryzen™ 5 PRO 8500GE though xpmclient crashes. Still crashes with ROCm 6.3.3. mixbench opencl works though):

sudo apt update
sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"
sudo apt install python3-setuptools python3-wheel
sudo usermod -a -G render,video $LOGNAME # Add the current user to the render and video groups
wget https://repo.radeon.com/amdgpu-install/6.3.3/ubuntu/noble/amdgpu-install_6.3.60303-1_all.deb
sudo apt install ./amdgpu-install_6.3.60303-1_all.deb
sudo apt update
sudo apt install amdgpu-dkms rocm
# To apply all settings, reboot your system

Solo Mining (work in progess, for developers only)

How to Build xpmclient - Ubuntu 18.04 BionicBeaver, Ubuntu 20.04 FocalFossa

This build instruction is based on https://github.com/eXtremal-ik7/xpmclient/tree/master/contrib and has been tested in Ubuntu 18.04 and Ubuntu 20.04. To build xpmclient, you don't need a GPU in your machine.

1, Install docker (on Windows 10 also needed msys2 or different bash terminal)

2, Download latest CUDA 10 for Windows: https://developer.nvidia.com/cuda-downloads and put it to contrib directory Setup CUDA10_INSTALLER variable in deploy.sh file: CUDA10_INSTALLER="cuda_11.2.2_461.33_win10.exe"

3,

cd contrib
sudo bash deploy.sh

Sometimes, you need to remove docker exec $CONTAINER chmod +x /home/user/build/build.sh in deploy.sh

How to Build xpmcpuminer on Ubuntu/NixOS

git clone https://github.com/primecoin/xpmminer
cd xpmminer
# Ubuntu 24.04 Noble Numbat, 22.04 Jammy Jellyfish
# Install dependencies
sudo apt install build-essential cmake libcurl4-gnutls-dev libncurses5-dev libncursesw5-dev
sudo apt install libgmp-dev libjansson-dev 
# libssl 3 seems okay with xpmcpuminer
sudo apt install libssl-dev
# 18.04 BionicBeaver can install libssl1.0-dev directly
# Workaround for 20.04 FocalFossa:
# echo "deb http://security.ubuntu.com/ubuntu bionic-security main" | sudo tee -a /etc/apt/sources.list.d/bionic.list
# sudo apt update
# sudo apt install libssl1.0-dev
# NixOS 23.05 Stoat
nix-shell -p cmake openssl jansson gmp5 curl

Then build xpmcpuminer:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILDOPENCLMINER=OFF -DBUILDCUDAMINER=OFF ../src
make

Mining with xpmcpuminer (not recommended for mainnet as less efficient compared to GPU mining, good for testnet):

# Authenticated daemon/node RPC
CPU/xpmcpuminer --url <rpc-host>:<rpc-port> --user <rpc-user> --pass <rpc-password> --wallet <miner-address>
# Unauthenticated daemon/node RPC or solo pool JSONRPC passthrough
CPU/xpmcpuminer --url <rpc-url> --wallet <miner-address>

How to Build xpmcudaminer - Ubuntu 24.04/NobleNumbat 22.04/JammyJellyfish 20.04/FocalFossa

First install dependencies as in the case of cpu miner above.

# ubuntu 22.04+ requires gcc10
sudo apt install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10

To build cuda miner we need a local installation of cuda toolkit 11.3:

cd xpmminer
mkdir build && cd build
# Do local installation of cuda toolkit
mkdir depends && cd depends
DEP=`pwd`
mkdir toolkit
mkdir samples
mkdir tmp
# Download cuda toolkit 11.3
wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run
chmod u+x cuda_11.3.0_465.19.01_linux.run
# Install cuda toolkit to local directories
./cuda_11.3.0_465.19.01_linux.run --toolkit --toolkitpath=$DEP/toolkit    --samples --samplespath=$DEP/samples --tmpdir=$DEP/tmp --silent
# Now ready to build
cd .. # back to build directory
cmake ../src/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$DEP  -DSTATIC_BUILD=ON -DOPENCL_INCLUDE_DIR=$DEP/toolkit/include -DOPENCL_LIBRARY=$DEP/toolkit/lib64/libOpenCL.so  -DCUDA_DRIVER_LIBRARY=$DEP/toolkit/lib64/stubs/libcuda.so -DCUDA_CUDA_LIBRARY=$DEP/toolkit/lib64/libcudart.so -DCUDA_nvrtc_LIBRARY=$DEP/toolkit/lib64/libnvrtc.so  -DCUDA_TOOLKIT_ROOT_DIR=$DEP/toolkit -DBUILDCUDAMINER=ON -DBUILDOPENCLMINER=OFF
make
# Both cpuminer and cudaminer should have been built.

to run, cd Cuda

  1. copy libnvrtc.so.11.2 libnvrtc-builtins.so.11.2 to running directory
  2. mkdir -p xpm/cuda
  3. cp ../../src/Cuda/*cu xpm/cuda/
  4. create run.sh:
#/bin/bash
DIR=$(dirname "$0")
LD_LIBRARY_PATH=$DIR/. ./xpmcuda $@

How to build xpmclminer - Ubuntu 18.04 Bionic with AMD GPU(Experimental)

git clone https://github.com/eXtremal-ik7/xpmminer.git
cd xpmminer
# Install dependencies
sudo apt install libgmp-dev libjansson-dev libcurl4-gnutls-dev libncurses5-dev libncursesw5-dev ocl-icd-opencl-dev libssl-dev

Fix functional error:

vi ./src/OpenCL/utils.cpp 

#Add #include <functional> at the head of the file.

Then build miner:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../src
make

And in the end there will be openssl linking problem. It can fixed by execute this command:

cd ./OpenCL
/usr/bin/c++   -std=c++0x -O3 -DNDEBUG  -rdynamic CMakeFiles/xpmclminer.dir/xpmclminer.cpp.o CMakeFiles/xpmclminer.dir/benchmarks.cpp.o CMakeFiles/xpmclminer.dir/utils.cpp.o  -o xpmclminer ../common/libcommon.a ../blkmaker/libblkmaker.a -lgmp -lgmpxx -lcurl -ljansson -lOpenCL -lncurses -lpthread -lssl -lcrypto

Note that the linking problem is fixed because adding -lssl -lcrypto to the end. Now you can double verify if the miner built successfully by make again and the executable xpmclminer should be in the directory.

How to build xpmclminer - Ubuntu 24.04 Bionic with AMD GPU(Experimental)

git clone https://github.com/primecoin/xpmminer.git
cd xpmminer
# Install dependencies
sudo apt install libgmp-dev libjansson-dev libcurl4-gnutls-dev libncurses5-dev libncursesw5-dev ocl-icd-opencl-dev libssl-dev

Then build miner:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../src
make
#To bypass optimization issues, run the miner with the --disable-opt flag:

Building xpmclient (AMD OpenCL Version) on Ubuntu 20.04

# protobuf-3.6.1 
 wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz
tar -xzvf protobuf-all-3.6.1.tar.gz 
cd protobuf-3.6.1/
./configure --prefix=/usr/local/
sudo make
sudo make install
# CLRX
git clone https://github.com/CLRX/CLRX-mirror.git
cd CLRX-mirror/
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/install/x86_64-Linux
make
make install

install ZeroMQ:

sudo apt-get update
sudo apt-get install libzmq3-dev

Then build xpmclient:

git clone https://github.com/eXtremal-ik7/xpmclient.git
cd xpmclient
mkdir build && cd build
cmake ../src \
  -DCMAKE_BUILD_TYPE=Release \
  -DSTATIC_BUILD=ON \
  -DCMAKE_INSTALL_PREFIX=$HOME/install/x86_64-Linux \
  -DCLRX_INCLUDE_DIRECTORY=$HOME/install/x86_64-Linux/include \
  -DCLRX_CONFIG_INCLUDE_DIRECTORY=$HOME/install/x86_64-Linux/include \
  -DCLRX_AMDASM_LIBRARY=$HOME/install/x86_64-Linux/lib64/libCLRXAmdAsm.a \
  -DCLRX_AMDBIN_LIBRARY=$HOME/install/x86_64-Linux/lib64/libCLRXAmdBin.a \
  -DCLRX_UTILS_LIBRARY=$HOME/install/x86_64-Linux/lib64/libCLRXUtils.a \
  -DOpenCL_LIBRARY=/usr/lib/x86_64-linux-gnu/libOpenCL.so
make -j$(nproc)
⚠️ **GitHub.com Fallback** ⚠️