This article picks up where Mining For Peercoin At Home leaves off.
Suppose you need to mine on a blockchain that isn’t offered by any of the pools. For example, we needed to evaluate a Proof-of-Work adjustment on the Peercoin test network but there are no pools for the version of the Peercoin Client we needed to run.
Suppose you need to mine “solo” and the pools aren’t an option to begin with. For example, you’re a Bitcoin miner with AntMiners on your hands that you would prefer to run without the proxy of a pool.
Below I’ll present a flexible system I extended from the work of others in the Peercoin community to fit my specific needs. I hope some of it seems familiar enough to adapt to your own situation. See the “Stratum Server Setup” portion of the diagram in the next section. That’s what we’ll focus on building in this article.
Overall System Diagram
Docker
Install the docker engine as well as the docker-compose-plugin as described on the Official Docker Website: https://docs.docker.com/engine/install/ubuntu/
The commands are copied here:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
ihavenoface docker-compose.yml
The entity “ihavenoface” worked on a bounty to produce a Docker based working model of a stratum server using a local Peercoin client and cgminer software. Their rather tidy contribution can be found at: https://github.com/ihavenoface/nomp-cps-wrapper/blob/master/docker-compose.yml
The docker-compose.yml
is copied here:
x-global-config: &global-config
logging:
driver: json-file
options:
max-size: 50m
restart: always
services:
pool:
build: pool
ports:
- "3448:3448"
depends_on:
peercoind:
condition: service_healthy
redis:
condition: service_started
<<: *global-config
miner:
build: cgminer
privileged: true
depends_on:
pool:
condition: service_started
command:
-o stratum+tcp://pool:3448
-u x
<<: *global-config
peercoind:
build: peercoind
command: >
-printtoconsole
-rpcuser=rpc
-rpcpassword=rpc
-server
-rpcallowip=0.0.0.0/0
-minting=0
-rpcworkqueue=96
volumes:
- peercoind-data:/data
healthcheck:
test: ["CMD", "healthcheck.sh", "1"]
interval: 10s
timeout: 5s
retries: 3
<<: *global-config
redis:
image: redis:alpine
<<: *global-config
volumes:
peercoind-data:
You can run the complete model using docker-compose build
and docker-compose up
.
belovachap docker-compose.yml
I wanted to use my own Peercoin client and cgminer software so I modified the model docker-compose.yml
and config files a bit.
Here are the changes I had to make to nomp-cps-wrapper
in my setup: https://github.com/belovachap/nomp-cps-wrapper/pull/1/files.
You can run the pool service and redis using docker-compose build
and docker-compose up
. But first you should setup and sync your Peercoin Client.
Peercoin Client
In my setup I use an advance build of the Peercoin QT client so I can mine on a blockchain with new rules to be evaluated. You might ultimately run the production Peercoin QT client on the main network but I’d recommend checking your miners on the test network to ensure they’re working before switching over to main operations.
To allow the stratum software to communicate with the Peercoin QT client on the test network I have a peercoin.conf
that looks like:
[test]
server=1
rpcuser=rpc
rpcpassword=rpc
cgminer
sudo ./bin/cgminer -o stratum+tcp://192.168.1.202:3448 -u n2oKXb8FKUHpYBHgM61QAuoBcFq2sGRttz
Notice that the user for the stratum connection is the Peercoin address you set in your config files for the stratum server.
AntMiner
You can use the stratum url: stratum+tcp://192.168.1.202:3448
and the user: n2oKXb8FKUHpYBHgM61QAuoBcFq2sGRttz
(again that should be changed to your Peercoin address).
Final Thoughts
I assumed you knew a lot of technical things and went pretty fast in the explanation of my current Peercoin test network mining setup. Reach out to me on our Discord Sever if you need more help: https://discord.gg/XPxfwtG
I’d be interested to know what mining situations you all have going on out there in the wild