Created
September 22, 2013 03:42
-
-
Save yebyen/6656475 to your computer and use it in GitHub Desktop.
How many blocks til TerraCoin next difficulty rally, my ASIC bros? 1382. (could be off by one)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
dfc=$(terracoind getdifficulty) | |
firstheight=$(terracoind getblockcount) | |
height=$firstheight | |
hsh=$(terracoind getblockhash $height) | |
while [ -n "$dfc" ]; do | |
#echo $hsh | |
newdfc=$(terracoind getblock ${hsh}|grep "$dfc") | |
#echo $newdfc | |
if [ -z "$newdfc" ]; then break; fi | |
hsh=$(terracoind getblock ${hsh}|grep previousblockhash|awk '{print $3}'|sed -e 's/^"//' -e 's/",$//' -e 's/"$//') | |
dfc="$newdfc" | |
done | |
#echo $hsh | |
#echo $dfc | |
last_diff=$(terracoind getblock $hsh|grep height|sed -e 's/^ "height" : //' -e 's/,$//') | |
z=`expr $firstheight - $last_diff` | |
y=`expr 2160 - $z` | |
echo "Countdown: Num blocks til difficulty adjustment: $y blocks" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment