Bitcoin Forum

Other => Beginners & Help => Topic started by: hkproj on July 25, 2011, 02:19:56 PM



Title: Mining algorithm
Post by: hkproj on July 25, 2011, 02:19:56 PM
Hi, I read the entire wiki, also read some code in C and python. Here is what I understood about the mining algorithm:
 - GetWork using RPC call
 - Read the 'data' section in the result in JSON returned from the server. Decode it into binary and change the byte ordering so that reflects the little-endian format (should I rotate chunks of 4 byte or byte per byte?)
 - Read the 'nonce' value, which is stored in byte from '76' to '80'.
 - Try incrementing the nonce value in the data, and then hash the 'data' with the modified nonce, and re-hash the result.
 - Check if the generated hash's value (converted to a number) is less than that of the target (which is a number stored as HEX).
 - If that is true, send the modified header to the daemon.

Is that right? Thank you.