<p>The difficulty is a function of block creation speed.<br>
The goal is to, on average, create blocks every 10 mins. 
It is recalculated every two weeks (<a href="https://github.com/bitcoin/bitcoin/blob/21ee676dd6a7d9704367b6412bf8e1e443ec2b5b/src/chainparams.cpp#L76" rel="nofollow noreferrer">link</a>)<br>
You can look up the calculation of difficulty in the open source code of Bitcoin<br>
<a href="https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49</a></p>

CC BY-SA 4.0
2019-12-12T00:32:35.740Z
2019-12-12T00:32:35.740Z
Albert S
<p>For instance, Bitcoin has a proof of work based consensus algorithm, it's how Bitcoin chooses a node to create the next block in Bitcoin's blockchain. In this way the network is in consensus about the creation of the next block. Part of this block creation process is issuing the next proof of work to the network, and the consensus node, based off of the algorithm in question, may set a new difficulty on the proof of work. Bitcoin tries to keep this proof of work difficult enough but easy enough so that block creation times are around 10 minutes.</p>

<p>What is the algorithm that sets this difficulty?</p>

<difficulty><proof-of-work>
What is the algorithm that adjusts the difficulty of the proof of works in a proof of work based cryptocurrency?
Steve Mucci
# What is the algorithm that adjusts the difficulty of the proof of works in a proof of work based cryptocurrency?

(Asked by: username_0 on 2019-12-11)

For instance, Bitcoin has a proof of work based consensus algorithm, it's how Bitcoin chooses a node to create the next block in Bitcoin's blockchain. In this way the network is in consensus about the creation of the next block. Part of this block creation process is issuing the next proof of work to the network, and the consensus node, based off of the algorithm in question, may set a new difficulty on the proof of work. Bitcoin tries to keep this proof of work difficult enough but easy enough so that block creation times are around 10 minutes.

What is the algorithm that sets this difficulty?

**Tags:** difficulty, proof-of-work


---

## 1 answers

### Answer by username_1 on 2019-12-12. Score: 1

The difficulty is a function of block creation speed.  
The goal is to, on average, create blocks every 10 mins.
It is recalculated every two weeks ([link](https://github.com/bitcoin/bitcoin/blob/21ee676dd6a7d9704367b6412bf8e1e443ec2b5b/src/chainparams.cpp#L76))  
You can look up the calculation of difficulty in the open source code of Bitcoin  
<https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49>


---

