the_walletMember
Posts: 5 · Reputation: 136
#1Jan 19, 2018, 06:40 PM
I'm working on a mining pool that implements Stratum 2 in Rust (SRI), and I ran into a question about how to calculate a miner's hashrate based on the difficulty of the shares they submit. I did some quick experiments and found this algorithm to be the most precise:
1. I gather the shares from the miner over a timeframe, like 10 minutes.
2. I determine the difficulty for each share (share_diff = max_target / hash).
3. I identify the share that corresponds to the (1 1/e) percentile, which is around the 63rd percentile in terms of difficulty.
4. I take the difficulty from step 3 and multiply it by the total number of shares.
5. I then multiply that result by 1/e (about 0.37).
6. Next, I multiply by 2^32 to get the total number of hashes that had to be iterated through to find those shares.
7. Finally, I divide by the number of seconds (so for 10 minutes, that’s 600 seconds) to arrive at the hashes per second.
If anyone is better at coding (I can't guarantee the accuracy, it was generated by AI from my description).
I’ve got a couple of questions:
1) Is this method something that a lot of people know about? What other options are out there?
2) Why does this even work? I’ve got too much on my plate with this project and can’t get into theoretical math right now, but I’m really curious about why the number "e" is significant here. Is there another way to write this algorithm?