diff options
| author | fiatjaf <fiatjaf@gmail.com> | 2024-09-17 11:03:56 -0300 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2024-09-17 11:04:01 -0300 |
| commit | d534bade7184966df7335a8867b97cd879ee58cd (patch) | |
| tree | 0babb24d7924ec4a2ed20aba553f206929840980 /88.md | |
| parent | 4bf0c011445bea44277202e0619053c0a423c342 (diff) | |
renumber polls NIP to 88.
this one: https://github.com/nostr-protocol/nips/pull/1346
Diffstat (limited to '88.md')
| -rw-r--r-- | 88.md | 92 |
1 files changed, 92 insertions, 0 deletions
| @@ -0,0 +1,92 @@ | |||
| 1 | # NIP-88 | ||
| 2 | |||
| 3 | ## Polls | ||
| 4 | |||
| 5 | `draft` `optional` | ||
| 6 | |||
| 7 | This NIP defines the event scheme that describe Polls on nostr. | ||
| 8 | |||
| 9 | The NIP makes the following tradeoffs. | ||
| 10 | |||
| 11 | 1. All votes are public. | ||
| 12 | 2. All votes are editable (latest response by timestamp considered last vote) | ||
| 13 | |||
| 14 | ## Events | ||
| 15 | |||
| 16 | ### Poll Event | ||
| 17 | |||
| 18 | The poll event is defined as a `kind:1068` event. | ||
| 19 | |||
| 20 | - **content** key holds the label for the poll. | ||
| 21 | |||
| 22 | Major tags in the poll event are: | ||
| 23 | |||
| 24 | |||
| 25 | - **option**: The option tags contain an OptionId(any alphanumeric) field, followed by an option label field. | ||
| 26 | - **relay**: One or multiple tags that the poll is expecting respondents to respond on. | ||
| 27 | - **polltype**: can be "singlechoice", "multiplechoice", or "rankedchoice". Polls that do not have a polltype should be considered a "singlechoice" poll. | ||
| 28 | |||
| 29 | |||
| 30 | Example Event | ||
| 31 | |||
| 32 | ```json | ||
| 33 | { | ||
| 34 | "content": "", | ||
| 35 | "created_at": 1719888496, | ||
| 36 | "id": "9d1b6b9562e66f2ecf35eb0a3c2decc736c47fddb13d6fb8f87185a153ea3634", | ||
| 37 | "kind": 1068, | ||
| 38 | "pubkey": "dee45a23c4f1d93f3a2043650c5081e4ac14a778e0acbef03de3768e4f81ac7b", | ||
| 39 | "sig": "7fa93bf3c430eaef784b0dacc217d3cd5eff1c520e7ef5d961381bc0f014dde6286618048d924808e54d1be03f2f2c2f0f8b5c9c2082a4480caf45a565ca9797", | ||
| 40 | "tags": [ | ||
| 41 | ["label", "Pineapple on Pizza"], | ||
| 42 | ["option", "qj518h583", "Yay"], | ||
| 43 | ["option", "gga6cdnqj", "Nay"], | ||
| 44 | ["relay","<relay url1>"], | ||
| 45 | ["relay", "<relay url2>"], | ||
| 46 | ["polltype", "singlechoice"] | ||
| 47 | ] | ||
| 48 | } | ||
| 49 | ``` | ||
| 50 | |||
| 51 | ### Responses | ||
| 52 | |||
| 53 | The response event is a `kind:1018` event. It contains an e tag with the poll event it is referencing, followed by one or more response tags. | ||
| 54 | |||
| 55 | - **response** : The tag contains "response" as it's first positional argument followed by the option Id selected. | ||
| 56 | |||
| 57 | Example Response Event | ||
| 58 | |||
| 59 | ```json | ||
| 60 | { | ||
| 61 | "content": "", | ||
| 62 | "created_at": 1720097117, | ||
| 63 | "id": "60a005e32e9596c3f544a841a9bc4e46d3020ca3650d6a739c95c1568e33f6d8", | ||
| 64 | "kind": 1018, | ||
| 65 | "pubkey": "1bc70a0148b3f316da33fe7e89f23e3e71ac4ff998027ec712b905cd24f6a411", | ||
| 66 | "sig": "30071a633c65db8f3a075c7a8de757fbd8ce65e3607f4ba287fe6d7fbf839a380f94ff4e826fbba593f6faaa13683b7ea9114ade140720ecf4927010ebf3e44f", | ||
| 67 | "tags": [ | ||
| 68 | ["e", "1fc80cf813f1af33d5a435862b7ef7fb96b47e68a48f1abcadf8081f5a545550"], | ||
| 69 | ["response", "gga6cdnqj"], | ||
| 70 | ["response", "m3agjsdq1"] | ||
| 71 | ] | ||
| 72 | } | ||
| 73 | ``` | ||
| 74 | |||
| 75 | ### Poll Types | ||
| 76 | |||
| 77 | Poll Types can be configured in the settings object of the poll, the setting dictates how multiple response tags are handled in the `kind:1018` event. | ||
| 78 | |||
| 79 | - **PollType: singlechoice**: The first response tag is to be considered the actual response. | ||
| 80 | - **PollType: multiplechoice**: The first response tag pointing to each id is considered the actual response, without considering the order of the response tags. | ||
| 81 | - **PollType: rankedchoice**: The first response tag pointing to each id is the considered the actual response, while also taking into account the order of the response tags. | ||
| 82 | |||
| 83 | ### Counting Results | ||
| 84 | |||
| 85 | Results can be queried by fetching `kind:1018` events from the relays specified in the poll. | ||
| 86 | The results displayed should only be 1 vote event per pubkey. | ||
| 87 | In case of multiple events for a pubkey, the event with the largest timestamp should be considered. | ||
| 88 | |||
| 89 | ### Curation | ||
| 90 | |||
| 91 | The clients may configure fetching results by specific people. This can be achieved by creating `kind:30000` follow sets, and fetching results only from the follow set. | ||
| 92 | Clients can also employ other curation algorithms, like Proof Of Work and Web of Trust scores for result curations. | ||