On Nostr everything is a note stored on relays, right?

That includes when you follow someone. The first time you follow someone, a note called a follow list gets created and stored to your relays. It is also referred to as a "kind 3" because different types of notes are differentiated by their kind number. The second time you follow someone, another new kind 3 is created, but it's not really separate from the first, because it has the original npub you followed on it plus the new one you just followed. Once a relay sees the new follow list with two npubs on it, it is supposed to delete the first one, so you only have one follow list at a time.

This makes it very easy for Nostr clients to display how many npubs you are following. They just need to look at your relays to find your most recent follow list and count the number of npubs listed on it. Done.

Now consider how a Nostr client like Amethyst would calculate how many people are following you. Remember, when someone follows you, the exact same thing happens as when you follow someone else. THEIR follow list gets updated to include your npub and saved to THEIR relays. So, if 200+ people have followed you, then a Nostr client has to try to find all of those follow lists, without knowing what relays they have been saved to, it just has to check as many relays as seems reasonable to the dev. But what if a follow list containing your npub is on a relay that the Nostr client didn't check, or it tried to check, but the relay was down or otherwise unreachable? Well, then its count will probably change every time you look at your follower count, because it is able to reach different relays each time.

Amethyst in particular updates the count in real time as it checks the relays, so when you first look at the number on your profile page, it will almost certainly be a ridiculously small number, even if you know you have more followers. Then, as it is able to reach more relays, the number will go up. Other Nostr clients may cache the information and update it periodically, so that you see a static number when you go to check it on your profile. Other Nostr clients recognize that follower counts are pretty meaningless, since anyone can spin up bots to follow them, so they don't show follower counts at all.

The reason Primal is able to "better" display your follower count than most other clients is because Primal does not work like most Nostr clients. Instead of reading directly from relays, Primal apps only read from Primal's centralized caching server, which in turn tries to aggregate all notes from all known relays. This means that instead of trying to look for follow lists from hundreds of relays in real time, Primal apps just have to check one server that the apps consider to have all the relevant information. That doesn't necessarily mean that Primal's number is accurate though, even though it is more stable. There still may be relays out there that have follow lists with your npub on them that Primal's caching server isn't aggregating notes from. There are also a lot of decentralization and censorship resistance trade-offs that come with using a caching server, rather than reading from relays directly. So this doesn't necessarily make Primal better overall, just different.

Reply to this note

Please Login to reply.

Discussion

No replies yet.