Skip to content

Instantly share code, notes, and snippets.

View bb111189's full-sized avatar
💭
buidl

Jun Hao Tan bb111189

💭
buidl
View GitHub Profile
@bb111189
bb111189 / zildiff.py
Created February 7, 2019 13:11 — forked from nnamon/zildiff.py
Zilliqa Difficulty Calculations
def to_boundary(diff):
b = ["1"] * 256
for i in range(diff):
b[i] = "0"
return int("".join(b), 2)
def to_hashrate(diff):
boundary = to_boundary(diff)
result = pow(2, 256) / float(boundary)
return result