Nostrfi Relay 0.3.0: run a relay as a team, without sharing a key

· Nostrfi

Nostrfi Relay 0.3.0 is out. It lets the relay's owner give other people administrator rights, so a team can run one relay without passing a private key around. It also stops storing events that Nostr says should not be stored, and closes a way that operator signatures could be replayed.

Read how to upgrade before you deploy. This release deletes stored ephemeral events on its first start, and it needs to know the relay's public address before it accepts operator requests.

Run a relay as a team

Until now, a Nostrfi relay had one operator key. Anyone who moderated the relay or opened the dashboard signed with that key, so a team either shared it or left one person to do everything.

In 0.3.0 the owner can grant the administrator role to other pubkeys. Administrators sign in to the dashboard and sign every request with their own key. The owner grants and revokes the role with the NIP-86 assignrole and unassignrole methods, from the dashboard or any NIP-86 client.

What each role can do:

OwnerAdministrator
Ban pubkeys and events, block IPsYesYes
Browse stored events and statisticsYesYes
Grant and revoke administratorsYesNo
Read the relay's configurationYesNo

The relay, not the dashboard, decides who may sign in. At sign-in your signer asks you to approve twice: once to prove who you are, and once to ask the relay which role your key holds. If you revoke an administrator, the relay refuses their next request and the dashboard signs them out.

Administrators are trusted with a lot. They can read every stored event and ban or block anything. They can't lock the owner out, and the owner can undo anything they do. The administrators section explains the details, including what to check after you change the owner key.

Ephemeral events are no longer stored

Nostr treats kinds 20000–29999 as ephemeral: relays pass them on to whoever is subscribed and are not expected to keep them. Nostrfi Relay used to store them anyway. In production, kind 20001 presence heartbeats were a large share of the stored rows. They had no value once delivered, and they built up a record of when people were online.

From 0.3.0 the relay delivers ephemeral events to open subscriptions and never writes them to the database or its backups. On its first start it deletes the ones it stored before. A new metric, relay_events_ephemeral_total, counts them, so you can still see the traffic.

The relay also refuses NIP-42 authentication events (kind 22242) sent as ordinary events. They belong in AUTH messages, and the relay used to store and broadcast them.

Operator signatures are bound to this relay

Every operator request is signed with NIP-98. The relay used to check only the path in the signature, not the host. So a malicious website could ask your browser extension to sign a request for its own address, at a matching path, and replay that signature at your relay. With administrators in this release, that could have granted an attacker a permanent role.

In 0.3.0 a signature must name this relay's own address, and each one is accepted once. A replayed signature gets the same answer as an unknown key, so it doesn't reveal whether the signer holds a role (nostrfi/relay#60).

The release also tightens dashboard sessions. Signing out really ends the session, signing in again ends the previous one, and restarting the dashboard ends every session.

Upgrading

  1. Back up first, with your current binary. The first start of 0.3.0 deletes stored ephemeral events. If you want to keep them, take the backup with 0.2.0's -backup, or copy db/relay.db while the relay is stopped. A backup taken with 0.3.0 runs the deletion first.
  2. Tell the relay its public address. It now refuses every operator request, including dashboard sign-in, until it knows its own origin. With the TLS overlay, add RELAY_URL=wss://your-domain to .env. Without the overlay, set auth.relay_url in config.yaml.
  3. Remove NUXT_ADMIN_PUBKEY from the dashboard's environment. The dashboard now asks the relay who the owner is.
  4. Sign in again after the upgrade. Older sessions don't carry a role.

The prebuilt relay-linux-amd64 binary now needs glibc 2.36 or newer, so it runs on Debian 12 and Ubuntu 24.04.

The changelog has the full list for operators, and the release notes on GitHub list every commit.

Still true

The relay still runs as a single instance, by design. Nostr gets its redundancy from clients using several relays, so most operators never need to scale one out. Search is still unranked, there is no encryption at rest, and TLS belongs to the reverse proxy. The current limitations page has the full list and the reasons.

Get it

New to Nostrfi Relay? The quickstart gets a relay, its dashboard and TLS running with Docker Compose in about ten minutes. The source is on GitHub, and issues and questions are welcome there.