Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
verify stake.com limbo outcome with python
import hmac
import hashlib
def getLimboOutcome(server, client, nonce):
server = server.encode()
client = client.encode()
nonce = str(nonce).encode()
round = 0
hash = hmac.new(server, client+b':'+nonce+b':'+str(round).encode('utf-8'), hashlib.sha256).digest()
first4 = hash[:4]
x = 1
total = 0
for byt in first4:
total += int(byt) / (256 ** x)
x += 1
total *= 16777216
outcome = 16777216 / (total + 1) * (1 - 0.01)
return outcome
import secrets
server = secrets.token_hex(32)
client = secrets.token_urlsafe(8)
nonce = 1
outcome = getLimboOutcome(server, client, nonce)
print(f"server: {server}\nclient: {client}\nnonce: {nonce}\nlimbo outcome: {outcome:.2f}x")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment