nips
nips copied to clipboard
Surveys/polls
we could add a new to tag to allow creation of surveys/polls on nostr protocol
// create
tag: surv
options:
- <multi|single> allow others to reply with one or multiple options
- <ttl> TTL (in seconds|timestamp) when surv expires
- [<choice>]: up to 4 choices each limited to 25 chars
// reply
tag: surv-resp
options:
- [<choice>]: based on surv type it can have one or multi
{
"pubkey": "<pub-key>",
"created_at": 1000000000,
"kind": 1,
"tags": [
["t", "hastag"],
["surv", "<multi|single>", "<ttl>", "choice 1", "choice 2"]
],
"content": "#hastag what is your favorite ...?\n",
"id": "<event-id>"
},
{
"pubkey": "<pub-key>",
"created_at": 1000000000,
"kind": 1,
"tags": [
["p", "<pub-key-root>", "wss://..."],
["e", "<event-id-root>", "wss://...", "root"],
["t", "tag"],
["surv-resp", "choice 1", ...] // based on root event surv type it can have one or multi
],
"content": "hello #tag\n",
"id": "<event-id>"
}
I think polls would be really nice to have. small comment, i think any response to the poll should list the poll event as the "root" and not "reply" in the event tag
A few thoughts:
- You would need to assign a different
kindnumber (?) - The marker on the e tag in the reply should be
"reply", if my interpretation of nip 10 is correct. - I would split
survandchoice, and introducechoiceas an additional separate tag, with two attributes,index(optional) andtext(mandatory)
examples: ["choice", 0, "Option # 1"] ["choice", "Option # 2" ]
- Minimum of two
choicetags. - In the reply, we include the respondent's selected
choicetags (minimum 1) in the tag list. - One vote per key. The relay needs to discard all subsequent votes, as well as invalid replies.
@tcheeric for #2 it should be 'root' not 'reply'. the marker identifies the event that is tagged. the event that is tagged is a root event, not a reply event. I have a pr open to clarify top level replies for nip 10.
https://github.com/nostr-protocol/nips/pull/80