# How a gateway and a relay find each other A relay decides which gateways it serves, and that decision must stay the relay's: an open relay is a place anyone can stream bulk chain data through, and the operator pays for it. What can be open is the *information*, so joining does not require an email. ## The relay says who it admits A relay's NIP-11 document (the same one a client reads for its name, contact and limits) carries a `gateways` array: the public keys the policy authorises to announce themselves and to carry tunnel frames. ``` $ curl -sS -H 'Accept: application/nostr+json' https://swaprelay.smesh.lol/ \ | jq '{name, contact, gateways}' { "name": "swaprelay.smesh.lol", "contact": "blake@smesh.lol", "gateways": [ "185624337e5c27e9ccc3ea29a313715097f867dcea21a50be1b54eb2203de8de", "8964ed8cae7cb41286f9dc56344154f9491eace55ad6a18d7fb025ac02ec18a7" ] } ``` The list is derived from the policy, not maintained beside it: `torly` reads the `authors` of the presence rule (kind 30333) and publishes them. A relay whose policy names no gateways omits the field, which is not the same as advertising an empty one — the difference is "this relay says nobody" versus "this build does not say". Nothing secret is exposed. These keys already sign public listings, and a client can read the same set from the listings themselves. ## Three things that become possible without contact - **Another relay operator** reading a peer's document sees exactly which keys to whitelist, ready to paste, instead of asking who runs what. - **A gateway** pointed at a candidate relay asks whether it is already admitted, and can tell its operator "registered" or "not registered, ask blake@smesh.lol" rather than publishing into a refusal and leaving them to guess. `nostrino-gateway` checks every configured relay on each presence cycle and reports it in `health`: ``` "relays": { "wss://swaprelay.smesh.lol": { "name": "swaprelay.smesh.lol", "contact": "blake@smesh.lol", "authorized": true, "checked": "2026-10-26T12:41:07Z" } } ``` - **An operator or a wallet** can list the authorised gateways of any relay: ``` $ nostrino-discover -relay wss://swaprelay.smesh.lol -relays wss://swaprelay.smesh.lol swaprelay.smesh.lol contact=blake@smesh.lol gateways=2 authorized: 185624337e5c27e9ccc3ea29a313715097f867dcea21a50be1b54eb2203de8de authorized: 8964ed8cae7cb41286f9dc56344154f9491eace55ad6a18d7fb025ac02ec18a7 ``` ## What is still the relay's decision Reaching a relay is permissionless in the information sense and gated in the service sense: a gateway that is not on the list can read the document, learn the contact, and ask — but it cannot announce or stream until it is admitted. That keeps an open market of relays possible without an open door for traffic nobody agreed to carry. The gateway's own listing already names the relays it is on, so the two directions together are: - **relay → gateways**: this document's `gateways` field (who may serve here); - **gateway → relays**: the `relay=` entries in its kind-30333 listing (where it does serve). A client that wants to know whether a listing is usable checks the first against the second.