Post
Topic
Board Development & Technical Discussion
Merits 2 from 1 user
Re: Is there a way to retrieve bitcoin statistics, such as Difficulty and Hashrate
by
ranochigo
on 11/09/2021, 15:20:40 UTC
⭐ Merited by bitmover (2)
I just want to get the same info I can retrieve from the Bitcoin network by typing the command within the Bitcoin Core CLI without using it.
It is actually quite easy to do so. The difficulty and the target are both stored within the block headers, it will be sufficient to just call the block headers at each difficulty epoch to get the difficulty for that period. It is pointless to get the hashrate, because any estimation based on timestamps within a short period of time is often quite inaccurate. You can determine it based on the block intervals or use the difficulty as a metric.