HUB
Sign inSign up
relay logo

minmoto/relay

By minmoto

•Updated about 2 hours ago

Image
0

329

minmoto/relay repository overview

⁠Minmo relay

Minmo's Nostr relay for the Pontmore network: strfry⁠ with a write policy that keeps only Pontmore events. It is a fast, close copy of what Minmo's apps read, kept in sync with the public relays, so it speeds things up without becoming a single point of failure.

Operations, rollout and the design rationale are in docs/devops/relay.md⁠.

⁠What it keeps

KindWhatKept when
7300, 7301Swap roots and steps (PIP-02)The root parses under pontmore/swap@1; a step names its root and previous step
7312Escrow quotesSigned by a known operator, naming itself as the escrow; a swap root commits to it and execution reads it back
38383Desk offersIt is a Pontmore offer (other NIP-69 order books share the kind)
30360Agent definitions (PIP-00)Version 1 content with a t=agent tag
30361Escrow descriptors (PIP-01)The descriptor parses and hasn't expired
0, 10002Profiles and relay listsThe author is a known agent, operator or swap participant
30078App dataA minmo/... record (encrypted backups, desk setup), or a swap record (d = root id) signed by an operator
1985Reputation labelsL=pontmore/reputation, signed by an operator
1059Private swap messages (NIP-59)Addressed to a known key

Everything else is refused. A key is known when the relay holds an agent definition, escrow descriptor or offer it signed, or a swap root that names it. The rules reuse @minmo/pontmore's parsers, so the relay accepts what the apps accept.

Swap history is kept indefinitely; it is small and is what swap analytics read. Private messages are pruned after GIFT_WRAP_RETENTION_DAYS (90). Offers expire on their own (NIP-40).

⁠How it runs

One container runs four processes:

  • strfry relay on port 7777, behind Traefik at relay.<env>.minmo.to. Every write goes through /app/write-policy.
  • strfry router streams protocol events down from the public relays as they're published. It streams nothing up: clients publish to every relay in their list themselves, and echoing the backfill up gets the relay's address rate-limited by the public relays.
  • The reconciler (node relay.mjs reconcile), every 10 minutes, copies what the router can't: full history on first start, events missed while the relay was down, and the keyed kinds (profiles, app data, labels, private messages), which can't be streamed by kind alone. It copies through the write policy, so the same rules apply.
  • The pruner deletes private messages past their retention, hourly.

⁠Configuration

VariableDefaultPurpose
PUBLIC_RELAYSwss://nos.lol,wss://relay.primal.net,wss://relay.damus.ioRelays to sync with
WRITES_PER_MINUTE600Events one client address may write per minute; 0 turns it off
RATE_LIMIT_EXEMPTComma-separated client addresses the limit skips
RECONCILE_INTERVAL_SECONDS600Time between reconcile passes
GIFT_WRAP_RETENTION_DAYS90How long private messages are kept
PRUNE_INTERVAL_SECONDS3600Time between pruning passes

⁠Development

npm run build --workspace=@minmo/pontmore
npm run test --workspace=@minmo/relay
npm run typecheck --workspace=@minmo/relay
npm run lint --workspace=@minmo/relay
npm run build --workspace=@minmo/relay   # bundles dist/relay.mjs

Run it locally with Docker (the first build compiles strfry, which takes a few minutes):

docker compose --profile relay up --build relay

It listens on ws://localhost:7777. To have the local API use it, start the API with NOSTR_RELAYS=ws://relay:7777,wss://nos.lol,wss://relay.primal.net,wss://relay.damus.io. To point a dev build of the mobile app at it, set EXPO_PUBLIC_NOSTR_RELAYS the same way with an address the device can reach.

strfry is built from the upstream source at a pinned release commit; to upgrade, change STRFRY_VERSION and STRFRY_COMMIT in the Dockerfile together and compare config/strfry.conf with the new release's default config.

Tag summary

Content type

Image

Digest

sha256:45f986a53…

Size

68.7 MB

Last updated

about 2 hours ago

docker pull minmoto/relay:sha-22d3902