Bitcoin Forum
June 03, 2024, 01:24:55 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: Potential SHA256 Mining Speedup (2.3%) on: October 05, 2017, 06:32:43 PM
I just mentioned the 128 rounds to calculate the % reduction in overall calculation, 3 out of all 128 rounds (ignoring the other calculations that need to be done).
If you are counting all rounds, then it's 192 rounds. The first SHA256 requires 128 rounds (because the header is larger than 512 bits) and the second only requires 64 rounds (because it is hashing the 256 bit hash).

This is mentioned here: http://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html
Quote
Unfortunately the SHA-256 hash works on a block of 512 bits, but the Bitcoin block header is more than 512 bits. Thus, a second set of 64 SHA-256 hash rounds is required on the second half of the Bitcoin block. Next, Bitcoin uses double-SHA-256, so a second application of SHA-256 (64 rounds) is done to the result. Adding this up, hashing an arbitrary Bitcoin block takes 192 rounds in total. However there is a shortcut. Mining involves hashing the same block over and over, just changing the nonce which appears in the second half of the block. Thus, mining can reuse the result of hashing the first 512 bits, and hashing a Bitcoin block typically only requires 128 rounds.
2  Bitcoin / Development & Technical Discussion / Re: Potential SHA256 Mining Speedup (2.3%) on: October 04, 2017, 09:22:38 PM
FWIW early termination has been used by miners since at least 2010.

Ha not surprised. Any sources I can look at?
3  Bitcoin / Development & Technical Discussion / Re: Potential SHA256 Mining Speedup (2.3%) on: October 04, 2017, 03:45:38 AM
Quote
The second sha256 hash is only hashing 32 bytes (the result of the first sha256 hash) so there are only 64 rounds for that.
I just mentioned the 128 rounds to calculate the % reduction in overall calculation, 3 out of all 128 rounds (ignoring the other calculations that need to be done).

Quote
Note that the difficulty IS NOT determined by "number of 0's" but rather that the target must be less than a certain value. This happens to result in the hash having a lot of 0's in front of it, but that is not actually what is being checked.
Left this out for simplicity

Quote
Also, the hash that is actually produced is the byteswapped version of what we actually see presented to us. I'm not sure if that effects this.
This was factored in.
4  Bitcoin / Development & Technical Discussion / Potential SHA256 Mining Speedup (2.3%) on: October 04, 2017, 01:16:42 AM
It seems like there might be a way to speed up mining by a tiny bit. The first 8 0's of the final block hash can be determined by looking at a value calculated in round 61 of the final SHA256 hash (instead of waiting for all 64 rounds and the final step to complete). The second set of 8 0's can be determined by looking at a value calculated in round 62, and the third set from round 63. Therefore, the algorithm should be able to short-circuit and skip some rounds of calculations by checking these values at their respective rounds. Given that there are 128 rounds (http://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html), there should be ~2.3% reduction in calculations per hash (at most).

Also, when the mining difficulty reaches 33 0's, another value from round 61 can be examined.

I'm assuming the gain is negligible when considering the cost/difficulty in implementing it. Either way I'm curious to hear some feedback.

(this is helpful for understanding: https://bitcointalk.org/index.php?topic=809430.0)
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!