Skip to content

Instantly share code, notes, and snippets.

@duck1123
Created January 24, 2018 12:42
Show Gist options
  • Save duck1123/09533fb8083843e68503fdbb07eacdf9 to your computer and use it in GitHub Desktop.
Save duck1123/09533fb8083843e68503fdbb07eacdf9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
rpcuser=kek
rpcpass=kek
currentblock=$(btcctl --rpcuser=${rpcuser} --rpcpass=${rpcpass} getblockcount)
peerinfo=$(btcctl --rpcuser=${rpcuser} --rpcpass=${rpcpass} getpeerinfo)
node=$(echo ${peerinfo} | jq ".[] | select(.syncnode == true)")
highestblock=$(echo ${node} | jq ".startingheight")
lastrecv=$(echo ${node} | jq ".lastrecv")
currentdate=$(date +%s)
echo "${currentblock} / ${highestblock} offset: $(($currentdate-$lastrecv))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment