4

The first answer here does a good job explaining how the SHA-256 function requires more than one input (an initial one is specified by to the SHA-256 specs). As far as I understand it, the "midstate" value is the initial hash of the first half of the data, used to later serve as an input into the double-hash of the second half of the data.

Is this correct?

And here is an explanation of what the "hash1" value actually is and means, but what is it used for?

2
  • What do you mean by "half" here? If b=SHA(a=SHA(data)), a = "initial hash" and b = "second half"? So, a is the midstate?
    – Geremia
    Commented Mar 27, 2015 at 4:15
  • This defines midstate well; it's "the contents of the 'state' after having processed the first [SHA256] block." Thus, it's not a in b=SHA(a=SHA(data)) if data is longer than one SHA256 block (64 bytes). Isn't the Bitcoin block header 80 bytes?
    – Geremia
    Commented Jun 11, 2015 at 6:21

1 Answer 1

2

1) Yes, it is correct.

2) It is deprecated. Generally, it is used to write the result of the mining over to be sent to the pool. This is to ensure the result is of correct length and adheres to some rules. In practice, it is always the same trailing string of numbers.

3
  • So the hash1 value itself is never actually used? It just serves as a formatting template? Commented Oct 11, 2012 at 13:28
  • @ConstableJoe Well, it's not used for any calculations, it is deprecated in general and eventually it will be left out of the getwork protocol.
    – ThePiachu
    Commented Oct 11, 2012 at 13:46
  • Interesting. Seems pretty useless, unless I'm missing something. Commented Oct 12, 2012 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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