Expand description
Block difficulty data structures and calculations
The block difficulty “target threshold” is stored in the block header as a
32-bit CompactDifficulty
. The block::Hash
must be less than or equal
to the ExpandedDifficulty
threshold, when represented as a 256-bit integer
in little-endian order.
The target threshold is also used to calculate the Work
for each block.
The block work is used to find the chain with the greatest total work. Each
block’s work value depends on the fixed threshold in the block header, not
the actual work represented by the block header hash.
Modules§
Structs§
- Compact
Difficulty - A 32-bit “compact bits” value, which represents the difficulty threshold for a block header.
- Expanded
Difficulty - A 256-bit unsigned “expanded difficulty” value.
- Partial
Cumulative Work - Partial work used to track relative work in non-finalized chains
- U256
- Little-endian large integer type
- Work
- A 128-bit unsigned “Work” value.
Constants§
- INVALID_
COMPACT_ DIFFICULTY - An invalid CompactDifficulty value, for testing.
Traits§
- Parameter
Difficulty - Network methods related to Difficulty