← Back to team overview

mimblewimble team mailing list archive

Re: [ignopeverell/grin] Difficulty adjustment algoritm (#62)

 

Hey Edgar,

I've looked at all these algorithms in a fair amount of details now and they're all fairly similar. The main difference between Digishield and Dark Gravity Wave is that the latter uses the latest difficulty instead of an average in the former. And Bitcoin's standard difficulty algorithm is very problematic if you have large variations in hash power, which we're bound to have at least in the beginning.

Overall, I'm not a huge proponent of "more is better". It's too easy to forget that what's sacrificed on the other side of the balance is simplicity. And blockchain implementations are complex systems that can use every bit of simplicity that can be found.

- Igno

-------- Original Message --------
Subject: Re: [ignopeverell/grin] Difficulty adjustment algoritm (#62)
Local Time: June 19, 2017 12:29 PM
UTC Time: June 19, 2017 7:29 PM
From: notifications@xxxxxxxxxx
To: ignopeverell/grin <grin@xxxxxxxxxxxxxxxxxx>
Ignotus Peverell <igno.peverell@xxxxxxxxxxxxxx>, Mention <mention@xxxxxxxxxxxxxxxxxx>

Hi Igno et al.,

How bad of an idea is it to utilize several difficulty adjustment algorithms? This gives us a chance to utilize the outputs of each to come to more complete agreement on increase/decrease in difficulty?

Adjustment Algorithms (A, B, C, D) modified to take in n (number of last blocks to evaluate) as aparameter:
A = Dark Gravity Wave
B = Bitcoin's Standard Difficulty Algorithm
C = Digishield/Dogeshield
D = Our own Difficulty Adjustment Algorithm

Every 23 Blocks Calculate Difficulty:

-
Produce a difficulty Increase/Decrease taking into account last 23 Blocks
- e = (A(23) + B(23) + C(23) + D(23))/4

-
Produce a difficulty Increase/Decrease taking into account last 230 Blocks
- f = (A(230) + B(230) + C(230) + D(230))/4

-
Produce a difficulty Increase/Decrease taking into account last 2300 Blocks
- g = (A(2300) + B(2300) + C(2300) + D(2300))/4

-
Produce a difficulty Increase/Decrease taking into account last 23000 Blocks
- h = (A(23000) + B(23000) + C(23000) + D(23000))/4

- i = (e+f+g+h)/4
- i > 33% Down i = 33% adjustment Downward
- i > 16% Up i = 16.6% adjustment Upward

My thinking is if we can produce several difficulty increase/decrease averages over several different block ranges with multiple algorithms. It would allow us to pick a better value for difficulty increase/decrease. In the above scenario we produce difficulty adjustments using ~ 4 different timescales, at each timescale we then calculate an average increase/decrease using 4 different algorithms and return it for later processing. After each of the timescales is calculated and averaged, we can take the averages derived from looking at ranges: 23, 230, 2300, and 23000 then use these averages to calculate a better difficulty change i, if i is a decrease greater than 33%, i = 33% decrease, if i is an increase greater than 16% i = 16% Increase

The main downside I see, other than this being more code to maintain is that the difficulty readjustment calculation would be magnitudes slower when compared to just having one Difficulty adjustment algorithm produce a difficulty over only a single range.

Cheers,
Edgar

—
You are receiving this because you were mentioned.
Reply to this email directly, [view it on GitHub](https://github.com/ignopeverell/grin/issues/62#issuecomment-309544551), or [mute the thread](https://github.com/notifications/unsubscribe-auth/AV3YyUTpYy3G7oHJv9kbMA0YIdEzkq_Lks5sFswWgaJpZM4N7vVX).