Install

pip install requests

Generate random integers

import requests

BASE = "https://api.provable.io"
client_seed = "my-app-user-42"

res = requests.get(
    f"{BASE}/api/ints",
    params={"clientSeed": client_seed, "count": 5, "min": 1, "max": 100},
)
data = res.json()
print("outcome:", data["outcome"])
print("serverHash:", data["serverHash"])

Verify the outcome later

verify = requests.get(
    f"{BASE}/api/verifyServerHash",
    params={"clientSeed": client_seed, "serverHash": data["serverHash"]},
)
print("verified" if verify.json() else "mismatch")

Tips

Next steps

FAQ

What dependencies do I need for the Python quickstart?

Python 3.8+ and the requests library (pip install requests). The standard library urllib will also work if you'd rather not add a dependency.

How do I generate random integers from Python?

requests.get('https://api.provable.io/api/ints', params={'clientSeed': ..., 'count': N, 'min': a, 'max': b}).json() returns the outcome array plus the serverHash for later verification.

How do I verify an outcome from Python?

Call requests.get('https://api.provable.io/api/verifyServerHash', params={'clientSeed': ..., 'serverHash': ...}). A truthy JSON response confirms the hash matches our records.

How should I pick a clientSeed?

Use a deterministic, meaningful value: a request ID, a user ID, a campaign slug, a future block hash. The same clientSeed always reproduces the same outcome — that's what makes verification possible.