diff --git a/README.md b/README.md index ddf022d..634efa3 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh - [NIP-35: User Discovery](35.md) - [NIP-36: Sensitive Content](36.md) - [NIP-40: Expiration Timestamp](40.md) +- [NIP-XX: Surveys/Polls](XX.md) ## Event Kinds diff --git a/XX.md b/XX.md new file mode 100644 index 0000000..503f67c --- /dev/null +++ b/XX.md @@ -0,0 +1,69 @@ +NIP-XX +====== + +Surveys / polls +----------------------------------- + +`draft` `optional` `require:nip-20` `author:fernandolguevara` + +The `surv` & `surv-resp` tags enables users to have surveys/polls experiences on the network. + + +#### Spec + +##### Message + +``` +tag: surv +options: + - allow others to reply with one or multiple options + - TTL (in seconds|timestamp) when surv expires, 0 TTL don't expire + - []: up to 4 choices each limited to 25 chars +```` + +``` +tag: surv-resp +options: + - []: based on surv type it can have one or multi +```` + +##### Relays + +One vote per key, relays needs to discard all subsequent votes, as well as invalid requests. + +##### Invalid responses +```json +["OK", , false, 'ALREADY_ANSWERED'], +["OK", , false, 'EXPIRED'], +["OK", , false, 'SINGLE_OPTION'], +["OK", , false, 'INVALID_OPTION', 'optionX', ...], +``` + +#### Example + +```json +{ + "pubkey": "", + "created_at": 1000000000, + "kind": 1, + "tags": [ + ["t", "hastag"], + ["surv", "", "", "option 1", "option 2", "option 3"] + ], + "content": "#hastag what is your favorite option?", + "id": "" + }, + { + "pubkey": "", + "created_at": 1000000000, + "kind": 1, + "tags": [ + ["p", "", "wss://..."], + ["e", "", "wss://...", "root"], + ["t", "tag"], + ["surv-resp", "option 1", "option 2"...] // based on root event surv type it can have one or multi + ], + "content": "hello #tag\n", + "id": "" + } +```