bridgy-fed icon indicating copy to clipboard operation
bridgy-fed copied to clipboard

support Nostr

Open snarfed opened this issue 1 year ago • 21 comments

Simple, key-centric, UX is still rough, community is heavily Bitcoin/crypto people right now, but could be promising.

https://github.com/nostr-protocol/nostr

  • [ ] Implement Protocol
  • [ ] Serve NIP-05 discovery /.well-known/nostr.json path. Translate @user@instance to [email protected]
  • [ ] Poll for new posts from followings
  • [ ] Poll for new notifications
  • [ ] Implement Schnorr signatures
  • [ ] ...?

snarfed avatar Mar 13 '23 16:03 snarfed

Data points to help determine priority:

  • https://nostr.io/#profile-chart says there are 365k users (profiles) right now
  • https://stats.nostr.band/ says there are 1.13M users (profiles) right now, 13k "high" (ie non-zero) quality WAUs

365k vs 1.13M is a big spread, not sure why that is.

snarfed avatar Mar 26 '23 18:03 snarfed

I think they differ because of when they started collecting stats, maybe also the relays they are using. Here are two more:

  • https://primal.net/explore
  • https://nashboard.space

Talking to a nostr friend @gzuuus, he told me that https://stats.nostr.band/ is the most reliable source.

danielcharrua avatar Mar 27 '23 08:03 danielcharrua

Thank you!

snarfed avatar Mar 27 '23 14:03 snarfed

ActivityPub <=> Nostr bridge! https://soapbox.pub/blog/mostr-fediverse-nostr-bridge/

snarfed avatar Mar 30 '23 15:03 snarfed

Is there something to test already ?

sven-hash avatar Apr 25 '23 16:04 sven-hash

@sven-hash not here yet, no, but PRs are welcome!

snarfed avatar Apr 25 '23 16:04 snarfed

Thanks @snarfed for the quick answer, good to know that PRs are welcome ! Will check on it with other Nostr people

sven-hash avatar Apr 25 '23 16:04 sven-hash

I reread https://github.com/nostr-protocol and https://github.com/nostr-protocol/nips/blob/master/01.md and have a few questions about the protocol:

  • Apart from events you've sent, it sounds like all of your account/user data, notably your private key and your follows (?), are kept locally on the client. Key rotation sounds unsolved, ok, fine - https://github.com/nostr-protocol/nostr/issues/45 - ~but how about your follows? If you use multiple devices, do you have to manually follow/unfollow on all devices to keep them in sync? If you use a single device, and you lose it, is your following list gone? Is there some NIP for this?~ Aha looks like this is NIP-02.
  • Where's the guidance on whether/how long a relay should store a given event? Eg the contacts kind for NIP-02? Haven't found anything on that in NIP-01.
  • Should Bridgy Fed be a relay? Or should it act more like a client proxy, and use other relays? Not sure yet.

Here are the relevant NIPS I've found so far:

  • User profiles: NIP-39
  • Likes/reactions: NIP-25
  • User mentions: NIP-27
  • Replies: NIP-10, notably the Marked "e" tags method, which has parent, root, and references (eg quotes), along with "p" tags for those events' authors and other related users.
  • Notifications: also NIP-10, by users querying for themselves in "p" tags?
  • Reposts: NIP-18
  • Hashtags: NIP-12
  • Articles: NIP-23
  • Count queries, for eg followers, likes, etc: NIP-45

cc @manton

snarfed avatar May 25 '23 20:05 snarfed

To relay, or not to relay? Reasons:

Relay:

  • need to be a WebSocket server but not client, which may be harder on GAE
  • necessary for discovery? ie for a Nostr user discovering another user, both of whom are new to Bridgy Fed, if we're not a relay, there's no way for BF to discover this and propagate events into the remote relay on demand. This might be the deciding factor.

Not relay:

  • probably less work, don't have to implement relay protocol, just be a client

Same either way:

  • need to connect to an arbitrary number of external relays either way? to collect Nostr users' posts? Or would we say they have to add us as a relay destination for their posts to federate them?
    • How does relay-to-relay traffic work anyway? Nothing about it in NIP-01. Does it happen? Or would BF be unusual in doing it?

snarfed avatar May 25 '23 23:05 snarfed

Interestingly Nostr user growth and posts seem to be way down over the last month or so. Either that or maybe some big relay change happened and stats.nostr.band missed it. But it's "the most reliable source" ^ so 🤷

image

image

...ah, ok, the earlier high new user growth was evidently accounts with no profile or other info, so they likely weren't human, so the drop in posts may have just been a big wave of spam ending.

Still, active "trusted" users is slowly dropping too.

image

snarfed avatar May 26 '23 17:05 snarfed

List of relays: https://nostr.info/relays/

I'm currently testing with https://relayable.org/

snarfed avatar Aug 08 '23 14:08 snarfed

Curious what relays you settle on. I'm currently using nos.lol, relay.snort.social, relay.damus.io, and relay.nostrgraph.net because they seemed popular and didn't sound terrible. But I'd like to put some more thought into this. There's a performance trade-off to supporting "all" the relays.

manton avatar Aug 08 '23 14:08 manton

Definitely. Right now I'm just learning, but I suspect Bridgy Fed will actually need to be a relay itself: https://github.com/snarfed/bridgy-fed/issues/446#issuecomment-1563618821 . Not sure yet though, and obviously it's pretty different from micro.blog.

snarfed avatar Aug 08 '23 14:08 snarfed

I like the idea of Bridgy being a relay itself, although I'm not sure that's required. If I do more with Nostr, I will probably have a relay too. Mostly because it feels like the right thing to do to fully participate in the Nostr ecosystem, more than a technical requirement. (But I might be missing something!)

manton avatar Aug 08 '23 14:08 manton

I recently finished enough Nostr data conversion and relay protocol support to launch it in granary:

  • https://granary.io/?site=nostr#logins
  • https://granary.io/?input=html&output=nostr#logins

snarfed avatar Aug 15 '23 03:08 snarfed

Current obstacle: from NIP-01:

Each user has a keypair. Signatures, public key, and encodings are done according to the Schnorr signatures standard for the curve secp256k1.

I'm having trouble finding a production-appropriate Python implementation of BIP340 Schnorr signatures.

snarfed avatar Aug 15 '23 03:08 snarfed

Production-ready candidates:

secp256k1-py looks like the winner.

snarfed avatar Aug 15 '23 04:08 snarfed

To try: https://www.nos.social/

snarfed avatar Aug 17 '23 21:08 snarfed

I should do a survey of relay info metadata, specifically the limitation field, for a handful of the bigger relays. nostr.law (?), nostr.mom, relayable.org, etc. I'm curious what their limits on the various filter fields are, esp if I need to subscribe for all Bridgy Fed users on a given relay.

snarfed avatar Sep 05 '23 03:09 snarfed

Started a todo list in the description

snarfed avatar Oct 02 '23 14:10 snarfed

Active user counts are still low, but trending up again. Last 6 mos:

https://stats.nostr.band/#daily_active_users image

https://stats.nostr.band/#weekly_active_users image

snarfed avatar Jul 11 '24 17:07 snarfed