About
Photo Finish: race your friends, and the chain calls the photo finish.
A puzzle race for 2 to 8 players on QoreChain. Most multiplayer games trust a server to start everyone together, keep the clock and say who won. Photo Finish hands all three to the chain:
- The start block deals. When the host starts, that transaction's hash picks the puzzles (or scrambles the board), so nobody, the host included, can prepare. Every screen counts down from the same block.
- Finishes are sealed. When you're done, one transaction carries sha256(race, your address, your answers). Players still racing can't read your answers, and nobody can copy your finish.
- Block order is the photo finish. Places are the order of the finish transactions, not anyone's clock.
- After the race, answers open and every screen checks them. A place counts only once it checks.
Two sections:
- Quick puzzles: Riddles, Unscramble, Math sprint (sums made from the start hash itself, no bank) and Emoji. Five puzzles each.
- Games: Word guess (crack three hidden words of 4, 5 or 6 letters; every guess must be a real word; each letter shows right spot, wrong spot or not in it) and Block puzzle (one sliding board, 3x3 or 4x4, the same for everyone).
It plays like a game: coloured racers move along a photo-finish strip, tiles flip, blocks slide, the countdown pulses, your finish gets a camera flash, and the results end on a podium. Every move is a hybrid-signed (secp256k1 + ML-DSA-87) transaction from QoreX. Racing alone? Add two bots whose moves are hybrid-signed too.
Try it: open https://photo-finish-neon.vercel.app in the QoreX app's browser on testnet, pick a mode, host a race, add two bots and press Start.
Code: https://github.com/frankclaw66-create/photo-finish
How it's made
Scaffolded with create-qorechain-dapp (fullstack-web: Vite + React + TypeScript + @qorechain/sdk).
Architecture
A race is a mailbox address derived from its code (bech32 of sha256("photo-finish/race/<code>")). Every move is a 1 uqor MsgSend to it with a memo: open (with the mode and its option), join, go, done (a SHA-256 commitment) and show (the answers, after the race). Every screen reads these transactions every 1.5 s and applies the same rules in block order (src/lib/race.ts): who joined before the start, who finished within the limit, whose shown answers match their sealed finish. Moves out of turn are ignored and listed in the "Moves on chain" drawer.
Kits and network features
- create-qorechain-dapp scaffold; @qorechain/sdk reads the player's balance in the lobby.
- QoreX: connect, then signAndBroadcast for every player move, hybrid-signed with ML-DSA-87. Each move shows its lifecycle (Confirm in QoreX, Submitted, In a block), and the board marks each transaction's PQCHybridSignature.
- QoreSign: the bots sign with signHybrid, and their ML-DSA-87 keys were registered with MsgRegisterPQCKey and proof of possession.
How each mode stays fair
- Riddles, Unscramble, Emoji: banks stay on the server and are released only once the start transaction is in a block, picked by its hash. Players check answers in the browser against hashes salted per race.
- Math sprint: sums are generated from the start hash itself, so there's no bank to leak.
- Word guess: the server marks each guess (right spot, wrong spot, not in the word) and checks it's a real word, so the answers never reach the page.
- Block puzzle: every screen derives the same scrambled board from the start hash. A finish seals the move list (packed 2 bits per move to fit a memo); after the race every screen replays the moves and checks they solve the board. No server involved.
The server never decides who won: the chain does.
Design
The interface ports the Slit-scan design: a photo-finish camera records one line over time, so the board is a strip with time running left to right from the start block, a lane per player and a vermilion mark where each finish landed. Vermilion means one thing only: in a block. On top sits a game layer: player colours and moving racers, flipping word tiles, sliding blocks, a pulsing countdown and GO, a camera flash on your finish, a podium, and optional sound.
What was hard
- A fair shared start without a server clock: the countdown runs from the start block's timestamp, and places come only from block order.
- Sealing finishes so nobody can copy answers mid-race, while every answer can still be checked afterwards: a commitment that includes the player's address, opened after the race ends.
- Keeping answers secret in games: word guesses are marked on the server, and block-puzzle finishes are checked by replaying the moves.
Testing
A Playwright race (e2e/race.ts) with a stand-in wallet that signs real hybrid transactions hosts, adds the bots, starts, solves, finishes, shows answers and checks the board, on testnet, in every mode, including against the live site. It caught real bugs before users could: a bot timer that never fired, a host not recognised after hosting, guesses landing on an already-solved word, and answer checking that had stopped running in some modes. The demo video is a real race on the live site, signed by a labelled test wallet standing in for the QoreX app.
Built solo with Claude Code (Opus 5.5) as pair programmer; details in AI_USAGE.md.