Last active
April 4, 2016 03:59
-
-
Save codeck/17862fa4279e28c40a8e0d89adf340b8 to your computer and use it in GitHub Desktop.
sia query util
This file contains 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
siaq_block() { | |
curl -s -A "Sia-Agent" http://localhost:9980/explorer/blocks/$1 | |
} | |
siaq_blkinfo() { | |
date --date=@$(siaq_block $1|jq .block.rawblock.timestamp) | |
siaq_block $latest | jq ".block.transactions[0].height, ($(date -u +%s)-.block.rawblock.timestamp)/60, .block.rawblock.nonce" | |
} | |
siaq_latest() { | |
local latest=$(curl -s -A "Sia-Agent" http://localhost:9980/consensus|jq .height) | |
siaq_blkinfo $latest | |
} | |
siaq() { | |
if [ -z "$1" ] | |
then | |
siaq_block $(curl -s -A "Sia-Agent" http://localhost:9980/consensus|jq .height) | jq . | |
else | |
curl -s -A "Sia-Agent" http://localhost:9980/explorer/hashes/$1|jq . | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment