Setting up Snark Stopper

v1.2.4

Description

The script will be useful for those who run the Block Producer and Snark Worker on the same server. Worker uses all your CPU cores 100%, which negatively affects the block producer. The script allows you to stop the Worker Snark 3 minutes before the block is produced and turn it on again after 10 minutes.

This script was created by the user @whataday2day#1271 https://github.com/c29r3/mina-snark-stopper

Preparation

Install JSON

sudo apt install jq -y

Install the git package if it is not installed on the server:

yes | sudo apt install git

Your snark worker should be RUNNING.

Check the config file. There are several options that you can remap.

Unblock the private network:

sudo iptables -D OUTPUT -d 172.16.0.0/12 -j DROP

1. Install without Docker:

You need to run in a new TMUX session

Now you need to add your public key and Worker fee to the stopper config. Open the config with the command:

In the WORKER_PUB_KEY: YOUR_PUBLIC_KEY line, change YOUR_PUBLIC_KEY to $MINA_PUBLIC_KEY In the line WORKER_FEE: 1, replace the commission value, for example, from 1 to 0.025

Done.

1.1 Run

Logs:

2. Install with Docker:

Download the config file:

Now you need to add your public key and Worker commission to the stopper config. Open the config with the command:

In the WORKER_PUB_KEY: YOUR_PUBLIC_KEY line, change YOUR_PUBLIC_KEY to $MINA_PUBLIC_KEY In the line WORKER_FEE: 1, replace the commission value, for example, from 1 to 0.025

Run container:

Logs:

3. Troubleshooting

If the snark-stopper can't connect to port 3085:

Check port availability:

Output should be something like this: Connection to localhost 3085 port [tcp/*] succeeded!

If the connection hangs, then the following options are possible:

  • Access to port 3085 is blocked via ufw\iptables

  • You did not add a docker container flag -p 127.0.0.1:3085:3085

  • Node is not synced yet. For this reason the stopper can't connect

Port responds, but the stopper still can't connect:

it's because of the blocking of private subnets that the docker uses.

Update docker image

After running the command below, go to step 2

4. How to Update

Delete the config file and container and download the new image:

Then we continue from point 1 or 2.

5. Uninstall

Last updated

Was this helpful?