This bash script will generate CSV output for any altcoin/Bitcoin given the path of it's daemon binary. It makes RPC calls via the binary to a running altcoin/Bitcoin server to generate a CSV value to stdout. You can plot it later on in Libreoffice Calc.
#! /bin/bash
# generates comma separated value of blockno. and it's difficulty at custom block intervels and range
#first_argument bin name
#second argument block interval to sample difficulty (optional)
#third argument start from block (optional)
# fourth argument last block till which to analyze
# name of binary (with full path if not in $PATH)
bin=$1
declare -i block_intervel
declare -i start_from
declare -i end_till
block_intervel=$2
start_from=$3
end_till=$4
if [[ $block_intervel = 0 ]]
then
block_intervel=1
fi
if [[ $end_till = 0 ]]
then
end_till=$($bin getblockcount)
fi
echo block,diff
while [[ $start_from -le $end_till ]]
do
echo -n $start_from,
$bin getblock $($bin getblockhash $start_from) | grep difficulty | cut -d : -f2 | sed -e s/,// -e s/\ //
start_from=start_from+block_intervel
done
Copy-paste this in a text file and give it a .sh extension. Read the comment to learn how to use it.
No comments:
Post a Comment