Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
new diff algo
def f(diff, n):
"""
This function returns the new difficulty.
"""
period_count = (n + 1) // 100000
return max(diff + 2**(period_count - 1), 5000)
diff = 6232935860523 # starting diffculty
blocknumber = 200000 # starting blocknumber
numberOfBlocks2years = 2*365*24*60*60/15
for x in range(0, numberOfBlocks2years):
blocknumber = blocknumber + 1
diff = f(diff, blocknumber)
if (blocknumber % (numberOfBlocks2years/24)) == 0:
blocktime = 1.0 * diff / 400000000000 #hashrate
print "Diff after ",str((blocknumber-200000.0) / (numberOfBlocks2years/24)), " month is: ", str(diff), "and avg block time is: ", str(blocktime)
Diff after 0.858447488584475 month is: 6232936262127 and avg block time is: 15.5823406553175
Diff after 1.85844748858447 month is: 6232937670151 and avg block time is: 15.5823441753775
Diff after 2.85844748858448 month is: 6232942111847 and avg block time is: 15.5823552796175
Diff after 3.85844748858448 month is: 6232958188775 and avg block time is: 15.5823954719375
Diff after 4.85844748858448 month is: 6233013075943 and avg block time is: 15.5825326898575
Diff after 5.85844748858448 month is: 6233194531815 and avg block time is: 15.5829863295375
Diff after 6.85844748858448 month is: 6233767984103 and avg block time is: 15.5844199602575
Diff after 7.85844748858448 month is: 6235832384487 and avg block time is: 15.5895809612175
Diff after 8.85844748858447 month is: 6242897263591 and avg block time is: 15.6072431589775
Diff after 9.85844748858447 month is: 6266280901607 and avg block time is: 15.6657022540175
Diff after 10.8584474885845 month is: 6340311940071 and avg block time is: 15.8507798501775
Diff after 11.8584474885845 month is: 6605394050023 and avg block time is: 16.5134851250575
Diff after 12.8584474885845 month is: 7514731740135 and avg block time is: 18.7868293503375
Diff after 13.8584474885845 month is: 10527970065383 and avg block time is: 26.3199251634575
Diff after 14.8584474885845 month is: 20084473625575 and avg block time is: 50.2111840639375
Diff after 15.8584474885845 month is: 54122357881831 and avg block time is: 135.305894704577
Diff after 16.8584474885845 month is: 171161827310567 and avg block time is: 427.904568276417
Diff after 17.8584474885845 month is: 559433313319911 and avg block time is: 1398.58328329978
Diff after 18.8584474885845 month is: 1792973690534887 and avg block time is: 4482.43422633722
Diff after 19.8584474885845 month is: 6163566770682855 and avg block time is: 15408.9169267071
Diff after 20.8584474885845 month is: 21227082229644263 and avg block time is: 53067.7055741107
Diff after 21.8584474885845 month is: 71255685927173095 and avg block time is: 178139.214817933
Diff after 22.8584474885845 month is: 230468268164021223 and avg block time is: 576170.670410053
Diff after 23.8584474885845 month is: 791663401027402727 and avg block time is: 1.97915850256851e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.