Requirements

Node.js 18+ (which ships with a built-in global fetch). No extra dependencies are needed for the basic flow.

Generate an outcome

const BASE = "https://api.provable.io";
const clientSeed = "my-app-user-42";

const res = await fetch(
    `${BASE}/api/ints?clientSeed=${encodeURIComponent(clientSeed)}&count=5&min=1&max=100`
);
const data = await res.json();
console.log("outcome:", data.outcome);
console.log("serverHash:", data.serverHash);

Verify it later

const verify = await fetch(
    `${BASE}/api/verifyServerHash?clientSeed=${encodeURIComponent(clientSeed)}&serverHash=${data.serverHash}`
);
const ok = await verify.json();
console.log(ok ? "✅ verified" : "❌ mismatch");

Tips

Next steps

FAQ

What version of Node.js do I need?

Node.js 18 or newer. The quickstart relies on the built-in global fetch, so no extra dependencies are required.

Do I need to install any dependencies?

No. The quickstart uses the built-in fetch in Node 18+ — zero npm installs. If you want a typed wrapper later, the official @provableio/sdk on npm covers every endpoint.

How do I generate random outcomes from Node.js?

Call fetch on https://api.provable.io/api/ints (or /api/floats) with the clientSeed, count, min, and max as query parameters. The JSON response contains the outcome array plus the serverHash you'll publish for verification.

How do I verify an outcome later from Node.js?

Hit GET /api/verifyServerHash with the original clientSeed and the saved serverHash. The endpoint returns true if the hash matches our records for that client seed.

How should I pick a clientSeed?

Use a value that's deterministic and meaningful to your context — a request ID, user ID, hand number, or block hash. The same clientSeed will always reproduce the same outcome for verification.