Block difficulty is always '0' (zero)
See original GitHub issueExpected Behavior
Hardhat (on the left) has difficulty
and totalDifficulty
values set
Current Behavior
Ganache (on the right) has both difficulty
and totalDifficulty
values equal to zero.
Possible Solution
Both projects use ethereumjs-vm
version v4.2.0.
I assume the difference happens during block creation (as far as I remember Hardhat set difficulty based on the latest block):
Ganache doesn’t seem to have any difficulty-related header assignment:
P.S. Btw, also https://github.com/ethereumjs/ethereumjs-vm/pull/929 was merged 5 days ago - introducing a new way of setting a difficulty in ethereumjs-vm
(but Hardhat was setting difficulty before this release).
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Mining Difficulty and Leading Zeros - Bitcoin Stack Exchange
The difficulty adjustment is such that, if the average time to mine a block is greater than 10 minutes, then the difficulty will...
Read more >Difficulty - Bitcoin Wiki
The Bitcoin network has a global block difficulty. ... bits are zero and the rest are one (this is known as "pool difficulty"...
Read more >Bitcoin Mining Difficulty: Everything You Need to Know
While a 10-minute block time is the goal, the mining difficulty cannot be altered above or below four times the current difficulty level....
Read more >The mining difficulty represents the amount of leading zeros ...
The mining difficulty represents the amount of leading zeroes” is an oversimplification that people sometimes use (me included) when they don't want to...
Read more >Mining Difficulty - Simply Explained - YouTube
Mining Bitcoin or Ethereum is a hard task for your computer. But why? And what does the difficulty have to do with the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/trufflesuite/ganache-core/pull/771 addresses this issue.
Ah, thanks for the use-case example.
Also, looks like there are two bugs in forking:
difficulty
tototalDifficulty
.totalDifficulty
around, as we should.As for your use-case example, i’ll talk to the team internally and see what we can come up with!