buzz-relay using NIP-29 and NIP-42 authentication. The old NIP-28 compatibility proxy has been removed.
Community scope
Buzz treats the relay URL/domain as authoritative for the community. Today’s single-relay deployment has exactly one community behind that URL, so existing NIP-29 clients keep using the same WebSocket URL, event kinds, tags, and HTTP/media/git paths. In a multi-community deployment, each community is reached by its own domain or subdomain; the backend resolves the community from the host before handling AUTH, EVENT, REQ, REST, media, git, search, or workflow traffic. The Nostr wire format does not grow a tenant tag. Client-supplied#h tags still
name channels/groups and are checked against the host-derived community. Events
without #h — profiles, gift-wrapped DMs, membership notifications, lists,
status, long-form notes, workflow/system events, and other “global” streams — are
global only inside the connected community. A pubkey can join multiple
communities and repost its profile in each one; DMs and profiles do not inherit
across community domains.
NIP-29 Direct
Connect any NIP-29 client straight to the relay.Quick Start
What Works
What Doesn’t Work
Pubkey Allowlist
WhenBUZZ_PUBKEY_ALLOWLIST=true, NIP-42 connections that authenticate with only a pubkey
(no API token) are checked against the pubkey_allowlist table. This lets you open the
relay to specific external Nostr identities without granting full access.
- Users with valid API tokens bypass the allowlist.
- Fail-closed: if the DB lookup fails, the connection is denied.
- Default:
false(all authenticated pubkeys accepted). - Auth failure returns generic
auth-required: verification failed(no allowlist-specific message). - Manage the allowlist via direct SQL (no CLI command yet):
Group Discovery
The relay emits NIP-29 group state events when channels are created, updated, or membership changes. All discovery events include ad tag set to the channel UUID (NIP-29 addressable event convention):
Events are stored channel-scoped so access control applies — private channel member lists are
only visible to members. Discover groups via historical REQ:
Note: Channel-scoped storage means live global subscriptions ({kinds:[39000]}) won’t
receive these via fan-out. Clients discover groups via historical REQ queries. Live push for
open-channel discovery is a future enhancement.
Membership Notifications
The relay emits relay-signed notifications when members are added or removed:
Stored community-globally (
channel_id = None inside the connected community) so agents and clients can subscribe without knowing channel
UUIDs in advance. Client-submitted kind:44100/44101 events are rejected — only the relay keypair
may sign these.
Subscription constraint: Global REQs that can match p-gated kinds (44100, 44101, 1059) must include a#pfilter where all#pvalues match the authenticated pubkey. The relay rejects subscriptions that omit#por include other pubkeys (prevents eavesdropping on others’ membership changes and DMs). Error:restricted: p-gated events require #p matching your pubkey.
Sending Messages
Tested Clients (Direct)
Not verified in-repo (anecdotal / expected based on NIP-29 support):
- Chachi (Web/Mobile) — NDK-based; NIP-29 native
- 0xchat (Mobile) — NIP-29 native
Relay Membership (NIP-43)
WhenBUZZ_REQUIRE_RELAY_MEMBERSHIP=true, every authenticated connection is checked against the
relay_members table. In today’s single-community deployment this is the relay-wide member list; in multi-community mode the same rule is scoped to the host-derived community. Only pubkeys with a row for that community may use that community. The relay owner
is bootstrapped automatically from RELAY_OWNER_PUBKEY on startup.
CLI: Managing Members
Usebuzz-admin — the operator CLI shipped in the relay image — to manage relay membership.
In a Docker Compose deployment, use run.sh:
buzz-admin directly inside the container:
Required environment variables for member management:
NIP-43 Admin Events (WebSocket)
Relay membership can also be managed over WebSocket using NIP-43 admin events. These require the sender to be authenticated (NIP-42) as the relay owner or an admin.
Example using
nak:
icon field of its relay
information document. Clients render it in the workspace rail/switcher; anyone
can read it (curl -H 'Accept: application/nostr+json' http://localhost:3000),
but only admins/owners can set it. Full spec:
docs/nips/NIP-WP.md.
Known Limitations
-
CLI intentionally does not emit kind 8000/8001 deltas —
publish_nip43_deltais in-process-only (no Redis hop), so a sidecar call stores but never pushes. The 13534 list snapshot is the authoritative roster and rides Redis to live clients. Do not wire a delta call that passes in-process tests and silently no-ops in the deployedcompose execpath. -
The
custom_created_at = max(now, newest_existing_13534 + 1s)bump defeats same-second domination for serial invocations; it does NOT serialize concurrent CLI processes — two near-simultaneous adds can read the same newest timestamp and collide on the bumped second.run.shserialization is the guard against parallel adds (e.g.xargs -P). When adding multiple members in a loop, addsleep 1between invocations.
Relay Environment Variables (NIP-29 relevant)
Security Notes
Direct Path
- Pubkey allowlist is fail-closed. DB errors deny the connection.
- API token users bypass the allowlist. The allowlist only gates pubkey-only NIP-42.
- kind:9 requires
#htag. Messages without a channel-scoped#htag are rejected. - kind:7 derives channel from target. Reactions look up the target event’s channel via
#e— client-supplied#htags are ignored. Reactions to unknown events are rejected (fail-closed). - kind:5 uses
#hif present, but doesn’t require it. Deletions validate author-match against target events via#etags. Only self-authored events can be deleted (admin deletions use kind:9005). - Client-submitted kind:44100/44101 rejected. Membership notifications can only be signed by the relay keypair.