girinovey

Untitled

Dec 30th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.28 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. DCRCTL=dcrctl
  4. POOLTKSIZE=540
  5. SOLOTKSIZE=296
  6. POOLFEEPERCENT=0.05
  7.  
  8. HEIGHT=$( $DCRCTL getblockcount )
  9. WINDOWS=$(($HEIGHT/144+1))
  10. #BLOCKS=$(($HEIGHT+1))
  11. BLOCKS=0
  12.  
  13. FEESTATS=$( $DCRCTL ticketfeeinfo $BLOCKS $WINDOWS )
  14. #FEESTATS=`cat data.json`
  15.  
  16. FEETYPE=mean
  17.  
  18. FEELIST=$(echo $FEESTATS | jq -r '.feeinfowindows[] | (.startheight|tostring) +":" + (.'$FEETYPE'|tostring)')
  19.  
  20. echo "DATE TIME;BLOCK;PRICE;SOLOTKFEE;POOLTKFEE;SUBSIDYMIN;SUBSIDYAVG;SUBSIDYMAX"
  21. for PAIR in $FEELIST; do
  22.   BLOCK=$( echo $PAIR | awk -F: '{print $1}' )
  23.   FEE=$( echo $PAIR | awk -F: '{print $2}' )
  24.   SUBSIDYMIN=$( dcrctl getblocksubsidy $(($BLOCK+256)) 1 | jq '.pos / 100000000' )
  25.   SUBSIDYMAX=$( dcrctl getblocksubsidy $(($BLOCK+256+40960)) 1 | jq '.pos / 100000000' )
  26.   SUBSIDYAVG=$( dcrctl getblocksubsidy $(($BLOCK+256+288*28)) 1 | jq '.pos / 100000000' )
  27.   HASH=$( dcrctl getblockhash $BLOCK )
  28.   BLOCKDATA=$( dcrctl getblock $HASH )
  29.   TIME=$( echo $BLOCKDATA | jq -r '(.time|strftime("%Y-%m-%d %H:%M:%S"))' )
  30.   PRICE=$( echo $BLOCKDATA | jq -r '.sbits' )
  31.   SOLOTKFEE=$( echo "[ $FEE , $SOLOTKSIZE ]" | jq '.[0] * .[1] / 1000' )
  32.   POOLTKFEE=$( echo "[ $FEE , $POOLTKSIZE ]" | jq '.[0] * .[1] / 1000' )
  33.   echo "$TIME;$BLOCK;$PRICE;$SOLOTKFEE;$POOLTKFEE;$SUBSIDYMIN;$SUBSIDYAVG;$SUBSIDYMAX"
  34. done
Advertisement
Add Comment
Please, Sign In to add comment