Skip to content

Instantly share code, notes, and snippets.

@narcelio
Created May 3, 2021 17:15
Show Gist options
  • Save narcelio/34ed527bb429e3740e4d77b4ec902708 to your computer and use it in GitHub Desktop.
Save narcelio/34ed527bb429e3740e4d77b4ec902708 to your computer and use it in GitHub Desktop.
#!/bin/bash
# based on https://gist.github.com/mutatrum/264cfa84af5fc3dc0b107bcb3ba10893
BLOCKCHAININFO=`bitcoin-cli getblockchaininfo`
TAPROOT=`echo $BLOCKCHAININFO | jq .softforks.taproot.bip9`
SINCE=`echo $TAPROOT | jq .since`
ELAPSED=`echo $TAPROOT | jq .statistics.elapsed`
for BLOCK in $(seq $SINCE $((SINCE + ELAPSED - 1))); do
HASH=`bitcoin-cli getblockhash $BLOCK`
HEADER=`bitcoin-cli getblockheader $HASH`
VERSION=`echo $HEADER | jq .version`
SIGNAL=$(((VERSION & 3758096388) == 536870916))
case $SIGNAL in
(1) echo -n "$(tput setaf 2)■";;
(0) echo -n "$(tput setaf 1)■";;
esac
done
echo -e "\e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment