Bitcoin Forum
April 26, 2024, 10:25:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How can i calculate the average blocks per a day by just data from rpc commands  (Read 182 times)
mrmetech (OP)
Member
**
Offline Offline

Activity: 113
Merit: 10


View Profile WWW
August 25, 2018, 03:32:28 AM
 #1

How can i calculate the average blocks per a day by just data from rpc commands. I would also like to calculate the average time per a block this way as well any idea ?

Am having trouble finding fast ways to do this or a way at all. If you want to do this there must be a good way. And for coins that aren't just btc

1714127103
Hero Member
*
Offline Offline

Posts: 1714127103

View Profile Personal Message (Offline)

Ignore
1714127103
Reply with quote  #2

1714127103
Report to moderator
1714127103
Hero Member
*
Offline Offline

Posts: 1714127103

View Profile Personal Message (Offline)

Ignore
1714127103
Reply with quote  #2

1714127103
Report to moderator
1714127103
Hero Member
*
Offline Offline

Posts: 1714127103

View Profile Personal Message (Offline)

Ignore
1714127103
Reply with quote  #2

1714127103
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
TheArchaeologist
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 26, 2018, 08:31:07 AM
 #2

How can i calculate the average blocks per a day by just data from rpc commands. I would also like to calculate the average time per a block this way as well any idea ?
You can accomplish this if you save some data as response from the "getblock" rpc call. Afaik there is no direct way of doing this by only using one of more rpc calls.

Code:
bitcoin-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"

Gives as result:
Result (for verbosity = 1):
{
  "hash" : "hash",     (string) the block hash (same as provided)
  ],
  "time" : ttt,          (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)
   .....
}
For each block in a 24-hour time frame you store the block along with it's timestamp. When you have those two it shouldn't be hard to calculate the average blocks per day when you do this over a longer period of time. Based on the interval between stored block times it should also be easy to calculate the average time per block.

But, just a reminder: On average Bitcoin aims for a block time of 10 minutes. So even without calculation the numbers you are looking for are:
  • Average blocks per day: 6*24= 144
  • Average block time: 10 minutes

If you want to see the real numbers for a period of time you can obviously calculate them as I explained in the first part. Otherwise just stick with the already known and aimed for averages.

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
August 29, 2018, 10:53:20 AM
 #3

How can i calculate the average blocks per a day by just data from rpc commands. I would also like to calculate the average time per a block this way as well any idea ?

The average amount of blocks per day and the average time per block are calculated using the same 2 variables: Time and Number of blocks.

You can accomplish this by comparing the height each 24 hours.

You can use this command to get the current height:

Code:
getblockcount

The first time measuring, you just write down the number.
24 hours later you can again execute the command and subtract this number from the old one. What you get are the number of blocks in the last 24 hours.

This information is enough to calculate all data you want.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!