Graphs the activity of a chia harvester in a linux terminal.

Chia Harvest Graph

Monitor for Chia Harvesting

screenshot

Introduction

The chiaharvestgraph tool will graph Chia Harvesting activity in a linux terminal. Use a 24-bit colour terminal, like xterm or gnome-terminal.

Building

$ git clone https://github.com/stolk/chiaharvestgraph.git

$ cd chiaharvestgraph

$ make

Launching

To use it:

Set the loglevel for Chia to INFO by editting ~/.chia/mainnet/config/config.yaml and make sure you have log_level: INFO set.

Then do:

$ ./chiaharvestgraph ~/.chia/mainnet/log

Leave the tool running, as it keeps checking the log. More pixels will scroll in from the right, plotting top to bottom.

Rationale

Much can go wrong when harvesting Chia. The full node may lose connection to peers, the farmer could not be talking to the full node, the harvester could not be talking to the farmer, or maybe just spotty Internet connection?

That's why it is important to keep an eye on the INFO log. When challenged, the harvester will (on behalf of a farmer) look for proof. It will look for that in the plots that pass the plot-filter. (Every plot has a 1:512 chance of passing, by the way.)

The debug log will contain lines that look like:

0 plots were eligible for farming 3c91c49224... Found 0 proofs. Time: 0.00383 s. Total 39 plots

A properly working harvester should be outputting that line every 10 seconds or so to the log file (provided the log level is INFO.)

This tool will look for those lines in the logs.

Function

A Chia Harvester will get challenged every 10 seconds or so, to look for proof in its plots. This tool will identify those lines, and register the time-stamps for those. If there are not enough of those time-stamps within any given period, the harvester is under-harvesting, or even not harvesting. This is colour coded on the graph.

The graph spans from the right of the terminal (NOW) to the left of the terminal (PAST) and every shaded band represents one hour, and every vertical line, one quarter of an hour.

Depending on the vertical resolution of the terminal, every plot pixel represents a number of seconds, 15 minutes from top to bottom.

On the top of the screen, the average and worst-case response times to eligible harvests are shown. If your harvester takes more than 5 seconds to respond to a challenge, it is designated as too slow.

NOTE: You can see more days of the week by simply resizing your terminal to be wider.

NOTE: First time users should not be alarmed by a lot of grey colour on the left side of the screen. Chia logs are at most 7 x 20MB, and because a full node spams a lot, there are only a few hrs of info in there. On a dedicated harvester, there can be weeks of info, because it logs less. Regardless.... if you leave the tool runnining, it will hold onto the stats, up to a week's worth.

Colours

A yellow colour means that the harvest frequency is nominal for that time span.

An orange colour means that it was under harvested.

A red colour means that there was no harvesting at those time slots.

Grey means that the log did not go far enough back for that time period.

And for the incredibly lucky... a blue pixel represents a found proof! Yeehaw! Better check your wallet!

Keys

Press ESCAPE or Q to exit chiaharvestgraph.

Environment Variables

If you have trouble seeing the standard colourmap, you can select a different one:

$ CMAP_VIRIDIS=1 ./chiaharvestgraph ~/.chia/mainnet/logs
$ CMAP_MAGMA=1 ./chiaharvestgraph ~/.chia/mainnet/logs
$ CMAP_PLASMA=1 ./chiaharvestgraph ~/.chia/mainnet/logs

If you have more than 8 recycled debug.log files, then you can tell the tool to read more of them:

$ NUM_DEBUG_LOGS=15 ./chiaharvestgraph ~/.chia/mainnet/logs

Did you know that...

Donations

Chia Harvest Graph is a tool by Bram Stolk, who is on Twitter as: @BramStolk where he mostly tweets about game development.

If you find this tool useful, donations can go to XCH wallet: xch1zfgqfqfdse3e2x2z9lscm6dx9cvd5j2jjc7pdemxjqp0xp05xzps602592

Known issues

  • Shows garbage on terminals that do not support 24 bit colour.
  • Missing manual page.
  • It looks weird when going through putty.

Copyright

chiaharvestgraph is (c)2021 by Bram Stolk and licensed under the MIT license.

