Skip to content

Instantly share code, notes, and snippets.

@rwarren
Created May 27, 2021 14:26
Show Gist options
  • Save rwarren/4af163d4d7dde9bcfe4fdd1cd29e4414 to your computer and use it in GitHub Desktop.
Save rwarren/4af163d4d7dde9bcfe4fdd1cd29e4414 to your computer and use it in GitHub Desktop.
Chia stats estimator functions
def daysToWin(netspaceFraction, confidence = 0.95, challengesPerDay = 4608):
losingProbability = 1 - netspaceFraction
challengesToWin = math.log(1 - confidence, losingProbability)
return challengesToWin / challengesPerDay
def earningsPerYear(xchValue_USD, netspaceFraction, confidence = 0.95, challengesPerDay = 4608, xchPerWin = 2):
xchPerDay = xchPerWin / daysToWin(netspaceFraction, confidence, challengesPerDay)
dailyUSD = xchValue_USD * xchPerDay
return dailyUSD * 365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment