Your own relay is coming. Reserve yours, no payment

What is a Nostr relay?

A relay is a server that stores signed Nostr events and hands them to anyone who asks. Your app sends your notes to a few relays; other people's apps fetch them from there. No relay owns your account: your key does.

By · Last updated

What a relay does

Nostr has two kinds of program: clients (the apps you use) and relays (the servers). A client opens a WebSocket to a relay and speaks a small JSON protocol defined in NIP-01. It sends three kinds of message:

  • EVENT publishes something you signed: a note, a profile update, a reaction.
  • REQ asks for events matching a filter ("the last 50 notes from these 200 people") and keeps the subscription open for new ones.
  • CLOSE ends that subscription.

The relay answers with the matching events, then EOSE ("end of stored events") once it has sent what it has. After that it streams new events as they arrive. When you publish, it replies OK with true or false, and a reason when it refuses.

That is most of it. The protocol doesn't make relays talk to each other (some operators sync theirs, by choice), and a relay doesn't decide what your feed looks like. Your app does that, by asking several relays and merging what comes back.

Why there are so many

Anyone can run a relay, and apps connect to several at once. As of the date in the box, our monitor knows 1,429 public relays, and 1,277 of them answered our last check. Your app publishes each note to several of them, so one relay going away doesn't take your notes with it.

To find your notes, other apps need to know which relays you use. NIP-65 handles that: you publish a "relay list" event (kind 10002) naming the relays you write to and read from, and apps fetch your notes from your write relays. This is often called the outbox model. Most apps set it up for you in their relay settings.

What a relay can and can't do

Every event is signed with the author's private key (Schnorr signatures on secp256k1, per NIP-01), and its id is a hash of its content. So a relay can't change your note or post as you: any app would see the signature fail.

A relay can:

  • refuse to store your events, or stop serving them;
  • delete what it holds, whenever it likes;
  • charge for access, or only accept people it knows;
  • go offline without warning.

Deleting is a request, not a command. NIP-09 defines a "deletion request" (kind 5); relays should honour it, but the spec itself says deletion can't be guaranteed, because copies may already sit on relays and devices you don't control.

Free, paid and private relays

Most public relays are free to read and write. Some charge an admission fee to cut spam, and some only accept their members. A relay says which in its information document (below): payment_required and auth_required. Of the relays that state it, 11% say they require payment and 10% require you to authenticate.

Authentication is NIP-42: the relay sends a challenge, and your app signs it with your key to prove who you are. Private relays use it to let in only their owner, or a list of people.

What relays run

A relay is a program, and a handful of programs run most of the network. Of the relays that name their software, strfry runs 28%, nostr-rs-relay runs 16%, haven runs 14% and pyramid runs 6%. Compare relay software to see versions and uptime for each.

How to see what a relay says about itself

Every relay can publish a JSON document about itself (NIP-11): its name, operator, contact, the NIPs it supports, its software and version, and its limits. You get it from the relay's own address over HTTPS, with one header:

Terminal
curl -H "Accept: application/nostr+json" https://nos.lol

Our monitor reads this document from every relay. Each relay's page on the relay list shows it in the About tab, next to its uptime and speed.

Choosing relays

Your app picks defaults, and they're usually fine. If you want to choose, look for relays that stay up and answer quickly from where you are, and keep one or two that you trust to keep your notes. The relay list ranks every public relay by 30-day uptime.

A relay of your own is the surest place for your notes, because you decide what it keeps. It's also a server someone has to keep running. Running a relay covers what that takes, and the option of having us host one for you.