From afe487db43fffedf627331475d36af87a1bb67c6 Mon Sep 17 00:00:00 2001 From: Thomas <31560900+0xtlt@users.noreply.github.com> Date: Thu, 5 Jan 2023 20:17:12 +0100 Subject: [PATCH 1/4] Create 41.md --- 41.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 41.md diff --git a/41.md b/41.md new file mode 100644 index 0000000000..d6e60dd3a9 --- /dev/null +++ b/41.md @@ -0,0 +1,46 @@ +NIP-41 +====== + +### Poll & Vote Event +----------------------------------- + +`draft` `optional` `author:0xtlt` + +An event with kind `1` that wants to contain a poll can do so by adding poll tags and its content as follows: + +```json +{ + ... + "kind": 1, + "tags": [ + ... + ["poll", "Choice 1"], + ["poll", "Choice 2"], + ["poll", "Choice 3"] + ... + ], +} +``` + +Then the client should display voting options if more than **1 choice** is present in the poll. + +The client can then submit the vote by sending an event with kind `8` and its content which will be the index (start at `0`) of the chosen choice. + +It should also contain an `e` tag with the id of the poll event only. + +```json +{ + ... + "kind": 8, + "tags": [ + ... + ["e", ""] + ... + ], + "content": "1" +} +``` + +#### Warning + +Keep in mind that all votes are public and accessible to everyone. From 4b475728568b2b1f0388a77179f8b25187e0f477 Mon Sep 17 00:00:00 2001 From: Thomas <31560900+0xtlt@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:35:24 +0100 Subject: [PATCH 2/4] :up: Poll update --- 41.md | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/41.md b/41.md index d6e60dd3a9..458ddd5b36 100644 --- a/41.md +++ b/41.md @@ -1,12 +1,27 @@ -NIP-41 -====== - -### Poll & Vote Event ------------------------------------ +# NIP-41 - Poll & Vote Event `draft` `optional` `author:0xtlt` -An event with kind `1` that wants to contain a poll can do so by adding poll tags and its content as follows: +> Poll and vote events are a way to create a poll and vote for it.\ +> Polls are directly integrated into message events (1), and responses are vote events (9) to avoid overloading the loading of messages in clients. + +## Specs + +### Kind `1` - Message & Poll + +To create a poll, include a `poll` tag in the message event. with the following format: + +```json +tag: poll +options: + - allow others to reply with one or multiple options + - TTL (in seconds|timestamp) when surv expires, 0 TTL don't expire + - [