0

Is this the current difficulty formula for Ethereum?

block_diff = parent_diff + parent_diff // 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99) + int(2**((block.number // 100000) - 2))

What is the current value in place of 100000

Thank you

1 Answer 1

1

That's the correct formula since the homestead development phase.

100000 is here a constant and according to How does the Ethereum Homestead difficulty adjustment algorithm work? :

+ int(2**((block.number // 100000) - 2))  

refers to

The difficulty bomb part, which increases the difficulty exponentially every 100,000 blocks.

EDIT

It seems this formula is no longer correct since the EIP-2384 : https://eips.ethereum.org/EIPS/eip-2384.

It specifies the following :

For the purposes of calc_difficulty, simply replace the use of block.number, as used in the exponential ice age component, with the formula:

fake_block_number = max(0, block.number - 9_000_000) if block.number >= MUIR_GLACIER_FORK_BLKNUM else block.number

This will delay the ice age by 52 million seconds (approximately 611 days), so the chain would be back at 20 second block times around July 2021. It’s important to note this pushes the ice age 4,000,000 blocks from ~block 8,800,000 NOT from when this EIP is activated in a fork.

4
  • As far as I know, the difficulty bomb hasn't been actually implemented. It has been postponed many times. bravenewcoin.com/insights/… Commented Sep 8, 2020 at 12:10
  • Thanks, it seems the formula has been changed on January 2020 during the Muir hard fork with the eip-2384 : eips.ethereum.org/EIPS/eip-2384
    – clement
    Commented Sep 8, 2020 at 12:31
  • From bravenewcoin.com/insights/… "When Istanbul was put in place, Ethereum developers apparently forgot to adjust the feature known as the 'difficulty bomb'. The developer's forgetfulness caused a significant mishap, creating 'an unplanned reduction' of twenty percent in inflation rate and security on the Ethereum network." I just started learning about the internal workings of Ethereum. This is a little disturbing.
    – Axium7
    Commented Sep 9, 2020 at 6:20
  • From eips.ethereum.org/EIPS/eip-2384 "Therefore, it should be included in a scheduled hardfork at a certain block number. It’s suggested to include this EIP shortly after the Istanbul fork." Istanbul was released Dec 4, 2019. EIP-2384 was released before Istanbul on Nov 20, 2019. Based on the dates the Ethereum Developers didn't forget.
    – Axium7
    Commented Sep 9, 2020 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.