Total Bitcoins in circulation on any given day?

0

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.

BbcDlearning

Posted 2019-06-03T11:43:31.193

Reputation: 1

Question was closed 2019-06-04T11:39:45.733

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 2019-06-03T12:57:04.050

Answers

-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.

Mylo Mylo

Posted 2019-06-03T11:43:31.193

Reputation: 26

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 2019-06-04T06:21:59.517

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 2019-06-10T08:05:25.273

why complicate stuff? Every 210K blocks the block reward is reduced in half. Check the answer which is marked as duplicate to this questionUgam Kamat 2019-06-10T08:27:01.410

Because the question is asking for a daily amount of coins created, different number of blocks mined on different days.Mylo Mylo 2019-06-10T08:30:30.293

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 2019-06-10T08:32:12.017

It's not a dupe question anyway - different number of blocks mined per day.Mylo Mylo 2019-06-10T08:39:48.253