Difficulty Adjustment
Notes on Kaspa mining difficulty - target, the sampled-window difficulty adjustment algorithm, hash rate, and DAA score.Target
Target is the upper limit of an acceptable hashed block header value for mining. To mine a block, a miner hashes the block header with kHeavyHash, changing the nonce until the resulting hash is numerically less than or equal to the target. When such a nonce is found, the network accepts the block (assuming all other consensus and structural requirements are met).
Target is adjusted by the difficulty adjustment algorithm every 100 milliseconds and stored in virtual’s bits field in compact representation, which populates bits on the block template provided to miners. A mined block header’s bits field holds that block’s target.
Difficulty
Difficulty is a numerical value representing how challenging mining is or was at a given point in time, relative to the maximum target (a hardcoded rusty-kaspa value representing the easiest possible mining). Difficulty is derived from target and has an inverse relationship with it:
difficulty = MAX_DIFFICULTY_TARGET / target Where target is either the current target (virtual’s bits) or the target of an already mined block (from its header’s bits).
Difficulty adjustment algorithm
The DAA adjusts target so the actual block production rate stays at approximately the desired rate - currently 10 blocks per second.
Full Window (pre-Crescendo): a full sliding window of 2641 blocks (~44 minutes at 1 BPS) was inspected every block (~1 second) to recalculate target. This legacy approach remains in rusty-kaspa for backwards consensus compatibility.
Sampled Window (current): activated with the Crescendo hard fork via KIP-0004. Instead of every block in the window, blocks within a 2641-second sliding window are sampled at a fixed interval of approximately 4 seconds (sampling is based on DAA score, not clock time), producing a set of ~661 blocks used to recalculate target. Sampling reduces the overhead of difficulty adjustment so it scales at 10 BPS. Crescendo also effectively divided difficulty by 10 at activation (by multiplying target by 10) to recalibrate for the new block rate.
Reference: KIP-0004
Hash rate
Hash rate measures total computational power mining on the network - the rate at which miners generate hashes attempting to mine blocks. Kaspa’s network hash rate can be calculated as difficulty × 2 × BPS.
Common units:
| Unit | Hashes per second |
|---|---|
| H/s | 1 |
| kH/s | 10^3 |
| MH/s | 10^6 |
| GH/s | 10^9 |
| TH/s | 10^12 |
| PH/s | 10^15 |
| EH/s | 10^18 |
DAA score
DAA score counts blue blocks plus merged & rewarded red blocks - a comprehensive measure of network progress that increases at roughly the block rate (~10 per second at 10 BPS). DAA score is used for network upgrade activations (e.g. Crescendo activated at DAA score 110,165,000), timestamp estimation, and certain transaction lock times.
See Also: GHOSTDAG Ordering, Network Parameters