Hello everyone
Can someone explain to me how the algorithm works and how DOGE's difficulty is adjusted? Or does can read up on how it currently works?
At the moment I use the following Code.
def calculate_next_difficulty(current_difficulty, time_delta_to_previous_block):
target_blocktime = 60
# Digishield Amplituden-Filter
modulated_timespan = target_blocktime + (time_delta_to_previous_block - target_blocktime) / 8
min_timespan = target_blocktime * 0.75
max_timespan = target_blocktime * 1.5
modulated_timespan = max(min(modulated_timespan, max_timespan), min_timespan)
# Calc new diff
new_diff = current_difficulty * (target_blocktime / modulated_timespan)
return new_diff
This uses the difficulty of the last block and the time difference between the last two blocks. However, the formula is off by 0% - 5%. I tested it with the blocks that are then in the blockchain. Does anyone know the correct formula? (It might have something to do with the fact that most people mine Dogecoin and Litecoin together.)
Thanks in advance
Best regards
Clemens