Skip to content

Instantly share code, notes, and snippets.

@pooler
Created April 18, 2017 18:10
Show Gist options
  • Save pooler/6c07cd80245065b0ff1144a282eebc3d to your computer and use it in GitHub Desktop.
Save pooler/6c07cd80245065b0ff1144a282eebc3d to your computer and use it in GitHub Desktop.
Count Litecoin block versions
#!/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
@TJKoury
Copy link

TJKoury commented Apr 20, 2017

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment