---
title: "Exploring the Abelian ‘Difficulty Smoothing Algorithm’ (DSA)"
description: "The Abelian blockchain has undergone a change in its difficulty adjustment scheme starting block 284000, and its effects on the block difficulty and average block time can be seen in the graphs below."
url: "https://pqabelian.io/en/blog/exploring-the-abelian-difficulty-smoothing-algorithm-dsa"
language: "en"
category: "Abelian Insights"
published: "2024-07-03"
updated: "2026-02-10"
---

# Exploring the Abelian ‘Difficulty Smoothing Algorithm’ (DSA)

> The Abelian blockchain has undergone a change in its difficulty adjustment scheme starting block 284000, and its effects on the block difficulty and average block time can be seen in the graphs below.

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/01-6769209f9019ee9736a3e2b1_1-eGSYAl-uxMwbgAOKHbh8DQ.webp)

‍

## Introduction

The [Abelian blockchain](https://explorer.abelian.info/home) has undergone a change in its difficulty adjustment scheme starting [block 284000](https://explorer.abelian.info/block/284000), and its effects on the block difficulty and average block time can be seen in the graphs below.

This writeup will briefly explain how the new adjustment mechanism ([Difficulty Smoothing Adjustment](https://download.pqabelian.io/release/docs/abelian%5Fdifficulty%5Fsmoothing%5Falgorithm%5Fwhitepaper.pdf)) works, and follow it up with an example of calculating a slot’s new `target` and `bits` parameters.

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/02-6769209e7f229d08e47cb1e0_1-fPM185z4p4DvN7Mv2DxWbg.webp)

## Difficulty Smoothing Adjustment (DSA)

**Work, Hash Rate, & Target**

When mining a block, a miner would first compute the `hash` value of its header, and then check if it’s less than the block’s `target`.

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/03-6769209eab90f4029b720afa_1-ewuQn0qu3Ib6jKHla441rw.webp)

Since the hash algorithm used is SHA-256, there are 2²⁵⁶ possible `hash rate` values, and the miner succeeds in mining a block for target possible values. This means the probability of successfully mining a block would be

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/04-6769209e8bd7c12499ad57b5_1-_qDF886irHay_nPaLhT4Jg.webp)

and therefore the expected number of attempts until a miner succeeds would be

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/05-6769209fe58153a721961e12_1-Ervf1wp60E2k0yW3AsTZBg.webp)

We define `work` (for a single block) to be this number of expected attempts, and we define the `hash rate` as the amount of `work` done per second.

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/06-6769209f8f6db5321a35ba6c_1-TThrWLR-jBycdiUEAtdaJg.webp)

Note: Instead of `target`, we only see the `bits` value in the Explorer’s API. For example, <https://api.abelian.info/v1/block/284800> displays

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/07-6769209ed8d5b927d69f8d94_1-FDzPXnyeyFyPAjns_mfiog.webp)

The `bits` value represents the `target` value in compact form, which we can convert back to its full form like so:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/08-6769209e300b74873777ac6d_1--Olghx9q1SN71wdOLdOJnw.webp)

## DSA Summary

_Note: A slot consists of 200 consecutive blocks. For example, 284800–284999 is a single slot._

The new Difficulty Smoothing Algorithm was launched at block 284000, replacing the original adjustment mechanism. It now recalculates the `target` for each slot, by first calculating a weighted average `hash rate` over the past 20 slots, then using the weighted hash rate to come up with a new `target`so that the average time taken for a block to be mined would be 256 seconds, assuming the next slot’s hash rate matches the predicted weighted hash rate.

First, given a `target` and `slot time` (number of seconds between the mining time of the first and last block in the slot), we can calculate a slot’s `hash rate` like so:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/09-6769209f1de00d4e0d5ea886_1-uI15Xr5AWHl0yNhS-A-Urg.webp)

Or equivalently,

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/10-6769209e5058400f861ad5b2_1--z3AIykb2v1oKqQVQ0xEZQ.webp)

Once we calculate the hash rate of the past 20 slots (`hash rate`ᵢ₋₂₀, `hash rate`ᵢ₋₁₉, . . . , `hash rate`ᵢ₋₁), we then proceed with calculating the weighted average hash rate:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/11-6769209f8f6db5321a35ba69_1-hoFH-JtJcTH_7yyVxpzJwg.webp)

We then compare the ratio between `avg hash rate` and the most recent slot’s hash rate (`hash rate`ᵢ₋₁). If the ratio is below 1/4 or above 4, we clamp it between these values.

_Note: Assuming the hash rate of the next slot doesn’t change from the most recent slot, and if the newly-calculated difficulty would increase the average block time to over 4 · 256 = 1024 seconds, or decrease it to below 256/4 = 64 seconds, this would clamp the average block time between these values._

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/12-6769209ea0f953a9b730c178_1-DgokqlLJmUY2s6sN1K6BXw.webp)

Finally, we ‘predict’ the next slot’s `hash rate` would be `target hash rate`, and we would calculate the new `target`value accordingly. Given the relationship between `hash rate` and `target`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/13-6769209e3eab5576c583dcf1_1-q3LvtUhFcjmRfrBzJ3VFMQ.webp)

We wish for the upcoming `slot time`to be 199 · 256 seconds, therefore our new target would be:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/14-6769209f49d0ee7d59710900_1-qTF7ze2rTVTKabwdDMqJQg.webp)

And finally, we would convert our `target` into compact form as `bits`, and use `bits`’s value in all future calculations and comparisons.

## **Illustrative Example**

We demonstrate DSA by calculating the `target` for the slot 284800–284999.

First, we retrieve the parameters of the previous 20 slots from the Explorer’s API, and use them to calculate each slot’s hash rate. For example, we see that slot 280800–280999 has the following parameters:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/15-6769209e671ff80c097848e1_1-YSivR85151UohCVYCOhrGQ.webp)

We convert bits into `target`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/16-6769209f8f6db5321a35ba6f_1-AGI8a3qIYOmGQugwrX6uLg.webp)

And we calculate `slot time`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/17-6769209ecb011ef1da1b28dc_1-uczA92avlQJOtNio3V02xQ.webp)

Once we have `target`and `slot time`, we calculate `hash rate`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/18-6769209f3c6b2bcae291e00d_1-ZgKn2zLvNSszZ4FPzQeFrw.webp)

We repeat these steps for each of the past 20 slots:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/19-6769209f300b74873777ac78_1-eshObCW_afUvqeBFVeKhbw.webp)

Table 1: Hash rates of the past 20 slots

Once we have the past 20 slots’ hash rates, we calculate the weighted `avg hash rate`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/20-6769209e48379e4d3bd92be4_1-OTmgADCtYCQRCNmtmEwEEg.webp)

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/21-6769209f1de00d4e0d5ea88d_1-zGJQv7Pp5ymxVRjvV2wTfA.webp)

Table 2: Calculating the avg hash rate

We then compute the `ratio`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/22-6769209f8f05f400927d5395_1-WQ5rX00LtUMPawhDjUsH3A.webp)

Since `ratio` \= 4.16 > 4, we clamp `target hash rate` to 4 · `hash rate`ᵢ₋₁) = 2662210207228.

Finally, we can use `target hash rate` to compute the new `target`:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/23-6769209fa1b903ef58d95def_1-TjoTZKliViNc9ySgll76Bg.webp)

Now that we have the `target`, we can find the `bits` value by repeatedly dividing the `mantissa` by 256 and incrementing the `exponent` by 1 starting from 3, until `mantissa` < 0x00800000.

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/24-6769209fd8d5b927d69f8d9e_1-AIUOBEZB-53fQSmHPc6bow.webp)

Table 3: Mantissa & Bits

We find the `bits` value to be `1a69bad4`, and we will use the `bits`’s corresponding `target`value in future calculations:

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/25-6769209ea3315080bf9c735c_1-7LE87QCgTivBJ9b5OqCmgw.webp)

_Note — we can also find the difficulty value as shown in the Explorer’s API like so:_

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/26-6769209fa0f953a9b730c183_1-X5g7SJfjty9ZGDKcrjE0qg.webp)

_where M is the maximum possible difficulty (whose `bits` is `1d017c38`)._

_For example, for slot 284800–284999,_

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/27-6769209ed72ee5f5b232776c_1-ZteUaPsQ9y5Wh-Kt_7Gryw.webp)

## **Further reading**

For more about the advantages of DSA, [learn more](https://community.pqabelian.io/guide/abel-dsa-whitepaper) about how the algorithm quickly adapts to hashrate fluctuations and stabilizes the average block time.
[**_Advantages of Abelian’s Difficulty Smoothing Algorithm (DSA)_**](https://community.pqabelian.io/guide/abel-dsa-whitepaper)

![](https://pqabelian.io/blog/uploads/exploring-the-abelian-difficulty-smoothing-algorithm-dsa/28-6769209fa1b903ef58d95dfd_0-724bY0yRbnfD0lXY.webp)

‍
