PIVX CLI: Easily check how many coins were minted

in #pivx7 years ago (edited)

Execute this once~/.pivx/pivx-cli getbalance > ~/.pivx/balance. Then, add the alias below to ~/.bash_aliases.

alias pivx-minted='pivx-minted'
function pivx-minted() {
  prev=`head -n 1 $HOME/.pivx/balance`;
  curr=`$HOME/.pivx/pivx-cli getbalance`;
  echo $curr > $HOME/.pivx/balance;
  new=$(bc <<< $curr-$prev);
  echo 'current: '$curr;
  echo '   last: '$prev;
  echo "    new: $new";
}

Load the new alias with source ~/.bash_aliases. Usage example:

pivx-minted
current: 102.49170039
   last: 100
    new: 2.49170039

It tells you how many coins were minted since the last time you checked. If you immediately check again the result will be zero until new coins are minted.