BANANOs and Stonks

How to run a BANANO BoomPoW proof of work client on Kubernetes

By friend | good content | 23 Jan 2021


d4cb29bc90b9fab5048c1929a3fc22542e16959a2af1f9cfd15185c08e0f3d2d.png

What is BoomPoW?

Although BANANO, like NANO, is fast and fee-less it still requires some proof of work to prevent the network from being spammed. Proof of Work can be costly on low power devices so on the BANANO and NANO networks it can be delegated to volunteers who run distributed PoW (dPow) clients!

If you're curious to learn more, the NANO dPow README has a great description and diagram outlining the process.

We're not talking Bitcoin or Ethereum level Proof of Work here, either. You don't need any custom ASICS or expensive GPUs to contribute. Proof of Work for BANANO and NANO can be performed by adequately by your average CPU 

Why run BoomPoW?

There's several reasons one would want to contribute.

1. You want to contribute to the decentralization and integrity of the BANANO block chain. By running a BoomPoW client you help ensure that people can continue to exchange BANANO even if other clients go offline.

2. You want to earn some BANANO yourself. Although it doesn't quite earn as much as mining BANANO on Kubernetes, you can earn some BANANO as a reward for running the client. You'll only be rewarded for work it completes, but it doesn't consume much CPU at all when it's not working, so there's little downside to running it.

How to run BoomPoW on Kubernetes

The client READMEs on Github describe what you need to install in order to run the client locally. However, if you're like me and you have a spare Kubernetes cluster at your disposal, you'll likely just want a pre-built Docker image that you can continuously run on the cluster. Well don't worry, I've got you. Check out the following repo:

BoomPow Client on Kubernetes

It contains a Dockerfile, a Kubernetes deployment, and a prebuilt Docker image for BoomPow. Let's take a look at these.

BoomPow Dockerfile

FROM ubuntu

WORKDIR /usr/src/boompow
RUN \
      apt update && \
      apt -y install --fix-missing \
        build-essential \
        python3 \
        python3-pip \
        ocl-icd-libopencl1 \
        unzip \
        wget \
      && \
      apt clean

RUN wget -nc -O bpow-client.zip https://github.com/BananoCoin/boompow/releases/download/v2.0.3/bpow-client-v203.zip
RUN unzip bpow-client.zip && rm bpow-client.zip

WORKDIR /usr/src/boompow/bpow-client
RUN pip3 install -r requirements.txt

RUN useradd nonroot --uid 2077
RUN chown -R 2077:2077 /usr/src/boompow/bpow-client
USER 2077

This installs all of the packages for Linux that the client README calls out, plus an added bonus. It sets up the image to run as a nonroot user so that you don't have to worry as much about BoomPoW doing anything malicious and harming the rest of your cluster! Now, how do we run this thing?

BoomPow Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: bpow-client
  labels:
    app: bpow-client
spec:
  replicas: 1
  selector:
    matchLabels:
      app: bpow-client
  template:
    metadata:
      labels:
        app: bpow-client
    spec:
      securityContext:
        runAsNonRoot: true
      containers:
      - name: boompow-work-server
        image: registry.gitlab.com/freind/boompow-client-kubernetes:latest
        command: ["./bin/linux/nano-work-server"]
        args: ["-c", "1", "-l", "127.0.0.1:7000"]
        securityContext:
          allowPrivilegeEscalation: false
        resources:
          requests:
            memory: "256m"
            cpu: "50m"
          limits:
            memory: "1G"
            cpu: 1
        ports:
        - containerPort: 7000
      - name: bpow-client
        image: registry.gitlab.com/freind/boompow-client-kubernetes:latest
        command: ["python3"]
        args: ["bpow_client.py", "--payout", "$(BANANO_ADDRESS)", "--work", "any"]
        env:
        - name: BANANO_ADDRESS
          value: "ban_1uogt58kenytodxjt7h9h59omn5zd5dxb78t9hhssn1j3zdyt3h9ezjo37sf" # replace with your BANANO payout address
        securityContext:
          allowPrivilegeEscalation: false
        resources:
          requests:
            memory: "256m"
            cpu: "50m"
          limits:
            memory: "1G"
            cpu: 1

This Kubernetes Deployment will create a Pod that runs two containers. One for the BoomPoW Work Server and one for the Python client. It also has some handy resource limits to prevent BoomPoW from using an inordinate amount of resources on the cluster and directives to prevent privilege escalation for some added security.

Just change the BANANO_ADDRESS to your own to ensure you get rewarded and `kubectl apply` the thing and you're good to go. Wow!

Once it's all running you'll see a lot of log output like this:

17:12:44 INFO: PRIORITY QUEUED ondemand/0992C52763
17:12:44 INFO: PRIORITY REMOVED ondemand/0992C52763
17:12:45 INFO: QUEUED ondemand/DBE153AC96
17:12:45 INFO: REMOVED ondemand/DBE153AC96
17:12:47 INFO: QUEUED ondemand/D1152203CD
17:12:47 INFO: WORK ondemand/D1152203CD...
17:12:47 INFO: CANCEL ondemand/D1152203CD...
17:12:49 INFO: QUEUED ondemand/71499F418A
17:12:50 INFO: REMOVED ondemand/71499F418A
17:12:52 INFO: PRIORITY QUEUED ondemand/A70579093D
17:12:52 INFO: PRIORITY REMOVED ondemand/A70579093D

Don't worry about cancelled or removed work. That just means someone else completed the work before you so there's no reason for your computer to waste any more cycles on it!

 

I'm running one of these bad boys 24/7 now, can't wait to see what I'll earn!! 🤑


 

Cover Photo by MayoFi on Unsplash

How do you rate this article?

6



good content
good content

real good content for real good readers

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.