Getwork

From Bitcoin Wiki
Revision as of 15:39, 15 July 2011 by Batouzo (talk | contribs) (link to nonce)
Jump to: navigation, search

An RPC method used by a miner to get hashing work to try to solve.

Pseudocode

(Just ignore the midstate until you understand the internals of SHA256.)

calculate: hash = SHA256(SHA256(data))

If that meets the difficulty, you win (generated a block)!

If not, increment the [Nonce] that is a number stored in portion of the data that starts 640 bits in (bytes 76 to 79), and try again.

If the incremented portion overflows, get new work.