Calculating circulating supply for coins with premine

in Talleo4 years ago

A lot of statistics sites require circulating supply for coins to calculate other metrics... Circulating supply is not same as total number of mined coins when the coin has premine.

To calculate circulating supply, one must subtract total balance of premine wallet from total number of mined coins.

This can be done using CGI script that fetch last block header from node daemon, or if node daemon has own JSON method for getting total number of mined coins, using that JSON method.

Getting balance of premine wallet requires running wallet daemon on the same server with premine wallet opened.

Using simple shell script, calculating circulating supply requires curl, jq and expr. Output from curl is passed to jq command to parse the JSON output. expr command does the final subtraction using result from node daemon, and unlocked and locked balances from wallet daemon.