# Total Bitcoins in circulation on any given day? [duplicate]

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.

• 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? Jun 3 '19 at 12:57

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. Jun 4 '19 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. Jun 10 '19 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 Jun 10 '19 at 8:27
• Because the question is asking for a daily amount of coins created, different number of blocks mined on different days. Jun 10 '19 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. Jun 10 '19 at 8:32