No description
  • Go 96.8%
  • Dockerfile 3.2%
Find a file
@s.roertgen ff85bd44e9
All checks were successful
Build and Push Docker Image / build (push) Successful in 6m4s
Allow negentropy sync with broad filters
NoEmptyFilters was blocking negentropy sessions that send
filters without kinds/authors/ids. Skip the check for
negentropy sessions so strfry and other tools can sync.
2026-03-09 09:53:12 +01:00
.forgejo/workflows Initial commit: Standard Nostr relay with NIP-86 management API 2026-02-12 13:18:31 +01:00
.dockerignore Initial commit: Standard Nostr relay with NIP-86 management API 2026-02-12 13:18:31 +01:00
.env.example Add SERVICE_URL env var to fix NIP-98 auth behind reverse proxy 2026-03-03 15:46:35 +01:00
.gitignore Initial commit: Standard Nostr relay with NIP-86 management API 2026-02-12 13:18:31 +01:00
docker-compose.yml Initial commit: Standard Nostr relay with NIP-86 management API 2026-02-12 13:18:31 +01:00
Dockerfile Initial commit: Standard Nostr relay with NIP-86 management API 2026-02-12 13:18:31 +01:00
go.mod Update nostrlib to pick up upstream relay refactor 2026-03-05 14:24:51 +01:00
go.sum Update nostrlib to pick up upstream relay refactor 2026-03-05 14:24:51 +01:00
main.go Allow negentropy sync with broad filters 2026-03-09 09:53:12 +01:00
management.go Initial commit: Standard Nostr relay with NIP-86 management API 2026-02-12 13:18:31 +01:00
README.md Add SERVICE_URL env var to fix NIP-98 auth behind reverse proxy 2026-03-03 15:46:35 +01:00

Standard-86-Relay

A standard Nostr relay with NIP-86 Management API support built on khatru.

Features

  • NIP-86 Management API: Full support for relay management via HTTP/JSON-RPC
  • NIP-98 Authentication: Secure admin authentication using signed Nostr events
  • BoltDB Storage: Embedded key-value storage for events and management data
  • Negentropy Sync: Efficient event synchronization with other relays
  • Dual Mode Operation: Choose between blacklist (ban) or allowlist (whitelist) modes

Environment Variables

Variable Description Default
PUBKEY Relay operator pubkey (hex format) - becomes the primary admin Required
ADMIN_PUBKEYS Additional admin pubkeys (comma-separated hex) Optional
NAME Relay name (NIP-11) Standard Relay
DESCRIPTION Relay description (NIP-11) Empty
ICON Relay icon URL (NIP-11) Empty
SERVICE_URL Public-facing WebSocket URL (e.g. wss://your-relay.example.com). Set when behind a reverse proxy so NIP-98 auth uses the correct URL auto-detected
PORT HTTP server port 3334
DB_PATH Path to BoltDB database file ./data/relay.db
ALLOWLIST_MODE Enable allowlist mode (true/false) false

Operating Modes

Blacklist Mode (Default)

In blacklist mode, all pubkeys can publish events unless explicitly banned:

  • Use banpubkey to block a pubkey from publishing
  • Use allowpubkey to unban a previously banned pubkey
  • listbannedpubkeys returns all banned pubkeys

Allowlist Mode

When ALLOWLIST_MODE=true, only explicitly allowed pubkeys can publish:

  • On startup, operator and admin pubkeys are automatically added to the allowlist
  • Use allowpubkey to add a pubkey to the allowlist
  • Use listallowedpubkeys to view all allowed pubkeys
  • Pubkeys not in the allowlist receive "pubkey not in allowlist" rejection

NIP-86 API Methods

All methods require NIP-98 authentication with an admin pubkey.

Pubkey Management

Method Description
banpubkey Ban a pubkey from publishing (params: [pubkey, reason?])
allowpubkey Add to allowlist AND remove from ban list (params: [pubkey, reason?])
listbannedpubkeys List all banned pubkeys with reasons
listallowedpubkeys List all allowed pubkeys with reasons

Event Management

Method Description
banevent Ban an event by ID (params: [id, reason?])
allowevent Remove event from ban list (params: [id, reason?])
listbannedevents List all banned event IDs with reasons

Relay Configuration

Method Description
changerelayname Update relay name (params: [name])
changerelaydescription Update relay description (params: [description])
changerelayicon Update relay icon URL (params: [url])

Admin Management

Method Description
grantadmin Grant admin access to a pubkey (params: [pubkey, methods?])
revokeadmin Revoke admin access (params: [pubkey, methods?])

Quick Start

Using Docker

docker build -t standard-86-relay .
docker run -d \
  -e PUBKEY=your_hex_pubkey \
  -e NAME="My Relay" \
  -p 3334:3334 \
  -v relay-data:/app/data \
  standard-86-relay

Using Docker Compose

cp .env.example .env
# Edit .env with your pubkey and settings
docker compose up -d

From Source

go build -o relay .
PUBKEY=your_hex_pubkey ./relay

Example API Call

# Create NIP-98 auth event and call API
curl -X POST http://localhost:3334 \
  -H "Content-Type: application/nostr+json+rpc" \
  -H "Authorization: Nostr <base64-encoded-signed-event>" \
  -d '{"method":"listbannedpubkeys","params":[]}'