upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--20.md63
-rw-r--r--README.md2
2 files changed, 65 insertions, 0 deletions
diff --git a/20.md b/20.md
new file mode 100644
index 0000000..1f06fa9
--- /dev/null
+++ b/20.md
@@ -0,0 +1,63 @@
1NIP-20
2======
3
4
5Command Results
6---------------
7
8`draft` `optional` `author:jb55`
9
10When submitting events to relays, clients currently have no way to know if an event was successfully committed to the database. This NIP introduces the concept of command results which are like NOTICE's except provide more information about if an event was accepted or rejected.
11
12A command result is a JSON object with the following structure that is returned when an event is successfully saved to the database or rejected:
13
14 ["OK", <event_id>, <true|false>, <message>]
15
16Relays MUST return `true` when the event is a duplicate and has already been saved. The `message` SHOULD start with `duplicate:` in this case.
17
18Relays MUST return `false` when the event was rejected and not saved.
19
20The `message` SHOULD provide additional information as to why the command succeeded or failed.
21
22The `message` SHOULD start with `blocked:` if the pubkey or network address has been blocked, banned or is not on a whitelist.
23
24The `message` SHOULD start with `rate-limited:` if the event was rejected due to rate limiting techniques.
25
26Ephemeral events are not acknowledged with OK responses, unless there is a failure.
27
28If the event is malformed and could not be parsed, a NOTICE message SHOULD be used instead of a command result.
29
30
31Examples
32--------
33
34Event successfully written to the database:
35
36 ["OK", "b1a649ebe8b435ec71d3784793f3bbf4b93e64e17568a741aecd4c7ddeafce30", true, ""]
37
38Event successfully written to the database because of a reason:
39
40 ["OK", "b1a649ebe8b435ec71d3784793f3bbf4b93e64e17568a741aecd4c7ddeafce30", true, "pow: difficulty 25>=24"]
41
42Event blocked due to ip filter
43
44 ["OK", "b1a649ebe8...", false, "blocked: tor exit nodes not allowed"]
45
46Event blocked due to pubkey ban
47
48 ["OK", "b1a649ebe8...", false, "blocked: you are banned from posting here"]
49
50Event blocked, pubkey not registered
51
52 ["OK", "b1a649ebe8...", false, "blocked: please register your pubkey at https://my-expensive-relay.example.com"]
53
54Event rejected, rate limited
55
56 ["OK", "b1a649ebe8...", false, "rate-limited: slow down there chief"]
57
58
59
60Future Extensions
61-----------------
62
63This proposal SHOULD be extended to support futher commands in the future, such as REQ and AUTH. They are left out of this initial version to keep things simpler.
diff --git a/README.md b/README.md
index d974dd3..8b3a994 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
18- [NIP-14: Subject tag in text events.](14.md) 18- [NIP-14: Subject tag in text events.](14.md)
19- [NIP-15: End of Stored Events Notice](15.md) 19- [NIP-15: End of Stored Events Notice](15.md)
20- [NIP-16: Event Treatment](16.md) 20- [NIP-16: Event Treatment](16.md)
21- [NIP-20: Command Results](20.md)
21- [NIP-22: Event created_at Limits](22.md) 22- [NIP-22: Event created_at Limits](22.md)
22- [NIP-25: Reactions](25.md) 23- [NIP-25: Reactions](25.md)
23- [NIP-28: Public Chat](28.md) 24- [NIP-28: Public Chat](28.md)
@@ -58,6 +59,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
58| EVENT | used to send events requested to clients | [1](01.md) | 59| EVENT | used to send events requested to clients | [1](01.md) |
59| NOTICE | used to send human-readable messages to clients | [1](01.md) | 60| NOTICE | used to send human-readable messages to clients | [1](01.md) |
60| EOSE | used to notify clients all stored events have been sent | [15](15.md) | 61| EOSE | used to notify clients all stored events have been sent | [15](15.md) |
62| OK | used to notify clients if an EVENT was successuful | [20](20.md) |
61 63
62Please update these lists when proposing NIPs introducing new event kinds. 64Please update these lists when proposing NIPs introducing new event kinds.
63 65