Created
March 20, 2020 15:22
-
-
Save meeDamian/bf1e1c48b5d78f0bd0a6797c81363793 to your computer and use it in GitHub Desktop.
Get amount of BTC block per sel-reported date.
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/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