# Calculate the difficulty of Bitcoin network

Which variable among the components of the block header is computed (or rather obtained) to achieve the difficulty posed by the bitcoin network?

Nonce or Previous block hash?

The question is twisted here.Miners has to find nonce with their computation power inorder to solve the difficult puzzle and add the block to blockchain.

I think you're confusing terms here.

Which variable among the components of the block header is computed

The block components which are computed (hashed) are all of the components which make up the block header: version, previous block hash, merkle root, unix epoch time, difficulty target (bits), and nonce.

Difficulty
A value which represents how hard it will be to mine a block. Higher difficulty value = harder to solve. The difficulty of the genesis block is 1. All block difficulties are calculated as a ratio to the difficulty of the genesis block.

Proof of Work
When you calculate a proof of work, you must meet the minimum difficulty posed by the network, as you state. This validation step makes sure that the value of the block hash you provide is less than or equal to the difficulty target.

## Example

To illustrate this concept, you can validate one of the block hashes manually.

1. Grab a block (eg. block 3): Block 3 in json or Block 3 in hex

2. Concatenate (in this order, little endian, hex format) the version, previous block hash, merkle root, unix epoch time, difficulty target (bits), and nonce. You’ll see you can copy the first 160 characters from the Block 3 in hex link.

01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d

3. Run the command:

\$ echo 01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d | xxd -r -p | openssl sha -sha256 | xxd -r -p | openssl sha -sha256

4. Reverse the output from `4944469562ae1c2c74d9a535e00b6f3e40ffbad4f2fda3895501b58200000000` to
`0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449`

And there’s the block hash!