mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-02-22 05:09:00 +00:00
reorder
This commit is contained in:
parent
aea06810ac
commit
f3bb38802e
8
45.md
8
45.md
@ -63,6 +63,10 @@ This NIP defines (for now) two filters eligible for HyperLogLog:
|
||||
- `{"#p": ["<pubkey>"], "kinds": [3]}`, i.e. a filter for `kind:3` events with a single `"p"` tag, which means the client is interested in knowing how many people "follow" the target `<pubkey>`. In this case the `offset` will be given by reading the character at the position `32` of the hex `<pubkey>` value as a base-16 number then adding `8` to it.
|
||||
- `{"#e": ["<id>"], "kinds": [7]}`, i.e. a filter for `kind:7` events with a single `"e"` tag, which means the client is interested in knowing how many people have reacted to the target event `<id>`. In this case the `offset` will be given by reading the character at the position `32` of the hex `<id>` value as a base-16 number then adding `8` to it.
|
||||
|
||||
### `hll` encoding
|
||||
|
||||
The 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.
|
||||
|
||||
### Attack vectors
|
||||
|
||||
One could mine a pubkey with a certain number of zero bits in the exact place where the HLL algorithm described above would look for them in order to artificially make its reaction or follow "count more" than others. For this to work a different pubkey would have to be created for each different target (event id, followed profile etc). This approach is not very different than creating tons of new pubkeys and using them all to send likes or follow someone in order to inflate their number of followers.
|
||||
@ -81,10 +85,6 @@ Because the HyperLogLog input is deterministic (and must be for relays that do n
|
||||
|
||||
The Secure HyperLogLog scheme is identical to the HyperLogLog scheme except that instead of operating on the event `pubkey`, the algorithm operates on `SHA256(concat(<subscription_id>, <event_pubkey>))`. Clients will need to use the same `<subscription_id>` at each relay in order for the resulting data to properly combine.
|
||||
|
||||
### `hll` encoding
|
||||
|
||||
The 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.
|
||||
|
||||
## Examples
|
||||
|
||||
### Count posts and reactions
|
||||
|
Loading…
Reference in New Issue
Block a user