Created
April 18, 2017 18:10
-
-
Save pooler/6c07cd80245065b0ff1144a282eebc3d to your computer and use it in GitHub Desktop.
Count Litecoin block versions
This file contains hidden or 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
#!/bin/bash | |
first=1185408 | |
last=`litecoin-cli getblockcount` | |
echo Counting blocks from $first to $last... | |
for ((i=$first; i<=$last; i++)); do | |
hash=`litecoin-cli getblockhash $i` | |
ver=`litecoin-cli getblock $hash | grep '"version"' | sed s/[^0-9]//g` | |
(((ver&0x20000001)==0x20000001)) && ((csv++)) | |
(((ver&0x20000002)==0x20000002)) && ((segwit++)) | |
((total++)) | |
done | |
printf "Total blocks:\t%d\n" $total | |
printf "CSV blocks:\t%d\n" $csv | |
printf "Segwit blocks:\t%d\n" $segwit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice!