Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surveys/polls #65

Closed
fernandolguevara opened this issue Nov 11, 2022 · 3 comments
Closed

Surveys/polls #65

fernandolguevara opened this issue Nov 11, 2022 · 3 comments

Comments

@fernandolguevara
Copy link
Contributor

fernandolguevara commented Nov 11, 2022

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>"
  }
@monlovesmango
Copy link
Member

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

@tcheeric
Copy link
Contributor

tcheeric commented Dec 14, 2022

A few thoughts:

  1. You would need to assign a different kind number (?)
  2. The marker on the e tag in the reply should be "reply", if my interpretation of nip 10 is correct.
  3. I would split surv and choice, and introduce choice as an additional separate tag, with two attributes, index (optional) and text (mandatory)

examples:
["choice", 0, "Option # 1"]
["choice", "Option # 2" ]

  1. Minimum of two choice tags.
  2. In the reply, we include the respondent's selected choice tags (minimum 1) in the tag list.
  3. One vote per key. The relay needs to discard all subsequent votes, as well as invalid replies.

@monlovesmango
Copy link
Member

@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.

#80

@fiatjaf fiatjaf changed the title [FR] surveys/polls Surveys/polls Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants