<p>The hash rate is literally how many distinct block header hashes you can try per second. Nothing more, nothing less. Note that I say "try" and not "compute". Determining whether a particular block header is interesting is somewhat faster than fully computing the hash:</p>

<ul>
<li>You can drop the last few rounds of the hash implementation, and only compute the first 32 bits of the output (and if that those 32 bits are 0, recompute the hash in less optimized software to determine if it's a fully valid block).</li>
<li>You can exploit the fact that successive attempted block headers only differ in a few bytes, reusing part of the computation.</li>
<li>You can precompute things to find combinations of multiple block header attempts that share more parts of the evaluation than random ones (this is what AsicBoost is based on).</li>
</ul>

<p>So determining the exact hashrate of certain hardware is a nontrivial engineering effort because of the above, and is complicated by things like architecture specific optimization, and things like exploiting special hardware instructions.</p>

<p>Such engineering has obviously not been done for iPhone, as it's a nonsensical target for computation. My back of the envelope computation suggests it could probably do a few MH/s, but as that still means ~50 million years to find a block, not much effort will be spent on this.</p>

CC BY-SA 4.0
2019-02-27T00:02:54.077Z
2019-02-27T00:09:21.763Z
2019-02-27T00:09:21.763Z
Pieter Wuille
<p>I recently made a post on stack, <a href="https://stackoverflow.com/q/54844794/5655414">Calculate hash rate in IOS</a>, in hopes of deciphering how the hash rate is calculated when benchmarking performance. The reason I wanted to do this is to compare against the results that are presented in <a href="https://www.coinstaker.com/iphone-mine-cryptocurrencies/" rel="nofollow noreferrer">Is it Possible to Mine Cryptocurrencies with an iPhone?</a> After days of hunting around on the internet, I've come to a conclusion that calculating the hash rate is not as straight forward as it seems.</p>
<p><strong>My Thoughts</strong></p>
<p>I was under the impression, especially after reading <a href="https://en.bitcoinwiki.org/wiki/Hashrate#How_can_I_calculate_how_many_hashes_I_generate_per_second.3F" rel="nofollow noreferrer">How can I calculate how many hashes I generate per second?</a>, <a href="https://coinsutra.com/hash-rate-or-hash-power/" rel="nofollow noreferrer">Explaining Hash Rate Or Hash Power In Cryptocurrencies</a> and <a href="https://bitcoin.stackexchange.com/a/28310/91571">How is hash rate of mining hardware calculated</a>, that calculating the hash rate is done as follows:</p>
<pre><code>Have collection of x number of messages (M) 80 bytes in size
Loop through records, and calculate the sha256(sha256(M))
Divide the number of computed hashes against elapsed time
    # the result is hash rate ( in seconds, given your elapsed time is in s )
</code></pre>
<p>After doing so, I see results up to 24000 hashes per second, or 24KH/s. Obviously, this is alarming, as the reference article I am attempting to compare to, has these results:</p>
<blockquote>
<p>The iPhone 6 has 25/30 Hash Rate (H/s)</p>
<p>The iPhone 8 55 H/s</p>
<p>The iPhone X (iPhone 10) 65 hashes per second</p>
</blockquote>
<p>I later continued my hunt, and stumbled upon this Stack post <a href="https://bitcoin.stackexchange.com/questions/76562/how-to-calculate-hash-rate-of-your-rig">how to calculate hash rate of your rig?</a>, and the accepted answer mentions that the hash rate is something that is defined empirically. While I do not doubt the author, I now find it difficult to determine what hash rate really is. ( Does the &quot;nonce&quot; have any impact on calculating the hash rate? i.e Is the standard hash rate determined by calculating the number of times my machine can ensure that the hashed result begins with 3 ( or 5, or 7 ) leading zeros in 1 second? )</p>
<p><strong>TL;DR</strong></p>
<p>I want to compute a hash rate for my IOS device. What algorithm and algebraic expression should I use to calculate the hash rate, to be able to compare my results against other devices, like laptops and graphics cards?</p>

CC BY-SA 4.0
2019-02-26T23:37:38.663Z
You won't good information on Bitcoin mining on an iPhone because it is completely nonsensical. The 55/65 H/s number you're linking to is not about mining Bitcoin but another cryptocurrency - you can't compare the numbers. My back-of-the-envelope calculation guesses that a modern iPhone could perhaps do 5-20 Mhash/s, if optimized software for it existed. That corresponds to approximately 1000 years to mine $1 worth of BTC at current difficulty and market prices.
Pieter Wuille
CC BY-SA 4.0
2019-02-26T23:44:24.390Z
@PieterWuille Good point, I overlooked that part in the article. It does showcase the results of a different algorithm. However, there are other places on the internet, such as this : https://9to5mac.com/2017/12/21/hands-on-mobileminer-how-to-mine-cryptocurrency-on-an-iphone-video/ , that do show similar results. My goal is not to mine on the iPhone, I simply want to see what this hash rate really is, how it is calculated, and how the devices I own compare against the world.
angryip
CC BY-SA 4.0
2019-02-26T23:45:05.323Z
The hash rate is literally how many distinct block header hashes you can try per second. Nothing more, nothing less. But the answer obviously depends a lot on the availability of optimized software to exploit all of the hardware's power. You won't find such software for devices where it's obviously nonsensical to do so, but it also means you can't actually put a good number on it.
Pieter Wuille
CC BY-SA 4.0
2019-02-26T23:48:58.737Z
@PieterWuille If i wanted to calcualte the Bitcoin hash rate, then I am to take a sha256(sha256(M)), where M is a 80 byte message, correct?
angryip
CC BY-SA 4.0
2019-02-26T23:51:38.180Z
Yes, but that's not how you would implement it in practice. There are parts of the computation that can be cached across multiple block headers (as you only modify a few bytes of the header). There are some parts that can be skipped because they don't meaningfully affect the outcome (the last output bytes). There may be specialized hardware instructions. It gets even more complicated when you take things like AsicBoost into account. In short: you can't meaningfully say what the exact potential hashrate is without large engineering effort to find the best way to do it on your hardware.
Pieter Wuille
CC BY-SA 4.0
2019-02-26T23:54:08.740Z
@PieterWuille Right, I completely understand. I was just becoming seriously confused with misleading data ( at least in my opinion ) on the internet. If you don't mind, please post that last block as an answer so I can close my question.
angryip
<hash><hashpower>
Hash rate : Algebraic Equation
angryip
# Hash rate : Algebraic Equation

(Asked by: username_0 on 2019-02-26)

I recently made a post on stack, Calculate hash rate in IOS, in hopes of deciphering how the hash rate is calculated when benchmarking performance. The reason I wanted to do this is to compare against the results that are presented in Is it Possible to Mine Cryptocurrencies with an iPhone? After days of hunting around on the internet, I've come to a conclusion that calculating the hash rate is not as straight forward as it seems.
My Thoughts
I was under the impression, especially after reading How can I calculate how many hashes I generate per second?, Explaining Hash Rate Or Hash Power In Cryptocurrencies and How is hash rate of mining hardware calculated, that calculating the hash rate is done as follows:
Have collection of x number of messages (M) 80 bytes in size
Loop through records, and calculate the sha256(sha256(M))
Divide the number of computed hashes against elapsed time
    # the result is hash rate ( in seconds, given your elapsed time is in s )

After doing so, I see results up to 24000 hashes per second, or 24KH/s. Obviously, this is alarming, as the reference article I am attempting to compare to, has these results:

The iPhone 6 has 25/30 Hash Rate (H/s)
The iPhone 8 55 H/s
The iPhone X (iPhone 10) 65 hashes per second

I later continued my hunt, and stumbled upon this Stack post how to calculate hash rate of your rig?, and the accepted answer mentions that the hash rate is something that is defined empirically. While I do not doubt the author, I now find it difficult to determine what hash rate really is. ( Does the "nonce" have any impact on calculating the hash rate? i.e Is the standard hash rate determined by calculating the number of times my machine can ensure that the hashed result begins with 3 ( or 5, or 7 ) leading zeros in 1 second? )
TL;DR
I want to compute a hash rate for my IOS device. What algorithm and algebraic expression should I use to calculate the hash rate, to be able to compare my results against other devices, like laptops and graphics cards?

**Tags:** hash, hashpower

> **Comments:**
> **username_1**: You won't good information on Bitcoin mining on an iPhone because it is completely nonsensical. The 55/65 H/s number you're linking to is not about mining Bitcoin but another cryptocurrency - you can't compare the numbers. My back-of-the-envelope calculation guesses that a modern iPhone could perhaps do 5-20 Mhash/s, if optimized software for it existed. That corresponds to approximately 1000 years to mine $1 worth of BTC at current difficulty and market prices.  
> **username_0**: @PieterWuille Good point, I overlooked that part in the article. It does showcase the results of a different algorithm. However, there are other places on the internet, such as this : https://9to5mac.com/2017/12/21/hands-on-mobileminer-how-to-mine-cryptocurrency-on-an-iphone-video/ , that do show similar results. My goal is not to mine on the iPhone, I simply want to see what this hash rate really is, how it is calculated, and how the devices I own compare against the world.  
> **username_1**: The hash rate is literally how many distinct block header hashes you can try per second. Nothing more, nothing less. But the answer obviously depends a lot on the availability of optimized software to exploit all of the hardware's power. You won't find such software for devices where it's obviously nonsensical to do so, but it also means you can't actually put a good number on it.  
> **username_0**: @PieterWuille If i wanted to calcualte the Bitcoin hash rate, then I am to take a sha256(sha256(M)), where M is a 80 byte message, correct?  
> **username_1**: Yes, but that's not how you would implement it in practice. There are parts of the computation that can be cached across multiple block headers (as you only modify a few bytes of the header). There are some parts that can be skipped because they don't meaningfully affect the outcome (the last output bytes). There may be specialized hardware instructions. It gets even more complicated when you take things like AsicBoost into account. In short: you can't meaningfully say what the exact potential hashrate is without large engineering effort to find the best way to do it on your hardware.  
> **username_0**: @PieterWuille Right, I completely understand. I was just becoming seriously confused with misleading data ( at least in my opinion ) on the internet. If you don't mind, please post that last block as an answer so I can close my question.  

---

## 1 answers

### Answer by username_1 on 2019-02-27. Score: 2 | Accepted answer

The hash rate is literally how many distinct block header hashes you can try per second. Nothing more, nothing less. Note that I say "try" and not "compute". Determining whether a particular block header is interesting is somewhat faster than fully computing the hash:

* You can drop the last few rounds of the hash implementation, and only compute the first 32 bits of the output (and if that those 32 bits are 0, recompute the hash in less optimized software to determine if it's a fully valid block).
* You can exploit the fact that successive attempted block headers only differ in a few bytes, reusing part of the computation.
* You can precompute things to find combinations of multiple block header attempts that share more parts of the evaluation than random ones (this is what AsicBoost is based on).

So determining the exact hashrate of certain hardware is a nontrivial engineering effort because of the above, and is complicated by things like architecture specific optimization, and things like exploiting special hardware instructions.

Such engineering has obviously not been done for iPhone, as it's a nonsensical target for computation. My back of the envelope computation suggests it could probably do a few MH/s, but as that still means ~50 million years to find a block, not much effort will be spent on this.


---

