Find the servers that carry your posts

Relays carry Nostr posts, profiles and replies. Instead of making every app ask you to choose servers again, Loopy can read the relay preferences your account already publishes and check where to send and retrieve events.

Find signed NIP-65 relay lists

import { Nostr } from '@chaoticka/nsite-loopy-sdk';
const result = await Nostr.discoverRelays(pubkey, {
  bootstrap: bootstrapRelays,
  query: Nostr.queryRelay,
  defaults: configuredFallbackRelays,
  max: 8,
});
console.log(result.relays, result.errors);

A signed replaceable kind: 10002 event supplies r tags with read / write roles. Use an author's write relays to find their posts; use recipient-read relays when delivering mentions. An endpoint directory alone cannot prove relay health.

Inspect policies and try the actual operation

const info = await Nostr.relayInfo(relayUrl); // NIP-11 metadata
const results = await Nostr.queryRelay(relayUrl, { kinds: [1], limit: 20 });

NIP-11 metadata is advisory. A relay may enforce NIP-42 authentication, payments, policy or size limits. Nostr.publishRelay() waits for a relay OK and readback; Nostr.publishMany() returns per-relay receipts and failures.

Common failure states

  • Empty EOSE result is not the same as a network failure.
  • Acceptance on one relay does not prove successful replication everywhere.
  • A signature-verified duplicate is deduplicated by event ID.
  • A failed readback must not be displayed as a durable publication.

Relay API · Security and verification