0

This question already has an answer here:

I'm creating a spreadsheet to track total bitcoins in circulation from day 1. This would be to add up each Bitcoin per day created and add to an accumulating total. For example, if we picked any day we could then see what the total amount of Bitcoins created was. If we picked the 1st January 2014 we could say the total Bitcoins mined equals X. If we pick today (3rd June 2019) we could say the total Bitcoins mined equals X. By definition, that would also mean we could calculate how many Bitcoins are left to be mined on any given day. Could some one assist me to find the way to create this spreadsheet? Thanks.

marked as duplicate by RedGrittyBrick, JBaczuk, Ugam Kamat, chytrik, Community Jun 4 at 11:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • AFAIK the Bitcoin rules are tuned to produce a new block every 10 mins. The mining reward per block is a fixed amount which is halved at the end of each four-year period (210,000 blocks) . So the amount of BTC mined so far per day is a very simple function of time of day. -- Is that what you are asking about? – RedGrittyBrick Jun 3 at 12:57
-1

From command line the piping to date command needs a 2nd eye. Bit late for me here, but it's a unix timestamp conversion to whatever format you want.

You can find out by:

  • getting the hash of each block at height X using the RPC or bitcoin-cli getblockhash X
  • using the blockhash to get information about that block using RPC or bitcoin-cli getblock <HASH>
  • get the timestamp of that block
  • convert timestamp into the date format you want
  • get the first transaction of the block (coinbase transaction) for the amount of newly mined coins using RPC or bitcoin-cli gettransaction <TX>

And run it through every block in a loop.

e.g.

bitcoin-cli getblockhash 1
00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048

 bitcoin-cli getblock 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 | jq '.time' | date 
Mon Jun  3 18:54:45 UTC 2019

bitcoin-cli getrawtransaction `bitcoin-cli getblock 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 | jq -r '.tx[0]'` true | jq '.vout[0].value'
50

Here is block #1 on a btc explorer showing the same data, 50 new coins.

You can loop like that on command line but probably better to do with RPC and a real programming language.

  • This is not entirely correct. Coinbase transaction also pays out the fees of all the transactions in the block apart from the newly minted coins. So, in essence we will be double counting the number of coins generated if we follow your analogy. – Ugam Kamat Jun 4 at 6:21
  • I guess you're right. The script will need to have some knowledge of block numbers of the halving intervals and know what the block reward is at a given height and ignore amounts greater than the block reward. – Mylo Mylo Jun 10 at 8:05
  • why complicate stuff? Every 210K blocks the block reward is reduced in half. Check the answer which is marked as duplicate to this question – Ugam Kamat Jun 10 at 8:27
  • Because the question is asking for a daily amount of coins created, different number of blocks mined on different days. – Mylo Mylo Jun 10 at 8:30
  • yes. Just multiply the number of blocks mined in the day * block reward (you know the block rewards if you know the block number). You don't have to go in the coinbase transaction. – Ugam Kamat Jun 10 at 8:32

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