Last active
May 9, 2018 13:11
-
-
Save nicovs/39116961e8d97f13ec655fc3646437b0 to your computer and use it in GitHub Desktop.
Newyorkcoin electrumx checkpoints file
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/zsh | |
EXPLORERAPI=https://explorer.nycoin.community/api | |
BLOCKHIGHT=$(curl -s "$EXPLORERAPI/getblockcount") | |
calc(){ awk "BEGIN{ print $* }" ;} | |
counter=0 | |
echo "[" | |
for i in {2015..$BLOCKHIGHT..2016} | |
do | |
HASH=$(curl -s "$EXPLORERAPI/getblockhash?index=$i") | |
sleep .5 | |
DATA=$(curl -s "$EXPLORERAPI/getblock?hash=$HASH") | |
BITS=$(echo $DATA | jq -r ' .bits') | |
TIME=$(echo $DATA | jq -r ' .time') | |
EXP="$((16#${BITS:0:2}))" | |
C=$(echo $BITS | sed 's/^..//') | |
COEF=$((16#${C})) | |
echo " [" | |
echo " \"$HASH\"," | |
echo " $(calc "($COEF*(2^(8*($EXP-3))))")," | |
echo " $TIME" | |
echo " ]," | |
sleep .5 | |
done | |
echo "]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment