DRats is live: a daily race you can play from Claude or ChatGPT through the ICP MCP connector

Update: an installable web app, a daily reminder sent by the canister, and no more scouting

DRats is one run a day, so the hard part is remembering to come back, and making sure nobody gets a head start on the day. This update covers both.

An installable web app. drats.run now installs like an app: from the browser on Android and desktop, and with Add to Home Screen on iPhone (iOS 16.4 or newer, which is also what Apple requires before a site can send notifications). I chose a web app over the app stores because Apple’s rules don’t allow NFT ownership to unlock features in an app, and in DRats a Rat earns more Rinds and enters the nightly draw. It also keeps sign-in with Plug, OISY and Internet Identity working as before, and updates go live without review.

One reminder a day. One notification at the hour the player picks, and only on days they haven’t run yet. It names their streak and the day’s lucky trait, for example “Your 5-day streak ends at midnight UTC. Today’s lucky trait: Top Hat.” It’s offered after a finished run, and a bell in the header changes the hour or turns it off.

Sent by the canister, with no server. This is the part I’d like feedback on. Web push asks two things of the sender. It signs each request with a P-256 key (VAPID, RFC 8292), and it encrypts the payload for the browser (RFC 8291 with the aes128gcm content coding from RFC 8188, built on ECDH over P-256, HKDF-SHA-256 from RFC 5869 and AES-128-GCM). The canister does all of it in Motoko: P-256 ECDSA with RFC 6979 nonces, ECDH, HMAC, HKDF and AES-128-GCM. It reproduces the worked example in RFC 8291 byte for byte and matches the published test vectors for each of those pieces. Each due reminder goes out as a non-replicated HTTPS outcall (is_replicated = opt false), so the push service gets one request rather than one per replica. The replica that sends it sees only the encrypted payload and a VAPID token that works for that one push service for 12 hours.

Endpoints have to be plain https URLs on the big browsers’ push services (Google, Mozilla, Apple and Microsoft). The host is checked strictly, with no room for a user name, port, query or fragment, when a reminder is set and again before every send. So a player can’t aim the canister’s outcalls anywhere else.

The key, and where it could go next. For now the VAPID private key lives in canister memory. DFINITY’s security docs say node operators on application subnets can read canister memory, so I don’t treat this key as secret from them. Anyone who could read that state would also have the stored subscriptions, so they could send notifications that look like they come from DRats. The key has no other power: it isn’t used for sign-in, Rinds, Rats or any token.

P-256 threshold ECDSA is arriving on the IC: DFINITY merged it in October, and mainnet key_1 and test_key_1 keys on secp256r1 exist. Once signing with them is confirmed live, I plan to move the VAPID key there, so no single node ever holds it. If anyone has already called sign_with_ecdsa with secp256r1 on mainnet, I’d like to hear how it went.

No more scouting, from 20 Nov. Until now every player has raced the same track with the same hidden slip rolls, seeing only the segment they’re on and the next one. Starting 20 Nov, 00:00 UTC, that changes:

  • Everyone sees the whole map of 10 segments from the first move. The map is still new each day and the same for everyone.
  • Each player’s slip rolls are their own: HMAC-SHA-256 of the day’s secret with “DRats luck”, the player’s principal and a counter. A spare account only ever learns its own rolls.
  • The secret is 32 bytes from raw_rand. Its SHA-256 is public from the first run of the day, and the bytes are published after midnight, so anyone can rebuild any player’s rolls and replay their run with verifyRun(day, player, moves). Earlier days keep the old shared track and still verify as before.

The secret sits in canister memory during the day, with the same node operator caveat as the key above. Drawing each roll with raw_rand at the moment of the move would avoid holding future rolls at all, at the cost of slower moves. I’d be glad of views on which way suits a game like this better.

Smaller changes.

  • Sign out on all devices: one tap ends every browser key linked to a Plug or OISY wallet, and a page still using one is told to connect again.
  • An X post now counts only if X’s own embed names its author.
  • The Rat ownership check gives up after 10 seconds instead of waiting on the Rats canister indefinitely.
  • The weekly ticket draw uses its own random number, separate from the league pick, and league ties are listed in Runner Card order.

API. New: setReminder(subscription, hourUtc), stopReminder(), myReminder(), pushKey(), reminderStats(), endAllSessions(), personalLuckFrom(), revealedTrackOf(day, player) and verifyRun(day, player, moves). getApiDoc() covers all of it, including how to rebuild a player’s rolls. A reminder needs a browser, so Claude or ChatGPT can explain it but can’t turn it on for a player.

A giveaway running now. MoonRail NFTs is giving away 10 DRats and 5 ICP until 23 Nov, 23:59 UTC. Each day you post your run card counts as an entry: Join Giveaway Here

Play: https://drats.run