-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subscribe with prefixed filter ids (nip-01) #28
Comments
created this issue also for rust relay scsibug/nostr-rs-relay#104 |
This should work for id Converting hex to bytes is ambiguous when the quantity of hex characters are odd. |
IMO
is intended to mean
Maybe exploding the odd-length prefixes this way is a good heuristic to avoid the ambiguity? |
Yep, that could work. I'm not sure if it's worth doing the work for this though -- If you're querying IDs then why not just send an even number of hex digits? |
POW can be much more granular than full byte. I think for POW, the prefix is not granular enough. You would need for example a range: |
You can very granularly filter by PoW by enumerating the ID prefixes. See https://github.com/rust-nostr/nostr/blob/master/crates/nostr/src/nips/nip13.rs#L386-L432 For example:
This can be generalized:
So enumerating 1-8 prefixes can be enough to filter by any PoW. |
In the meantime I found out that rust relay supports it and that there was an issue in which now is fixed, see offbyn/nostr-tools@98ecacd Reading the rest of the discussion about 'odd-length prefixes' I guess this should probably go into a nip (ideally also prefixes itself would be moved to its own nip so clients could ask relays if they support prefixes). scsibug/nostr-rs-relay#104 (comment) Closing this. |
I'd like to subscribe to event ids starting with "0" as described in nip-01, but it seems no relays support that yet. Reason: there are some clients that support nip-13 POW and add nonce tag, but filtering by nonce on the client still means that all events are subscribed too which results in lots of bandwidth usage. Therefore I'd like to only subscribe to events starting with '0' or '00'
https://github.com/nostr-protocol/nips/blob/master/01.md
example:
filter: { ids: ['0'] }
The text was updated successfully, but these errors were encountered: