Photo by Zoltan Tukacs on Unsplash
So you've become a Flax farmer and want to maximize the probability of getting a reward? Flaxdog helps with automated monitoring and sends you a mobile notification in case something appears to malfunction.
NOTE: This is a straight-up find & replace job of Martin Mihaylov's ChiaDog project tailored to the Flax blockchain. There is a VERY good chance that I won't do much to improve upon his work, merge changes from ChiaDog, etc, unless I need updates for my own use-cases. Have fun!
Subsystem | Notification (example values) | Priority |
---|---|---|
Harvester | Your harvester appears to be offline! No events for the past 400 seconds. | HIGH |
Harvester | Disconnected HDD? The total plot count decreased from 100 to 40. | HIGH |
Harvester | Experiencing networking issues? Harvester did not participate in any challenge for 120 seconds. It's now working again. | NORMAL |
Harvester | Seeking plots took too long: 21.42 seconds! | NORMAL |
Full Node | Experiencing networking issues? Skipped 42 signage points! | NORMAL |
Harvester | Found 1 proof(s)! | LOW |
Wallet | Cha-ching! Just received 2.0 XFX ☘️ | LOW |
Daily Stats | Hello farmer! 👋 Here's what happened in the last 24 hours: Received ☘️: 2.00 XFX Proofs 🧾: 2 found Search 🔍: - average: 0.46s - over 5s: 2 occasions - over 15s: 1 occasions Plots 🌱: 42, new: 2 Eligible plots 🥇: 0.08 average Skipped SPs |
LOW |
Please refer to Status Reference page for detailed explanations of the notifications.
It parses the debug.log
generated by the flax process and runs various checks to determine the health of your farmer.
Among others, it can detect if your node has lost sync and the farmer is no longer participating in challenges, or if
one of your external HDDs disconnected and your harvester doesn't have access to the full amount of plots you have.
It only requires read-access to your debug.log
file and internet connection to send out notifications. It's highly
recommended that you run flaxdog
in a sandboxed environment - this is described in the advanced section below.
Furthermore, following best security practices, you should keep your wallet separate.
You may use one (or more) of the following integrations to receive notifications from flaxdog
.
Integration | Advantages | Cost |
---|---|---|
Pushover | High priority notifications that can override your phone's silent mode. | $5 one time purchase after 30 day trial. |
You probably already have an email. No additional apps. | Free | |
Slack | Quick & easy setup. | Free |
Discord | Quick & easy setup. | Free |
Telegram | Quick & easy setup. | Free |
Shell script (beta) | Execute anything in your own script. | Free |
MQTT | Well-suited for Home Automation. | Free |
For detailed guide on how to test and configure, please refer to INTEGRATIONS.md.
- Linux, MacOS & Windows
- Python 3.7+
- Git
- Enabled
INFO
logs on your flax farmer
The instructions below are specific to Linux and MacOS, for installing flaxdog
on Windows, please refer to this
separate README section.
First configure the log level to INFO
. This ensures that all logs necessary for flaxdog to operate are available
under ~/.flax/mainnet/log/debug.log
.
flax configure -log-level=INFO
Then restart your farmer to apply the changes:
flax start --restart farmer
Check that logs are coming in:
cat ~/.flax/mainnet/log/debug.log
For updating from previous version, see section below.
- Clone the repository
git clone https://github.com/langhorst/flaxdog.git
cd flaxdog
- Run the install script.
./install.sh
- Copy the example config file
cp config-example.yaml config.yaml
- Open up
config.yaml
in your editor and configure it to your preferences.
Skip this if you followed the above section.
cd flaxdog
git fetch
git checkout main
git pull
./install.sh
Important: Automated migration of config is not supported. Please check that your
config.yaml
has all new fields introduced inconfig-example.yaml
and add anything missing. If correctly migrated, you shouldn't get any ERROR logs.
-
Open
config.yaml
and configurefile_log_consumer
:- You need to enable the file log consumer to read local flax log files
- Double-check that the path to your flax logs is correct
-
Start the watchdog
./start.sh
- Verify that your plots are detected. Within a few seconds you should see INFO log:
Detected new plots. Farming with 42 plots.
If you see the above log message, you can be certain that flaxdog
is running correctly. It'll remain silent until the
next scheduled daily notification or until any issues are detected.
You can repeat the above process for every machine where you are running a harvester. Use
the notification_title_prefix
in config.yaml
to give every machine a unique notification prefix so that you can easily distinguish them.
If you don't want to setup flaxdog
on each machine separately, you can also monitor multiple remote harvesters and run
flaxdog on a single machine. Please refer to the wiki page
on Remote Monitoring Multiple Harvesters.
You can enable more verbose logging from config.yaml
by changing INFO
to DEBUG
. You should see logs for every
keep-alive event from the harvester.
There are failure-cases in which flaxdog
is helpless. For example, your computer completely freezes or shuts down.
Perhaps your entire home network goes down.
flaxdog
won't be able to send you a notification.
There's a way however: in the config under the section of keep_alive_monitor
, you can enable
pinging to a remote service that will act as a watchdog of flaxdog
. A second level of redundancy, if you wish!
You may chose your favourite service for that, I've tested it with HealthChecks.io. It's free to signup and create an endpoint that expects to receive pings every 10 minutes. If it does not, it will notify you. It has integrations with Pushover, Email, Slack, Discord and more.
. ./venv/bin/activate
nohup python3 -u main.py --config config.yaml > output.log &
To stop flaxdog, you can find the Process ID (PID) via ps aux | grep main.py
and then softly interrupt the process
with kill -SIGINT <pid_here>
.
We're in the early stages of exploring the best way to provide easy to setup sandboxed environment where the flaxdog
process is completely isolated from potentially accessing your private keys. Contributions in that direction are very
welcome. Meanwhile you can check out @ajacobson repository
for chiadog-docker.
Alternatively, as suggested here you can run flaxdog
from a unix user
with limited permissions.
Contributions are always welcome! Please refer to CONTRIBUTING documentation.