0

Is there a library to know the number of bitcoin mined at a given block number ?

3

There is a fixed rate for how many bitcoins are mined each block. The block reward halves every 210,000 blocks, see Controlled Supply.

Here is a short term bitcoin distribution projection from the Bitcoin Wiki:

enter image description here

To calculate the total coins for a given block, try:

coins.py

block = 210000 * 10
totalCoins = 0

subsidy = 50.0
for i in range(1,block):
    if(i%210000 == 0):
        subsidy = subsidy / 2
    totalCoins += subsidy
    #print i, subsidy, totalCoins

print totalCoins

Also, you might find this helpful: Deflation Calculator

  • Thanks for you answer, I'm looking for the (pseudo) code that would generate this array. – franck Aug 10 '18 at 7:02
  • Just added some code and a project that might be helpful – JBaczuk Aug 10 '18 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.