Important: this will work with only zcash 1.0.3
So, you will have to use GitHub - zcash/zcash at v1.0.3 when downloading zcash
I thought I’d share with you all what I have learned in building a privet (or if you want public) zec pool. I pursued this in hope that maybe if can build my own farm, I will have it work on my own private pool, instead of using a public pool.
The core of the pool (and 90% of what I will write) is from eXtremal-ik7 work Zcash Pool Frontend, but I had a lot of help from the zog team (mainly @voxelot) who helped me to get it to work (and I’m waiting for my first block to show my appreciation )
I used ubuntu 16.04 server edition to set it up, and it has 4GB ram right now, and that’s it.
If you think this was useful for you, you can always send a few to my ZEC addr: t1eYeHJKV6Ku9VzadpS8p1LDBeYXqQtRjvw :))))
So, here it goes:
- install ubuntu server and get it updated:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
- install a few dependencies (mainly Zcash’s) **update thanks to @dukemc
sudo apt-get install cmake libssl-dev libsodium-dev libpcre3-dev libleveldb-dev libboost-all-dev libgmp-dev libprotobuf-dev protobuf-compiler libjansson-dev screen build-essential pkg-config libc6-dev m4 g+±multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake
- create a dir for your installation, and lets assume you are in your home folder named , so you should be now in /home/user, and you will create ZEC as your installation folder
mkdir ZEC
cd ZEC
now start with eXtremal-ik7 guide
git clone GitHub - zcash/zcash: Zcash - Internet Money
git clone GitHub - config4star/config4cpp
git clone GitHub - google/flatbuffers: FlatBuffers: Memory Efficient Serialization Library
git clone GitHub - eXtremal-ik7/libp2p: Libraries and utilities for distributed (peer-to-peer) applications -b version/0.3
git clone GitHub - eXtremal-ik7/poolcore: Accounting and statistics handling library for pool
git clone GitHub - eXtremal-ik7/pool_frontend_zcash: ZCash mining pool/solo mining suite
git clone GitHub - eXtremal-ik7/poolrestapi: REST queries handling service for pool
git clone GitHub - eXtremal-ik7/ngxrest: nginx module for light-weight REST queries
git clone GitHub - eXtremal-ik7/pooljs: Web site example for mining pool
wget https://nginx.org/download/nginx-1.11.5.tar.gz
tar -xzf nginx-1.11.5.tar.gz
-
although it doesn’t say so in the steps, but it seems that you need to compile zcash first before going forward, so you that :
-
create zcash.conf file (put your rpcuser name instead of “user”) … thanks @voidwalkerz9
mkdir -p ~/.zcash
echo “addnode=mainnet.z.cash” >~/.zcash/zcash.conf
echo “rpcuser=user” >>~/.zcash/zcash.conf
echo “rpcpassword=head -c 32 /dev/urandom | base64
” >>~/.zcash/zcash.conf
- then build zcash in order to get v 1.0.3 i believe the way is to check out v 1.0.3
cd zcash
git checkout v1.0.3
./zcutil/fetch-params.sh
./zcutil/build.sh -j$(nproc)
- now move back and start configuring the rest of the parts (make sure you replace with your user’s home dir name):
cd …
cd config4cpp
make -j4
cd …
cd flatbuffers
mkdir build
cd build
cmake …
make -j4
sudo make install
cd …/…
cd libp2p
mkdir x86_64-Linux
cd x86_64-Linux
cmake …/src
make -j4
cd …/…
cd poolcore
mkdir x86_64-Linux
cd x86_64-Linux
cmake …/src -DROOT_SOURCE_DIR=/home/user/ZEC -DZCASH_ENABLED=1
make -j4
cd …/…
cd pool_frontend_zcash
mkdir x86_64-Linux
cd x86_64-Linux
cmake …/src -DROOT_SOURCE_DIR=/home/user/ZEC
make -j4
cd …/…
- default pool port is hard coded to 3357, if you want to change that follow @voxelot notes here Set up your own private stratum pool - #30 by voxelot … edit the port and recompile the frontend
cd poolrestapi
mkdir x86_64-Linux
cd x86_64-Linux
cmake …/src -DROOT_SOURCE_DIR=/home/user/ZEC
make -j4
cd …/…
- now you are back at /home/user, lets create the nginx folder and compile it
mkdir nginx
cd ZEC/nginx-1.11.5
./configure --prefix=/home/user/nginx --add-module=/home/user/ZEC/ngxrest
make -j4
make install
cd …
- if you want to add SSL certificate (thanks to @GreaterNinja) instead of the above ./configure line
./configure --prefix=/home/user/nginx --add-module=/home/user/ZEC/ngxrest --with-http_ssl_module --with-http_v2_module
- next you need to patch zcash and recompile it
cd zcash
patch -p0 < /home/user/ZEC/pool_frontend_zcash/pool.diff
- next you need to edit the Makefile in both zcash root folder & in zcash/src folder (i use nano to edit it)
- open each file and search (in nano its ctrl+w) for
LIBZCASH_LIBS =
- and replace it (or append to the end of the line) and save it (ctrl-x then y)
LIBZCASH_LIBS = -lsnark -lgmp -lgmpxx -lboost_system-mt -lcrypto -lsodium -fopenmp -L/home/user/ZEC/poolcore/x86_64-Linux/zcash -lpoolrpczcash -L/home/user/ZEC/libp2p/x86_64-Linux/p2p -lp2p -L/home/user/ZEC/libp2p/x86_64-Linux/asyncio -lasyncio-0.3 -lrt
- then build zcash again
make -j4
- now comes the tricky parts
- you need to move some files into the right locations and to make things easy I put mine in the ./zcash folder </home/user/.zcash>
- so move into that folder and create the following:
cd /home/user/.zcash
nano poolrestapi.cfg
- add the following:
poolrestapi {
listenAddress = “cxxrestapi://127.0.0.1:19999”;
coins = [“zec”];
}
zec {
frontends = [“p2p://127.0.0.1:13301”];
poolAppName = “pool_frontend_zcash”;
}
- next file
nano zcash.cfg
- add the following: (add your own created z & t addr) i added 2 different t-addr for poolFeeAddr & pool_taddr
pool_frontend_zcash {
isMaster = “true”;
poolFee = “1”;
poolFeeAddr = “t1Lbnzr5Jtykyjvm8JRDAnUTxxxxxxxxxxxx”;
walletAddrs = [“p2p://127.0.0.1:12201”];
localAddress = “p2p://127.0.0.1:13301”;
walletAppName = “pool_rpc”;
poolAppName = “pool_frontend_zcash”;
requiredConfirmations = “10”;
defaultMinimalPayout = “0.01”;
dbPath = “/home/user/pool.zcash”;
keepRoundTime = “3”;
keepStatsTime = “2”;
confirmationsCheckInterval = “7”;
payoutInterval = “30”;
balanceCheckInterval = “3”;
statisticCheckInterval = “1”;
zmqclientHost = “192.168.1.120”;
zmqclientListenPort = “6668”;
zmqclientWorkPort = “60200”;
pool_zaddr = “zcG47QGy8g2md2uUg6dtQBKgT75hz4bJ1974rmdxxxxxxxxxxxxxxxxxxxxx”;
pool_taddr = “t1UrNsXAQjrDKpwovMs5xxxxxxxxxxxx”;
}
-
also change the zmqclientHost to your local
-
next file is the nginx config file so move to the nginx folder:
cd /home/user/nginx/conf
nano nginx.conf
- if the file exists, back it up and create a new one:
mv nginx.conf nginx.conf.back
nano nginx.conf
- add the following
worker_processes 4;
events {
worker_connections 10240;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on; tcp_nopush on; tcp_nodelay on;
keepalive_timeout 65; upstream api_backend { server 127.0.0.1:19999; keepalive 32; }
server { listen *:80 reuseport; server_name pool;
location / { root html; index index.html index.htm; expires 5s; }
location /api { cxxrest_pass api_backend; }
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ { expires 3d; # 3 days } }
}
- now copy the actual frontend to its location in nginx
cd /home/user/ZEC/pooljs/coins-for-all/webapp
cp -r /home/user/ZEC/pooljs/coins-for-all/webapp/* /home/user/nginx/html
- edit the coins.json file
cd
nano /home/user/nginx/html/static/f/coins.json
- make it the following:
[
{
“title”: “Z-Cash”,
“code”: “ZEC”,
“desc”: “Z-Cash Private Mining”,
“icon_url”: “static/i/zcash.png”,
“block_url”: “https://explorer.zcha.in/blocks/:hash”,
“transaction_url”: “Transactions - Zchain”,
“power”: {
“type”: “SOLS”,
“name”: “sols/s”,
“rate”: “sols rate”
}
}
]
- rename or copy a few files to match the “ZEC” changes
mv /home/user/nginx/html/static/s/templates/zcash-description.html /home/user/nginx/html/static/s/templates/zec-description.html
mv /home/user/nginx/html/static/s/templates/zcash-mining.html /home/user/nginx/html/static/s/templates/zec-mining.html
mv /home/user/nginx/html/static/s/templates/zcash-servers.html /home/user/nginx/html/static/s/templates/zec-servers.html
- time to build the frontend
cd ZEC/pool_frontend_zcash
cd x86_64-Linux
make clean
cmake …/src -DROOT_SOURCE_DIR=/home/user/ZEC
make -j4
cd …/…
-
and all you have to do is run it
-
first run, you have to get zcash to sync all blocks, so do that (thanks @dukemc ) :
/usr/bin/screen -dmS “zecnode” ./ZEC/zcash/src/zcashd
- once updated and all synced … stop zcashd and re-run everything
screen -r zecnode
ctrl+c
- i made a script to run all parts:
cd
nano zec.pool.sh
- add the following:(there was an error here because of the editor uses ‘#’ as char for bold … sorry )
#!/bin/bash
echo “starting up ZEC Pool”
echo “Starting ZEC node”
/usr/bin/screen -dmS “zecnode” ./ZEC/zcash/src/zcashd -p2pport=12201
echo “Starting Frontend”
/usr/bin/screen -dmS “zecpool” ./ZEC/pool_frontend_zcash/x86_64-Linux/pool_frontend_zcash ~/.zcash/zcash.cfg
echo “Starting Rest API”
/usr/bin/screen -dmS “zecapi” ./ZEC/poolrestapi/x86_64-Linux/poolrestapi ~/.zcash/poolrestapi.cfg
echo “Starting Nginx”
sudo nginx/sbin/nginx
and voila … you should have a running zec stratum pool !!!
so if you find this all insightful and helpful, you can always show that to:
eXtremal: by mining on his pool i was trying to locate his zec addr !! or btc for that matter
@voxelot: also by mining his pool or his newly luck / solo pool
or directly to him t1PGgRgVQ14utsD7mp2dzGdykTDFUCKzPQ5
also they released a fork of eXtremal’s ZogPool Source
or
myself: t1eYeHJKV6Ku9VzadpS8p1LDBeYXqQtRjvw
in all cases, if i get anything off this guide, i will make sure to pass third & third to them :)))