3

I'm trying to externally calculate the hashrate of a given miner based only on an arbitrarily defined target that I assign, then calculate probability it will be found. Once this probability is calculated I want to estimate how long it should (on average) take to find a block.

Is this a feasible thing to do?

What is the math required to determine hashrate?

Example: Given that target is 1, and the miner submitted the block in 10 minutes.

5

As I understand your question it has two parts. One is how to calculate an approximation of someone's hash rate externally, like from a server or proxy that can see their mining results but not their actual hashing process or hash rate. The other part is how to calculate the probability that a block would be found after a given amount of work, or a given amount of time and hash rate.

I will write the formulas as javascript code, with X to the power of Y written as Math.pow(X, Y). You could run them in your browser by typing them into the address bar like for example javascript:alert((Math.pow(2, 32) * 27939) / 600).

Approximation of hash rate:

With an arbitrary target, count one share at difficulty X the same as X shares at difficulty 1. That's how pools deal with variable difficulty.

hashrate = (Math.pow(2, 32) * shares) / seconds-elapsed

An average of one share (at difficulty 1) is found for every Math.pow(2,32) hashes. This is only an average and that is why the hash rates displayed at pool web sites are only approximations.

Block solution probability:

The probability of one or more blocks being generated from a given number of shares (proofs of work):

prob = 1 - Math.pow(1 - 1.0 / difficulty, shares)

That's from 0 to 1. Multiply by 100 if you want a percentage.

Let's say the difficulty is 4367876 and someone has been mining with a hashrate of 200 Ghps for 10 minutes. That's 200 * Math.pow(10, 9) hashes per second for 600 seconds, with an average of one share (at difficulty 1) found for every Math.pow(2,32) hashes. This gives us the following:

shares = (200 * Math.pow(10, 9) * 600) / Math.pow(2,32) = 27939 shares

prob = 1 - Math.pow(1 - 1.0 / difficulty, shares) = 1 - Math.pow(1 - 1.0 / 4367876, 27939) = 0.00637...

In other words the chance that someone would make one or more blocks with the given hash rate and difficulty within 10 minutes is about 0.64%

Note: if you see how many shares (proofs of work) they send in, of course you don't first calculate their hash rate only to calculate it back into a number of shares. Just plug it into the formula.

  • I've read this several times over, but I don't understand where each instance of 9, or 32 appears. Would you elaborate on the selection of those numbers? – random65537 Mar 24 '13 at 19:21
  • Math.pow(10,9) is 1000000000. That's 9 zeroes for the giga in Ghps. I thought it would be more readable to write 200 Ghps this way instead of 200000000000. – Dr.Haribo Mar 25 '13 at 11:05
  • Math.pow(2,32) hashes will on average yield 1 proof-of-work at difficulty 1. It's actually difficulty 0.999-something, but it's close enough. At this diff you want the first 32 bits in the hash to be zero. This is one outcome out of a possible 2^32 values from those 32 bits. So a hash has a 1 in 2^32 chance. – Dr.Haribo Mar 25 '13 at 11:10
  • Where did the 32 come from? I thought bitcoin uses sha256? isn't it supposed to be pow(2, 256)? – Timo Huovinen Dec 16 '13 at 21:32
  • 2 to the power of 32 is the average number of hashes to find a difficulty 1 proof of work. There's 2 to the power of 32 possible permutations of 1 and 0 in the 32 first bits of the sha-256 hash. All need to be zero. – Dr.Haribo Dec 17 '13 at 14:33
1

You do not need to specify the difficulty to determine the hashrate: It is independent from difficulty:

Maybe you mean the probability to find a Block?

There are a number of profitability calculators out there, try this one for example: http://www.bitcoinx.com/profit/

  • Thank you, yes, for example I'd like to find the probability of finding a block within 10 minutes at 100 GH/s and a relatively easy target. – random65537 Mar 1 '13 at 12:51

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.