This is a summary of the full NIP-XX specification.
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.
Current Nostr relay economics are unsustainable:
Relays register on-chain and declare three dimensions:
| Dimension | Unit | Description |
|---|---|---|
| Throughput | events/sec | Maximum event ingestion rate |
| Storage | GB | Available storage for event retention |
| Bandwidth | Mbps | Available bandwidth for query serving |
These combine into a composite score (default weights: 50% throughput, 25% storage, 25% bandwidth).
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.
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.
Dynamic per-event pricing based on relay congestion:
This makes spam economically unviable at scale without requiring content filtering.
| Kind | Description |
|---|---|
39100 | Relay capacity declaration (replaceable) |
39101 | Relay payment receipt |
1100 | Capacity attestation (ephemeral) |
Two contracts implement this NIP:
import * as relay from "@puraxyz/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);The complete NIP-XX specification with all protocol details, message formats, and implementation requirements is in the docs/nips directory.