GLOSSARY.md raw

ORLY Relay Domain Glossary

This glossary defines the ubiquitous language used throughout the ORLY codebase. All contributors should use these terms consistently in code, comments, and documentation.

Core Domain Concepts

Event

A Nostr event as defined in NIP-01. The fundamental unit of data in the Nostr protocol. Contains: id, pubkey, created_at, kind, tags, content, sig.

Serial

A monotonically increasing 40-bit identifier assigned to each event upon storage. Used for efficient range queries, synchronization, and garbage collection ordering.

Pubkey

A 32-byte secp256k1 public key identifying a Nostr user. Stored as binary internally, displayed as 64-character lowercase hex or bech32 npub format externally.

Access Level

The permission tier granted to a pubkey. Determines what operations are allowed.

LevelDescription
noneNo access, authentication required
readRead-only access (REQ allowed, EVENT denied)
writeRead and write access
adminWrite + import/export + arbitrary delete
ownerAdmin + wipe + system configuration
blockedIP address blocked
bannedPubkey banned

ACL (Access Control List)

The authorization system that determines access levels for pubkeys and IP addresses. Supports multiple modes with different authorization strategies.

Event Processing Pipeline

The event processing pipeline transforms incoming WebSocket messages into stored events. Each stage has distinct responsibilities and produces typed results.

Raw JSON → Validation → Authorization → Routing → Processing → Delivery

Validation

The process of verifying event structure, signature, and protocol compliance.

Checks performed:

Authorization

The decision process determining if an event is allowed based on ACL and policy. Returns a structured decision with access level and deny reason.

Routing

Dispatching events to specialized handlers based on event kind. Determines whether events should be processed normally, delivered ephemerally, or handled specially.

Examples:

Processing

The final stage: persisting events, running post-save hooks, and delivering to subscribers. Handles deduplication, replaceable event logic, and event delivery.

ACL Modes

None Mode

Open relay - all pubkeys have write access by default. No authentication required unless explicitly configured via ORLY_AUTH_REQUIRED.

Follows Mode

Whitelist based on admin/owner follow lists (kind 3 events). Followed pubkeys get write access; others get read-only or denied based on configuration. Supports progressive throttling for non-followed users.

Managed Mode

Fine-grained control via NIP-86 management API. Supports pubkey bans, event bans, IP blocks, kind restrictions, and custom rules. All management operations require NIP-98 HTTP authentication.

Curating Mode

Curator-based content moderation system. Curators can approve/reject events from non-followed users. Events from non-curated users are held pending approval.

Protocol Concepts

NIP-42 Authentication

Challenge-response authentication for WebSocket connections. Used to verify pubkey ownership before granting elevated access.

Flow:

  1. Relay sends AUTH challenge with random string
  2. Client signs challenge with private key
  3. Relay verifies signature and grants access level

NIP-70 Protected Events

Events with - (protected) tag that can only be replaced/deleted by the author. Prevents relays from accepting replacements from unauthorized pubkeys.

NIP-43 Relay Access

Invite-based membership system for restricted relays. Supports join requests, leave requests, and membership tracking.

KindPurpose
28934Join request with invite code
28936Leave request
8000Member added (relay-published)

NIP-86 Relay Management

HTTP JSON-RPC API for relay administration. Requires NIP-98 HTTP authentication with admin/owner access level.

NIP-77 Negentropy

Set reconciliation protocol for efficient relay-to-relay synchronization. Uses negentropy algorithm to identify missing events with minimal bandwidth.

Infrastructure Concepts

Publisher

The event delivery system that sends events to subscribers. Composed of multiple publisher implementations (socket, internal, etc.).

Sprocket

External event processing plugin (JavaScript/Rhai script). Can accept, reject, or shadow-reject events before normal processing.

ActionEffect
acceptEvent proceeds to normal processing
rejectEvent rejected with error message
shadowRejectEvent appears accepted but is not stored

Policy Manager

Rule-based event filtering system configured via JSON or kind 30078 events. Evaluates events against configurable rules for allow/deny decisions.

Rate Limiter

PID controller-based adaptive throttling system. Adjusts delays based on system load (memory pressure, write throughput).

Supervisor

Process lifecycle manager for split IPC mode deployment. Manages database, ACL, sync, and relay processes with dependency ordering.

Data Types

EventRef

Stack-allocated event reference with fixed-size ID and pubkey arrays. 80 bytes total, fits in cache line, safe for concurrent use. Immutable - all fields are unexported with accessor methods.

type EventRef struct {
    id  ntypes.EventID // 32 bytes
    pub ntypes.Pubkey  // 32 bytes
    ts  int64          // 8 bytes
    ser uint64         // 8 bytes
}

IdPkTs

Event reference with slice-based fields for backward compatibility. Mutable - use ToEventRef() for safe concurrent access.

type IdPkTs struct {
    Id  []byte   // Event ID
    Pub []byte   // Pubkey
    Ts  int64    // Timestamp
    Ser uint64   // Serial number
}

Decision

Authorization result carrying allowed status, access level, and context. Used to communicate authorization outcomes through the pipeline.

Result (Validation)

Validation outcome with Valid bool, ReasonCode enum, and message string. Codes: ReasonNone, ReasonBlocked, ReasonInvalid, ReasonError.

Result (Processing)

Processing outcome indicating whether event was saved, duplicate, or blocked. Includes error field for unexpected failures.

Subscription Terminology

Note: "Subscription" has two distinct meanings in the codebase:

Event Subscription (REQ)

An active filter receiving matching events in real-time. Created via REQ envelope, cancelled via CLOSE envelope. Stored in Listener.subscriptions map with cancel function.

Payment Subscription

Paid access tier granting elevated permissions for a time period. Managed via NWC payments or manual extension.

Sync Terminology

Spider

Event aggregator that fetches events from external relays. Subscribes to events for followed pubkeys on configured relay lists.

Sync

Peer-to-peer replication between relay instances. Multiple implementations: negentropy, cluster, distributed, relaygroup.

Cluster

Group of relay instances sharing events via HTTP-based pull replication. Membership tracked via kind 39108 events.

Relay Group

Configuration of relay sets for synchronized operation. Tracked via kind 39105 events.

Driver Pattern

Driver

A pluggable implementation of a core interface. Selected at runtime via configuration or command-line flags.

Examples:

// Check if driver is available
database.HasDriver("badger")

// Create instance from driver
db := database.NewFromDriver("badger", config)

Last updated: 2026-01-24 Based on ORLY codebase v0.56.4