upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiatjaf <fiatjaf@gmail.com>2025-11-11 11:21:34 -0300
committerfiatjaf <fiatjaf@gmail.com>2026-02-04 19:22:23 -0300
commit886ee07cfc4b0f606a01cac27c8a1434d6e81406 (patch)
tree915d07c41b1b0838e0f976c34a3d819736727689
parentcc45433791b9f26a1bdb9c209cd3a6eb598a156e (diff)
add recommendation for HLL client-side usage.
-rw-r--r--45.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/45.md b/45.md
index 5693f4e..970409d 100644
--- a/45.md
+++ b/45.md
@@ -73,6 +73,21 @@ One could mine a pubkey with a certain number of zero bits in the exact place wh
73 73
74The value `hll` value must be the concatenation of the 256 registers, each being a uint8 value (i.e. a byte). Therefore `hll` will be a 512-character hex string. 74The value `hll` value must be the concatenation of the 256 registers, each being a uint8 value (i.e. a byte). Therefore `hll` will be a 512-character hex string.
75 75
76### Client-side usage
77
78This algorithm also allows clients to combine HLL responses received from relays with HLL counts computed locally from raw events. It's recommended that clients keep track of HLL values locally and add to these on each message received from relays. For example:
79
80 - a client wants to keep track of the number of reactions an event Z has received over time;
81 - the client has decided it will read reactions from relays A, B and C (the NIP-65 "read" relays of Z's author);
82 - of these, only B and C support HLL responses, so the client fetches both and merges them locally;
83 - then the client fetches all reaction events from A then manually applies each event to the HLL from the previous step, using the same algorithm described above;
84 - finally, the client reads the estimate count from the HLL and displays that to the user;
85 - optionally the client may store that HLL value (together with some "last-read-date" for relay A) and repeat the process again later:
86 - this time it only needs to fetch the new reactions from A and add those to the HLL
87 - and redownload the HLL values from B and C and just reapply them to the local value.
88
89This procedure allows the client to download much less data.
90
76## Examples 91## Examples
77 92
78### Count notes and reactions 93### Count notes and reactions