Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Created March 20, 2020 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meeDamian/bf1e1c48b5d78f0bd0a6797c81363793 to your computer and use it in GitHub Desktop.
Save meeDamian/bf1e1c48b5d78f0bd0a6797c81363793 to your computer and use it in GitHub Desktop.
Get amount of BTC block per sel-reported date.
#!/bin/sh
LAST_DATE="$1"
last="$(bitcoin-cli getblockcount)"
get_last() {
while true; do
DATE="$(date -d "@$(bitcoin-cli getblock "$(bitcoin-cli getblockhash "$last")" | jq '.time')" +"%Y-%m-%d")"
if [ "$DATE" = "$LAST_DATE" ]; then
break
fi
echo "$DATE"
last="$(( last - 1 ))"
done
}
get_last | uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment