david on Nostr: Regarding the WoT on zapstore, follows who follow: iiuc you want the intersection of ...
Regarding the WoT on zapstore, follows who follow: iiuc you want the intersection of two sets, Alice’s follows and Bob’s followers. And you want to calculate that quickly. Keeping track of follows is simple: all you need is the most up to date kind 3 note. Keeping track of followers and producing that list within the fraction of a second is the challenge. When I click on followers on damus, my app scours the known universe to compile the list from scratch. Takes on the order of 10s of seconds, too long for your purposes.
So am I correct to assume that zapstore maintains a cache of pubkeys and their follows? In sql perhaps? With a column for follows and another column for followers? I tried that for a while and discovered that keeping it current was a pita. Why? Keeping follows current is simple, but doing it for followers is a pita.
My solution for tracking followers is to use a graph database. Why? Because it can retrieve not only follows but also followers very quickly. To test this, I built a few api endpoints to produce follows, followers, mutes, muters, etc on demand. All very fast. And I have one endpoint currently active which would produce the WoT score exactly as you describe, very quickly, if I’ve understood you correctly. You provide the pubkeys for Alice and Bob and you get back either a number or, if desired, the entire array of pubkeys. I can give you the endpoint if you’d like to play with it, maybe check to see if your code and my code produce the same results.
So that doesn’t use NIP-85. But it does use neo4j, which I believe is very powerful.
So am I correct to assume that zapstore maintains a cache of pubkeys and their follows? In sql perhaps? With a column for follows and another column for followers? I tried that for a while and discovered that keeping it current was a pita. Why? Keeping follows current is simple, but doing it for followers is a pita.
My solution for tracking followers is to use a graph database. Why? Because it can retrieve not only follows but also followers very quickly. To test this, I built a few api endpoints to produce follows, followers, mutes, muters, etc on demand. All very fast. And I have one endpoint currently active which would produce the WoT score exactly as you describe, very quickly, if I’ve understood you correctly. You provide the pubkeys for Alice and Bob and you get back either a number or, if desired, the entire array of pubkeys. I can give you the endpoint if you’d like to play with it, maybe check to see if your code and my code produce the same results.
So that doesn’t use NIP-85. But it does use neo4j, which I believe is very powerful.