Comments
  • Color for current pixel

    Color for current pixel

    There are some cases where it's not clear where in the graph the cursor is, so having a specific color to indicate that would be nice. You can see an example in the image below: is the current pixel the red one? Or did the harvester fail to harvest and we are in one of the next pixels?

    Screenshot from 2021-05-16 11-02-46

    Even a black or white pixel border would be enough I believe

  • Current log not being parsed

    Current log not being parsed

    Love your project - having trouble reading the "current" logs as they show up gray - screenshot below. Any suggestions on where I went wrong?

    Thanks!

    image

  • Failed make on Ubuntu 21.04

    Failed make on Ubuntu 21.04

    Hi All,

    I receive the following error when trying to make on Ubuntu 21.04 desktop:

    cc -D_POSIX_C_SOURCE=200809L -std=c99 -Wall -Wno-missing-braces -g -c chiaharvestgraph.c -o chiaharvestgraph.o make: cc: No such file or directory make: *** [Makefile:17: chiaharvestgraph.o] Error 127

    Any thoughts?

    Thanks in advance!

  • Add a different set of colors

    Add a different set of colors

    Hey thanks for providing this awesome tool!

    I am red green colorblind and have a really hard time to distinguish orange from red in the plots (also white and yellow seems to be really hard). This is especially hard due to the different shading 1hr columns.

    Can you point in the code to where I can manually change the colors (haven't looked at c code in ages). Or can you add a different set of colors, e.g. red to black?

  • Runtime error: select() failed: Invalid argument

    Runtime error: select() failed: Invalid argument

    When running chiaharvestgraph, I encounter the following output:

    Monitoring directory /home/user/.chia/mainnet/log
    ./chiaharvestgraph: select() failed: Invalid argument
    

    I am also including an strace output for debugging:

    strace ./chiaharvestgraph  ~/.chia/mainnet/log
    execve("./chiaharvestgraph", ["./chiaharvestgraph", "/home/user/.chia/mainnet/log"], 0x7ffe2016c2d8 /* 23 vars */) = 0
    brk(NULL)                               = 0x561aac501000
    arch_prctl(0x3001 /* ARCH_??? */, 0x7ffed1ab8560) = -1 EINVAL (Invalid argument)
    access("/etc/ld.so.preload", R_OK)      = 0
    openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
    newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=0, ...}, AT_EMPTY_PATH) = 0
    close(3)                                = 0
    openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
    newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=157204, ...}, AT_EMPTY_PATH) = 0
    mmap(NULL, 157204, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2faf035000
    close(3)                                = 0
    openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
    read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`|\2\0\0\0\0\0"..., 832) = 832
    pread64(3, "\6\0\0\0\4\0\0\[email protected]\0\0\0\0\0\0\[email protected]\0\0\0\0\0\0\[email protected]\0\0\0\0\0\0\0"..., 784, 64) = 784
    pread64(3, "\4\0\0\[email protected]\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 80, 848) = 80                                                                                   pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0T\246\344\4\347\334\35\347\301CJ\0\267\261\2552"..., 68, 928) = 68                                                                    newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2154488, ...}, AT_EMPTY_PATH) = 0      mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2faf033000                                                                                       pread64(3, "\6\0\0\0\4\0\0\[email protected]\0\0\0\0\0\0\[email protected]\0\0\0\0\0\0\[email protected]\0\0\0\0\0\0\0"..., 784, 64) = 784
    mmap(NULL, 1884632, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2faee66000
    mmap(0x7f2faee8c000, 1359872, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f2faee8c000
    mmap(0x7f2faefd8000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x172000) = 0x7f2faefd8000
    mmap(0x7f2faf024000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f2faf024000
    mmap(0x7f2faf02a000, 33240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2faf02a000
    close(3)                                = 0
    mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2faee64000
    arch_prctl(ARCH_SET_FS, 0x7f2faf0345c0) = 0
    mprotect(0x7f2faf024000, 12288, PROT_READ) = 0
    mprotect(0x561aaa80b000, 4096, PROT_READ) = 0
    mprotect(0x7f2faf08b000, 8192, PROT_READ) = 0
    munmap(0x7f2faf035000, 157204)          = 0
    write(2, "Monitoring directory /home/user/"..., 50Monitoring directory /home/user/.chia/mainnet/log
    ) = 50
    brk(NULL)                               = 0x561aac501000
    brk(0x561aac522000)                     = 0x561aac522000
    openat(AT_FDCWD, "/home/user/.chia/mainnet/log/debug.log.7", O_RDONLY) = 3
    pselect6(4, [3], NULL, NULL, {tv_sec=0, tv_nsec=1000000000}, NULL) = -1 EINVAL (Invalid argument)
    write(2, "./chiaharvestgraph: ", 20./chiaharvestgraph: )    = 20
    write(2, "select() failed", 15select() failed)         = 15
    write(2, ": Invalid argument", 18: Invalid argument)      = 18
    write(2, "\n", 1
    )                       = 1
    exit_group(1)                           = ?
    +++ exited with 1 +++
    

    The system is up-to-date Arch Linux, kernel and compiler info below:

    Linux hostname 5.12.1-zen2-1-zen #1 ZEN SMP PREEMPT Tue, 04 May 2021 04:17:52 +0000 x86_64 GNU/Linux
    
    Using built-in specs.
    COLLECT_GCC=cc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
    Target: x86_64-pc-linux-gnu
    Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=/usr/include/dlang/gdc
    Thread model: posix
    Supported LTO compression algorithms: zlib zstd
    gcc version 10.2.0 (GCC)
    

    Thanks for any help!

  • stack smashing detected

    stack smashing detected

    If you leave the app running long enough it will die with this error message: *** stack smashing detected ***: terminated Segmentation fault

    Maybe a memory leak?

  • Failure to run when fewer than 8 log files exist

    Failure to run when fewer than 8 log files exist

    After some harvester downtime and a reboot from hardware upgrades, I get this on Ubuntu 21:

    [email protected]***:~/chiaharvestgraph$ ./chiaharvestgraph ~/.chia/mainnet/log
    Monitoring directory /home/tiger/.chia/mainnet/log
    Failed to open log file '/home/tiger/.chia/mainnet/log/debug.log.7'
    Failed to open log file '/home/tiger/.chia/mainnet/log/debug.log.6'
    Failed to open log file '/home/tiger/.chia/mainnet/log/debug.log.5'
    Failed to open log file '/home/tiger/.chia/mainnet/log/debug.log.4'
    Failed to open log file '/home/tiger/.chia/mainnet/log/debug.log.3'
    chiaharvestgraph: chiaharvestgraph.c:134: add_entry: Assertion `s>=0' failed.
    Aborted (core dumped)
    

    Sure enough, ls of my Chia log directory reveals only debug.log, debug.log.1, and debug.log.2.

    If I let the system run long enough that all 8 logfiles are generated, then re-run chiaharvestgraph, it works fine, but it seems like it would be ideal for it to operate regardless of the number of available log files.

  • Does not refresh/update logs on remote mount

    Does not refresh/update logs on remote mount

    I am running a remote harvester that is on a low powered NAS but would like to view the graphs from that machine. I have the debug logs pointed to a SMB share on the NAS that my farmer can read. When I run the tool it produces a graph of the existing logs but then never updates. If I close and reopen the graph updates with the new logs but it's not done in real-time.

    Suspect it has something to do with getting changes from disk that doesn't seem to work with a CIFS/SMB mount.

    Glad to provide more information if needed..

  • Add installation instructions

    Add installation instructions

    As it may help a number of new people using your project, I would suggest adding installation instructions, even if i'ts a simple cd chiaharvestgraph make

  • Assertion `s>=0' failed

    Assertion `s>=0' failed

    Been using this with no problem for several weeks until today, no longer loads any graphic and i get this as output:

    [email protected]~/chiaharvestgraph (main) $ ./chiaharvestgraph ~/.chia/mainnet/log Monitoring directory /home/chia/.chia/mainnet/log read 117219 lines from log. read 117272 lines from log. read 118317 lines from log. read 120000 lines from log. read 116329 lines from log. read 119337 lines from log. chiaharvestgraph: chiaharvestgraph.c:133: add_entry: Assertion `s>=0' failed. Aborted (core dumped)

    Any idea whats going on here?

  • Incorrect display in PowerShell 7.0

    Incorrect display in PowerShell 7.0

    I'm running Start-ChiaHarvesterWatcher and get some incorrect picture Pic1 but header info is ok...

    And some trouble after running Get-ChiaHarvesterActivity -Summary Pic2 Runtime is absent and ChallengesPerMinute incorrect

    Any clues why?

  • Error message on startup: UNEXPECTED TIME VALUE

    Error message on startup: UNEXPECTED TIME VALUE

    I see this when starting the chiaharvestgraph on Raspberry Pi OS (Debian). It then appear to run normally, though, so not sure what the impact is.

    tim=1633092685 lasttimehi=1633702500 d=-609815 slot=-6 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 err - UNEXPECTED TIME VALUE. tim=1633092937 lasttimehi=1633702500 d=-609563 slot=-6 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 err - UNEXPECTED TIME VALUE. tim=1633097402 lasttimehi=1633702500 d=-605098 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 err - UNEXPECTED TIME VALUE. tim=1633097446 lasttimehi=1633702500 d=-605054 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 err - UNEXPECTED TIME VALUE. tim=1633097563 lasttimehi=1633702500 d=-604937 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12

  • Update chiaharvestgraph.c - fix for other forks

    Update chiaharvestgraph.c - fix for other forks

    The program does not work with forks with a shorter name than "chia" (like TAD). There is extra space at the end of service name: 2021-09-09T08:06:41.724 harvester tad.harvester.harvester : INFO This PR fixes this bug.

  • Feature suggestion: Add

    Feature suggestion: Add "Error sending partial" colour / box

    Currently there are:

    RED: NO_HARVEST ORA: UNDER-HARVEST YLW: NOMINAL BLU: PROOF CYA: POOLPR

    Would it be possible to add something like COLOR: POOLERRORSENDPARTIAL please? I think sowing errors as such is fundamental and would add great value to a monitor like this one (by the way, I love using it).

    Sample log line:

    2021-08-31T15:00:49.837 farmer chia.farmer.farmer         : ERROR    Error sending partial to https://pool.poolchia.com, 504
    

    Thank you

  • Feature suggestion: option to graph farming times instead of number of farming attempts

    Feature suggestion: option to graph farming times instead of number of farming attempts

    Thanks for this awesome tool!

    The title says it all.

    I have yet to find a satisfying tool for investigating farming times. Graphing it like you do with farming attempts would do the trick.

    I guess this should be a few lines of code, but I don't speak C :-(

    thanks again and keep up the farming

  • ERROR - UNEXPECTED TIME VALUE.

    ERROR - UNEXPECTED TIME VALUE.

    Today I've got this. But graphic looks ok.

    ERROR - UNEXPECTED TIME VALUE. tim=1626168159 lasttimehi=1626776100 d=-607941 slot=-4 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626168204 lasttimehi=1626776100 d=-607896 slot=-4 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626168630 lasttimehi=1626776100 d=-607470 slot=-3 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626170316 lasttimehi=1626776100 d=-605784 slot=-2 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626170531 lasttimehi=1626776100 d=-605569 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626170531 lasttimehi=1626776100 d=-605569 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626170946 lasttimehi=1626776100 d=-605154 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE. tim=1626170946 lasttimehi=1626776100 d=-605154 slot=-1 REPORT THIS MESSAGE TO https://github.com/stolk/chiaharvestgraph/issues/12 ERROR - UNEXPECTED TIME VALUE.

Related tags
A terminal emulator that runs in your terminal. Powered by Turbo Vision.
A terminal emulator that runs in your terminal. Powered by Turbo Vision.

tvterm A terminal emulator that runs in your terminal. Powered by Turbo Vision. tvterm is an experimental terminal emulator widget and application bas

Aug 8, 2022
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

Nov 18, 2021
a simple to use linux terminal

a simple to use linux terminal

Feb 17, 2022
Small header only C++ library for writing multiplatform terminal applications

Terminal Terminal is small header only library for writing terminal applications. It works on Linux, macOS and Windows (in the native cmd.exe console)

Jan 2, 2023
:computer: C++ Functional Terminal User Interface. :heart:
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Jan 3, 2023
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).

L.E. Terminal (let for short) is a little UNIX-inspired terminal for the Numworks Calculator.

Aug 31, 2022
Draw sequence diagram in text from terminal.

sequence-diagram-cli Draw seqence diagram from terminal.

Dec 20, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

Dec 24, 2022
X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

Dec 24, 2022
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Dec 29, 2022
n³ The unorthodox terminal file manager
n³ The unorthodox terminal file manager

n³ The unorthodox terminal file manager

Jan 1, 2023
Collection of human friendly terminal interface for git.
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Dec 30, 2022
Simple benchmark for terminal output

TermBench This is a simple timing utility you can use to see how slow your terminal program is at parsing escape-sequence-coded color output. It can b

Dec 4, 2022
tinytetris - 80x23 terminal tetris
tinytetris - 80x23 terminal tetris

tinytetris - 80x23 terminal tetris

Jan 3, 2023
Contour - A modern C++ Terminal Emulator
 Contour - A modern C++ Terminal Emulator

contour is a modern terminal emulator, for everyday use. It is aiming for power users with a modern feature mindset.

Dec 28, 2022
A C, C++ and Rust library to draw graphics with pixels in the terminal
A C, C++ and Rust library to draw graphics with pixels in the terminal

A library to draw graphics with pixels in the terminal Who needs a GUI when you have a terminal ? Building To generate libpluto.a, run: $ make To ins

Nov 7, 2022
📺🗿 Terminal graphics for the 21st century.
📺🗿 Terminal graphics for the 21st century.

???? Chafa is a command-line utility that converts all kinds of images, including animated GIFs, into sixel or ANSI/Unicode character output that can be displayed in a terminal.

Dec 31, 2022
Simple Unix Terminal Football Manager-like game.

Superleage 2020/2021 It is a "work in progress" simple game based on some mechanics of Football Manager. The game is in a very early stage of Developm

Oct 14, 2021
timg - Terminal Image and Video Viewer
 timg - Terminal Image and Video Viewer

timg - Terminal Image and Video Viewer

Dec 31, 2022