What is the algebraic relationship between Total Network Hash-Rate and Difficulty?


Short answer:

  difficulty = hashrate / (2^256 / max_target / intended_time_per_block)
             = hashrate / (2^256 / (2^208*65535) / 600)
             = hashrate / (2^48 / 65535 / 600)
             = hashrate / 7158388.055

(where hashrate is expressed in hashes/s)

Longer answer: there is no direct relation between the actual network hashrate and the difficulty, because the actual hashrate cannot be observed. What happens is that every 2016 blocks, the average hashrate during that period is measured, and the difficulty is adjusted based on that.

  • 1
    Can you elaborate on what max_target and intended time per block is? Are they constant? Located in the client? Are they calculated? – halfbit Nov 30 '12 at 20:03
  • 2
    max_target is 2^208*65535 (an application-defined constant, which sets the target hash corresponding to the lowest possible difficulty, 1), and intended_time_per_block is 600 (10 minutes, also a constant). – Pieter Wuille Nov 30 '12 at 20:17
  • 1
  • Where does the 2^256 come from? Where did you find this info in the client? Thanks so much!!! – Kinnard Hockenhull Dec 2 '12 at 16:40
  • 2
    @KinnardHockenhull: Hashes are 256-bit integers. The target is max_target/difficulty, so (2^256*difficulty/max_target) hashes are needed on average to find a block. So the difficulty will be the value that makes the average time for the network to find a block equal to the intended time. – Meni Rosenfeld Dec 5 '12 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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