How to mine with Zebra on testnet
Important
s-nomp has not been updated for NU5, so you'll need the fixes in the branches below.
These fixes disable mining pool operator payments and miner payments: they just pay to the address configured for the node.
Install, run, and sync Zebra
-
Configure
zebrad.toml:- change the
network.networkconfig toTestnet - add your testnet transparent address in
mining.miner_address, or you can use the ZF testnet addresst27eWDgjFYJGVXmzrXeVjnb5J3uXDM9xH9v - ensure that there is an
rpc.listen_addrin the config to enable the RPC server - disable the cookie auth system by changing
rpc.enable_cookie_authtofalse
Example config:
[consensus] checkpoint_sync = true [mempool] eviction_memory_time = '1h' tx_cost_limit = 80000000 [metrics] [network] crawl_new_peer_interval = '1m 1s' initial_mainnet_peers = [ 'dnsseed.z.cash:8233', 'dnsseed.str4d.xyz:8233', 'mainnet.seeder.zfnd.org:8233', 'mainnet.is.yolo.money:8233', ] initial_testnet_peers = [ 'dnsseed.testnet.z.cash:18233', 'testnet.seeder.zfnd.org:18233', 'testnet.is.yolo.money:18233', ] listen_addr = '0.0.0.0:18233' network = 'Testnet' peerset_initial_target_size = 25 [rpc] debug_force_finished_sync = false parallel_cpu_threads = 1 listen_addr = '127.0.0.1:18232' enable_cookie_auth = false [state] cache_dir = '/home/ar/.cache/zebra' delete_old_database = true ephemeral = false [sync] checkpoint_verify_concurrency_limit = 1000 download_concurrency_limit = 50 full_verify_concurrency_limit = 20 parallel_cpu_threads = 0 [tracing] buffer_limit = 128000 force_use_color = false use_color = true use_journald = false [mining] miner_address = 't27eWDgjFYJGVXmzrXeVjnb5J3uXDM9xH9v' - change the
-
Run Zebra with the config you created:
zebrad -c zebrad.toml -
Wait for Zebra to sync to the testnet tip. This takes 8-12 hours on testnet (or 2-3 days on mainnet) as of October 2023.
Install s-nomp
General instructions with Debian/Ubuntu examples
Install dependencies
-
Install
redisand run it on the default port: https://redis.io/docs/getting-started/sudo apt install lsb-release curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list sudo apt-get update sudo apt-get install redis redis-server -
Install and activate a node version manager (e.g.
nodenvornvm) -
Install
boostandlibsodiumdevelopment librariessudo apt install libboost-all-dev sudo apt install libsodium-dev
Install s-nomp
-
git clone https://github.com/ZcashFoundation/s-nomp -
cd s-nomp -
Use the Zebra fixes:
git checkout zebra-mining -
Use node 10:
nodenv install 10 nodenv local 10or
nvm install 10 nvm use 10 -
Update dependencies and install:
export CXXFLAGS="-std=gnu++17" npm update npm install
Arch-specific instructions
Install s-nomp
-
Install Redis, and development libraries required by S-nomp
sudo pacman -S redis boost libsodium -
Install
nvm, Python 3.10 andvirtualenvparu -S python310 nvm sudo pacman -S python-virtualenv -
Start Redis
sudo systemctl start redis -
Clone the repository
git clone https://github.com/ZcashFoundation/s-nomp && cd s-nomp -
Use Node 10:
unset npm_config_prefix source /usr/share/nvm/init-nvm.sh nvm install 10 nvm use 10 -
Use Python 3.10
virtualenv -p 3.10 s-nomp source s-nomp/bin/activate -
Update dependencies and install:
npm update npm install
Run s-nomp
- Edit
pool_configs/zcash.jsonsodaemons[0].portis your Zebra port - Run
s-nompusingnpm start
Note: the website will log an RPC error even when it is disabled in the config. This seems like a s-nomp bug.
Install a CPU or GPU miner
Install dependencies
General instructions
- Install a statically compiled
boostandicu. - Install
cmake.
Arch-specific instructions
sudo pacman -S cmake boost icu
Install nheqminer
We're going to install nheqminer, which supports multiple CPU and GPU Equihash
solvers, namely djezo, xenoncat, and tromp. We're using tromp on a CPU
in the following instructions since it is the easiest to install and use.
git clone https://github.com/ZcashFoundation/nheqminercd nheqminer- Use the Zebra fixes:
git checkout zebra-mining - Follow the build instructions at https://github.com/nicehash/nheqminer#general-instructions, or run:
mkdir build
cd build
# Turn off `djezo` and `xenoncat`, which are enabled by default, and turn on `tromp` instead.
cmake -DUSE_CUDA_DJEZO=OFF -DUSE_CPU_XENONCAT=OFF -DUSE_CPU_TROMP=ON ..
make -j $(nproc)
Run miner
- Follow the run instructions at: https://github.com/nicehash/nheqminer#run-instructions
# you can use your own testnet address here
# miner and pool payments are disabled, configure your address on your node to get paid
./nheqminer -l 127.0.0.1:1234 -u tmRGc4CD1UyUdbSJmTUzcB6oDqk4qUaHnnh.worker1 -t 1
Notes:
- A typical solution rate is 2-4 Sols/s per core
nheqminersometimes ignores Control-C, if that happens, you can quit it using:killall nheqminer, or- Control-Z then
kill %1
- Running
nheqminerwith a single thread (-t 1) can help avoid this issue