The current target is:
So if you want to add a candidate block to the blockchain, you must get one with a blockhash that is below this value.
Where does the target come from?
The target originally started out at:
This target was set so that it would take 10 minutes to mine a block. Or in other words, that it would take an average of 10 minutes to find a block hash (number) below this value.
However, as miners get faster at hashing and are able to mine blocks more quickly, the target adjusts (up and down) to try and keep the time between blocks at 10 minutes intervals.
This original target value is also the highest possible value for the target.
When does the target move?
The target adjusts every 2016 blocks (roughly every 2 weeks).
- If blocks have been mined in less than 10 minutes (on average) over the last 2016 blocks, the target moves lower.
- If blocks have been mined in more than 10 minutes (on average) over the last 2016 blocks, the target moves higher.
So before every 2016th block, each node will look at the average time it took to mine the last 2016 blocks, and move the target up or down based on that.
1. What has the target got to do with the difficulty?
The difficulty shows the change in the target from it's original value.
difficulty = original_target / target
So if we work out the current difficulty:
difficulty = 0x00000000ffff0000000000000000000000000000000000000000000000000000 / 0x000000000000000000eb30000000000000000000000000000000000000000000 = 1196792694098.8
Which is like saying: "it's currently 1,196,792,694,099 times more difficult to mine a block today than it was when bitcoin started."
The difficulty value is not used internally in bitcoin. It's just a useful metric that helps you compare the changes in the height of the target.
2. What has the target got to do with "
pow.cpp- This is the code that adjusts the target every 2016 blocks.
chainparams.cpp- The original target value (and also the highest possible target value) is set by