Zcashd Stats and/or Logfile


#1

Is there a way to get detailed stats what zcashd has done in the last day/week/month? E. g. number of coins mined etc.

Is there a logfile and where can I find it?


#2

zcash-cli getinfo
zcash-cli getwalletinfo
zcash-cli getmininginfo

One (or more) of those will give you the current number of blocks, from which you can multiply by the block reward. This doesn't account for the mining slow start.


#3

Thanks, didn't know about the last two. A log with timestamps would still be nice. Do you know if there's something like "hooks" so that I an make zcashd inform other processes whenever a specific event happens?


#4

I've been keeping my own log file. Stores time, time to get block, block number, difficulty once every 10 minutes.
Execute this file log.sh with "bash log.sh" in the zcash directory:

#!/bin/bash
# Logs time, block num, and difficulty once every 10 minutes 
# Execute this file log.sh with "bash log.sh" in the zcash directory 
d=1
until [ $d -gt 100 ]; do # for 100 days
  mydate=$(date +"%D")
  echo "$mydate" | tee -a log.txt # to screen & append file
  c=1
  until [ $c -gt 144 ]; do # 24 hours
     let c=c+1
     mytime=$(date +"%T")
     block=$(src/zcash-cli getblockcount)
     difficulty=$(src/zcash-cli getdifficulty)
     difficulty=${difficulty:0:5} 
     echo "$mytime $block $difficulty" | tee -a log.txt
     sleep 600 # seconds
  done
done

#5

Awesome, thank you very much!


#6

Here's a modifed version to monitor CPU % usage (400% = 4 cores at 100%) and RAM used per core by zcashd every 15 seconds for 1 hour.

Again, assumes you're in zcash directory

Ram per core is wrong if CPU% is not close to a multiple of 100%

Here's the output:
/home/zcash$ bash log.sh
08/07/16
time, block number, difficulty, CPU%, RAM per core
11:28:33 313 1.000 370 596
11:28:48 313 1.000 370 596
11:29:03 313 1.000 370 614
11:29:18 313 1.000 370 100
11:29:33 313 1.000 370 89
11:29:48 313 1.000 370 91
11:30:03 313 1.000 370 82

Code:

#!/bin/bash
# Logs time, block num, difficulty, CPU%, and RAM per core once every 15 seconds for 1 hour 
# Execute this file log.sh with "bash log.sh" in the zcash directory 

memory=$(free|awk '/^Mem:/{print $2}')
memory=$(echo "$memory/1000" | bc) # integer math in bash
mydate=$(date +"%D")
echo "$mydate" | tee -a log.txt
echo "time, block number, difficulty, CPU%, RAM in MB per core" | tee -a log.txt
c=1
until [ $c -gt 240 ]; do # for 1 hour
     let c=c+1
     mytime=$(date +"%T")
     block=$(src/zcash-cli getblockcount)
     difficulty=$(src/zcash-cli getdifficulty)
     difficulty=${difficulty:0:5}
     p=$(ps aux | grep zcashd)
     q=$(echo "$p" | tail -n1) 
     cpu=${q:16:3}
     if [ "$cpu" == "0.0" ]; then
         p=$(echo "$p" | tail -n2)
     fi	 	
    cpu=${p:16:3}
    ram=${p:20:4}
     rampercore=$(echo "($ram*$memory/($cpu+1)" | bc)
     echo "$mytime $block $difficulty $cpu $rampercore" | tee -a log.txt
     sleep 15 # seconds
done

EDIT: corrected, hopefully, to work on most systems