2

When the Monero daemon is running, the monerod status command prints the network hashrate .., net hash 287.52 MH/s,... I couldn't find any mentions of network hashrate in the Monero daemon RPC documentation.

Is it possible to somehow get this information through RPC or is executing the monerod status command and parsing its text output the only way?

3

You can call the getinfo RPC, which contains the two values you want: difficulty (the threshold a hash must meet to be a valid block) and target (the number of seconds the monero network attempts to keep between blocks, on average). Divide the former by the latter to get the estimated network hash rate.

Example using curl:

curl -v -X POST http://127.0.0.1:18081/getinfo -d '{}' -H 'Content-Type: application/json'

1

Thanks to this question I realised that one can calculate the estimated network hashrate from the difficulty of the currently mined block, which can be obtained with the getblocktemplate RPC method.

The estimated network hashrate then would be difficulty / 120, where 120 stands for the block finding target of 120 seconds.

I suppose that this is exactly what monerod status does as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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