NIP-XX: Backpressure Relay Economics

This is a summary of the full NIP-XX specification.

Abstract

NIP-XX defines an economic layer for Nostr relays using backpressure-based resource allocation. Relays declare multi-dimensional capacity (throughput, storage, bandwidth) that is verified and smoothed on-chain, enabling proportional payment distribution via streaming micropayments.

Problem

Current Nostr relay economics are unsustainable:

How It Works

1. Capacity Declaration

Relays register on-chain and declare three dimensions:

DimensionUnitDescription
Throughputevents/secMaximum event ingestion rate
StorageGBAvailable storage for event retention
BandwidthMbpsAvailable bandwidth for query serving

These combine into a composite score (default weights: 50% throughput, 25% storage, 25% bandwidth).

2. Capacity Verification

Relay capacity claims are verified through EIP-712 signed attestations, EWMA-smoothed (α = 0.3) for stability. Attestations that differ more than 50% from the current smoothed value are dampened to resist manipulation.

3. Payment Distribution

A Superfluid GDA pool distributes streaming payments proportional to verified capacity. Relays that meet the anti-spam minimum receive continuous micropayments from users publishing events.

4. Anti-Spam Pricing

Dynamic per-event pricing based on relay congestion:

This makes spam economically unviable at scale without requiring content filtering.

New Event Kinds

KindDescription
39100Relay capacity declaration (replaceable)
39101Relay payment receipt
1100Capacity attestation (ephemeral)

Contracts

Two contracts implement this NIP:

SDK Support

import * as relay from "@backproto/sdk/actions/relay";

// Register a relay
await relay.registerRelay(walletClient, addrs, "wss://relay.example.com", 100n);

// Set anti-spam minimum
await relay.setAntiSpamMinimum(walletClient, addrs, 50n);

// Read composite capacity
const cap = await relay.getCompositeCapacity(publicClient, addrs, relayAddress);

Full Specification

The complete NIP-XX specification with all protocol details, message formats, and implementation requirements is in the docs/nips directory.


See Also