FairDrops
Developers

Bring your own game

Your game keeps its own look and runs on your servers. FairDrops handles the players, the prize and the proof that nobody cheated.

Report scores from your game

Two steps: install the SDK on your game server, then report each player's score when a session ends.

1

Install the SDK

Terminal
npm install @fairdrops/sdk viem
@fairdrops/sdk on npm
2

Report the scores

report-scores.ts
import { ScoreReporter } from "@fairdrops/sdk/server";
import { privateKeyToAccount } from "viem/accounts";

// Runs on your game's server, never in the browser.
// Keep both keys secret.
const reporter = new ScoreReporter({
  apiUrl: "https://api.fairdrops.app",
  // Created on this page.
  apiKey: process.env.FAIRDROPS_API_KEY,
  // Signs every report. Its address is the
  // reporterAddress you registered for your game.
  reporter: privateKeyToAccount(process.env.REPORTER_KEY),
});

// When a session ends, report each player's score,
// best first. FairDrops checks the signature, then
// pays the winners. Anyone can verify the result.
await reporter.report(sessionId, [
  { player: "0x9f3c…a21b", score: 2310 },
  { player: "0x51d0…7f13", score: 1990 },
]);