Skip to content

Instantly share code, notes, and snippets.

@strophy
Last active March 24, 2020 06:09
Show Gist options
  • Save strophy/8adafd6a59b0ca46accc12ad85dd0496 to your computer and use it in GitHub Desktop.
Save strophy/8adafd6a59b0ca46accc12ad85dd0496 to your computer and use it in GitHub Desktop.
Calculate timestamp, block, blockhash and coinbase payout amount for all Dash superblocks to date
#!/bin/bash
height=$(dash-cli getblockcount)
for ((block=332320;block<height;block+=16616));do
blockhash=$(dash-cli getblockhash $block)
txhash=$(dash-cli getblock $blockhash|jq -r '.tx[0]')
time=$(dash-cli getblock $blockhash|jq -r '.time')
time=$(TZ=GMT date -d @$time +"%Y%m%d%H%M")
amount=$(dash-cli getrawtransaction $txhash 1|jq '.vout|map(.valueSat)|add')
amount=$(echo "scale=8;$amount / 100000000"|bc)
echo -e "date=$time\tblock=$block\ttxid=$txhash\tsum_dash=$amount"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment