Visualizing Bitcoin Blockchain Block Hashes
Brian Smith's Linux/AIX Videos
This video shows a visualization of the hashes of the blocks on the Bitcoin blockchain which shows the difficulty increasing over time.
Scripts used to produce output:
Script 1 to export data from bitcoin-cli:
for block in $(seq 1 $(bitcoin-cli getblockcount)); do
hash="bitcoin-cli getblockhash $block
";
diff=bitcoin-cli getblock $hash | grep "^ \"difficulty\" :" | awk '{print $3}' | tr -d ','
date=bitcoin-cli getblock $hash | grep "^ \"time\" :" | awk '{print $3}' | tr -d ','
date2=date -d @$date
printf "%-65s %-8s %-22s %-15s\n" $hash $block $diff "$date2"
done
Script 2 to produce output file:
cat hashes | while read line; do
hash=echo $line | awk '{print $1}' | tr [a-z] [A-Z]
height=echo $line | awk '{print $2}'
date=echo $line | awk '{print $5 " " $6 " " $9}'
export BC_LINE_LENGTH=300
bin=echo "ibase=16;obase=2;$hash" | bc
length=${#bin}
zeros=expr 256 - $length
for zero in seq 1 $zeros
; do
if [ "$zero" -eq 32 ] ; then
echo -n -e '\E[37;41m'"\033[1m0\033[0m"
else
echo -n -e '\E[33;44m'"\033[1m0\033[0m"
fi
done
printf "%-20s %-7s %-12s\n" "$bin" "$height" "$date"
done
...
https://www.youtube.com/watch?v=xWyJ0gO7bh8
91380916 Bytes