Guide

    Relays & Infrastructure

    What are Relays?

    Understanding the backbone of nostr - relay servers and how they work.

    2 min read

    Relays are the backbone of the Nostr network. They are simple servers that store and forward Nostr events. Think of them as the post offices of the Nostr ecosystem - they receive messages (events) from users and deliver them to other users who are interested in receiving them.

    How Relays Work

    When you publish a note on Nostr, your client sends that note to one or more relays. These relays then store your note and make it available to anyone who queries for it. When someone wants to see your notes, their client asks relays for events from your public key.

    The beauty of this system is that it's decentralized. There's no single company or entity that controls all the relays. Anyone can run a relay, and users can choose which relays to use.

    Types of Relays

    Public Relays

    These are open relays that anyone can read from and write to. Examples include:

    • relay.damus.io
    • relay.snort.social
    • nostr.wine
    • relay.nostr.band

    Private Relays

    These relays restrict who can write to them, but may allow anyone to read. This is useful for:

    • Personal backup of your own notes
    • Family or group communication
    • Reducing spam and noise

    Paid Relays

    Some relays charge a small fee (usually in Bitcoin via Lightning) to write events. This helps:

    • Reduce spam
    • Cover server costs
    • Ensure quality content

    Choosing Relays

    Most Nostr clients come with a default set of relays, but you can customize your relay list. Consider:

    • Geographic location: Closer relays may be faster
    • Reliability: Some relays have better uptime than others
    • Policies: Different relays have different content policies
    • Speed: Some relays are faster at storing and retrieving events

    Running Your Own Relay

    Running your own relay gives you complete control over your data. Popular relay software includes:

    • Nostream (Node.js)
    • Strfry (C++)
    • Relay (Go)

    Benefits of running your own relay:

    • Complete control over your data
    • No censorship concerns
    • Can serve as backup for your content
    • Can be shared with family/friends

    Relay Discovery

    Nostr uses several methods for relay discovery:

    • NIP-65 (Relay List Metadata) - users publish their preferred relays
    • NIP-05 (DNS-based verification) - domain names can specify relays
    • Word of mouth and recommendations
    • Relay directories and lists

    Remember: relays are just dumb servers. They don't understand the content they're storing - they just store and forward events based on simple filters. This simplicity is what makes Nostr so robust and censorship-resistant.

    Related Guides

    Guide

    What is the Outbox Model?

    Learn about the outbox model for improved relay management and content discovery.

    Nostrich - Nostr Mascot

    Found this guide helpful?

    Support Derek's work by following him on Nostr and sharing these guides with others.