URL that shows the total supply of coins in real time

+4 votes

How do we get this information? Is that possible?

asked Dec 17, 2016 by chunhui323

2 Answers

0 votes
 
Best answer
If you mean the total quantity issued of a particular asset, the listassets API can provide this, and you can pass a specific asset name/ref/issuance txid to get information about that asset only. Or are you referring to the native currency?
answered Dec 18, 2016 by MultiChain
selected Dec 21, 2016 by chunhui323
Yeah, is that possible to retrieve the total quantity of native currency too? Thank you for taking time answering question.
I'm checking this and will get back to you.
I'm afraid the answer is currently no – you would have to calculate that yourself from the block height and the native currency parameters of the chain.
Thank you. You answered my question
Could you please let me know how to calculate that total supply of the native currency with the block height and other parameters of the chain? Greatly appreciated.
First calculate the number of full eras as follows:

eras=floor((current block number)/reward-halving-interval)

The total amount of coins mined so far is given by summing:

* Blocks of any full eras: reward-halving-interval * initial-block-reward * (1.0-pow(0.5, eras))

* Blocks so far of the current era: ((current block number) - (eras * reward-halving-interval) + 1) * initial-block-reward * pow(0.5, eras)

* Adjust for first block reward: first-block-reward - initial-block-reward, but no adjustment required if first-block-reward=-1

Be sure to divide the whole think by native-currency-multiple to get display units rather than raw units as represented in the blockchain. And ensure all calculations are performed in floating point arithmetic.

Various variable names here are taken from the blockchain parameters: https://www.multichain.com/developers/blockchain-parameters/

Please let us know if this works for you. We haven't tested this, just done the maths.
+1 vote

Version 1.0.5 of MultiChain has just been released, adding a chainrewards field to the getblockchaininfo API to provide this information.

answered Jun 7, 2018 by MultiChain
...