example-leaderboard-dapp
Installation
SKILL.md
Midnight Network Leaderboard DApp
A privacy-preserving leaderboard where players submit scores on-chain with three display modes and prove they own an entry using verifyOwnership — a ZK circuit that checks ownerCommitment(secretKey) matches the stored ownerHash without revealing the secret.
Runnable template: Copy templates/leaderboard-dapp/ for a complete Next.js project (contract + UI). Run npm install && npm run compact && npm run sync:assets && npm run dev after installing the 1AM wallet.
What this skill produces:
contract/— Compact leaderboard + TypeScript witnesses + compile scriptsapp/leaderboard/— Next.js client UI (click game, privacy mode picker, leaderboard table)lib/midnight.ts— wallet session + patched indexer provider (copy fromreferences/midnight-session.mdortemplates/leaderboard-dapp/lib/midnight.ts)lib/leaderboard.ts— deploy,submitScore,verifyOwnership, ledger decodelib/display-name.ts— decode anonymous hash bytes to generated names ("Crimson Tiger")public/zk/leaderboard/— ZK proving assets synced from contract build
Shared references (canonical provider + troubleshooting — do not duplicate in prompts):
references/midnight-session.md—createConnectedSession, indexer patch, deploy/call helpersreferences/gotchas.md— preprod deploy hangs, GraphQLoffset: null, ZK asset pathsreferences/versions.json— pinned@midnight-ntwrk/*versions