From 21f3ad5a42c0ae63f2fc0a6e9f18b05f44df68c5 Mon Sep 17 00:00:00 2001 From: Viktor Vsk Date: Sun, 27 Aug 2023 15:34:55 +0200 Subject: [PATCH] Allow relays indicate whether probabilistic count was used in NIP-45 --- 45.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/45.md b/45.md index a5253913..7b11950a 100644 --- a/45.md +++ b/45.md @@ -21,6 +21,7 @@ This NIP defines the verb `COUNT`, which accepts a subscription id and filters a ``` Counts are returned using a `COUNT` response in the form `{"count": }`. Relays may use probabilistic counts to reduce compute requirements. +In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": , "approximate": }`. ``` ["COUNT", , {"count": }] @@ -36,4 +37,8 @@ Examples: # Count posts and reactions ["COUNT", , {"kinds": [1, 7], "authors": []}] ["COUNT", , {"count": 5}] + +# Count posts approximately +["COUNT", , {"kinds": [1]}] +["COUNT", , {"count": 93412452, "approximate": true}] ```