Blockchain Academy
We'll get together for networking with people interested in Blockchain including developers and anyone curious about Blockchain.

Difficulty

Difficulty in Bitcoin is for adjusting Bitcoin creation time cycle to the target achievement. Bitcoin is designed to have 2016 blocks in every two weeks when one block is created in every 10 minutes. (2016 * 10min = 2wks) If the 2016 blocks are created before two weeks due date, it is thought to be failed to reach the 100% completion, and the bits value is adjusted to fit into two weeks schedule.

The formula for the difficulty is as follows.

First convert the bits value into the hexadecimal value and separate the previous two numbers and the following six numbers. Then sum these up.

Using the formula, get the current target which is the denominator.

Maximum target is a fixed constant number as follows in this formula.

Based on this difficulty, the time to find the block can be measured by the hash rate.

The difficulty can be expressed as follows. (bdiff: Bitcoin client-based custom floating-point format)

It works the same on Ethereum. When creating blocks, the hash, which is equal to or smaller than the target threshold, is derived by computation by inputting nonce. The following formula is used for the target threshold.