How does the difficulty work?

algorithm GENERIC
source branch ALL

updated October 22, 2022, 11:20 am

Your coin calculates a new difficulty every couple of blocks, the exact amount of blocks is defined with the values “Target spacing” and “Target timespan”.

The value “Target spacing” defines how long it should take to mine a block.
The value “Target timespan” defines when the difficulty should be changed.

The amount of blocks it takes before your coin calculates the new difficulty:

Amount of blocks = “Target timespan” / “Target spacing”.

The following page explains how the difficulty works with Bitcoin.