# How nonce and diffuculty work?

I struggle to understand one concept behind mining. It would be really great if someone could clarify some things.

This is an extract from blockgeeks: From a technical point of view, mining process is an operation of inverse hashing: it determines a number (nonce), so the cryptographic hash algorithm of block data results in less than a given threshold. (The threshold is difficulty here.)

The question is why cryptographic hash algorithm results in less than given threshold? I always thought it should be equal or higher than threshold. If it can be less then blocks can be created really quickly.

What am I missing here?

If it can be less then blocks can be created really quickly.

This is not the case if threshold is referring to the target. In order for a block hash to be valid, it must be less than the target value. The lower the target value, the less possible solutions exist, because the target value (and block hash) are 256 bit numbers, meaning there is a finite number of possibilities.

There is a difference between target and difficulty. The article confuses the terms threshold and difficulty.

## Target

The number that the block hash must be less than in order to be valid. This is a 256 bit number e.g. genesis block target:

`0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF`

Genesis block hash (notice it is less than the target above):

`0x000000000019D6689C085AE165831E934FF763AE46A2A6C172B3F1B60A8CE26F`

## Difficulty

This describes how difficult, in relation to the genesis block, the target will be to reach. The higher the difficulty, the more hashes (on average) you have to do to find a solution that is less than the target. It is calculated as:
`difficulty = genesis_difficulty_target / current_target`