diff --git a/11.md b/11.md index 45102d7..e55f6f8 100644 --- a/11.md +++ b/11.md @@ -267,6 +267,21 @@ A URL pointing to an image to be used as an icon for the relay. Recommended to b } ``` +### NoH endpoints + +URL Paths to NoH endpoints. + +```json +{ + "noh": { + "req": "http://my-relay/__nostr/req", + "publish": "http://my-relay/__nostr/pub", + "auth": "http://my-relay/__nostr/auth" + }, + ... +} +``` + ### Examples As of 2 May 2023 the following command provided these results: diff --git a/200.md b/200.md new file mode 100644 index 0000000..212736b --- /dev/null +++ b/200.md @@ -0,0 +1,46 @@ +NIP-200 +======= + +Nostr relay communication over HTTP(s) (NoH) +-------------------------------------------- + +`draft` `optional` `author:yonle` + +This NIP describes the basic of communicating to relays over HTTP(S) requests. + +## Communication between clients and relays + +Relays may expose NoH endpoints that client could reach. Client may make HTTP requests to each relays endpoint for specified tasks as specified in `noh` field at `/.well-known/nostr.json`. Relays MAY limit number of requests from specific IP/Client/etc. + +### From client to relay: getting events and sending event + +In `noh` field at `/.well-known/nostr.json`, Client could make a request to `req` or `publish` endpoint. + +When fetching events, Client can optionally specify filters directly into the URI search query: +- `?` + +`` is a querystrings that determines what events will be received in that request. it can have the following attributes: + +``` +ids=& +authors=& +kinds=& +%23=& +since=& +until=& +limit= +``` + +Request URL Examples: +- `https://my-relay.com/__nostr/req?kinds=0,1&limit=10` +- `https://my-relay.com/__nostr/req?authors=12345,67890` + +To send event to relay, Client will need to make POST request to `publish` endpoint with POST body containing the JSON of the event. + +### From relay to client: sending responses and notices + +Every NoH response is a JSON body that contain the following JSON field: + +- `status`: Request status code in integer. `0` means OK, `1` means invalid request, `2` means relay error. +- `results`: Array of relay response. Usually contain events requested by client. +- `notice`: Human readable error.