How can you discover other app users?


#1

Hey there,
I’m pretty new to Blockstack and I think it’s great!
One thing I’m trying to understand is how do you discover other users of my decentralized app? In the micro-blogging example you can query other users profiles by username to see their posts https://blockstack.org/tutorials/multi-player-storage

However, how would you discover other users if you didn’t know any of their usernames or ids? Is there some sort of querying mechanism where one user could discover others given they want to be discovered?

Thanks!


#2

+1 Also trying to wrap my head around this. Only way I could think of would be scanning the namespace and lookup stored data for every id, but seems highly inefficient


#3

+1 I Just added a question similar to this in another thread.

Looking at blockstack.js - I don’t see an API call for searching for username

However, looking at blockstack core there is a “get all names” function: https://core.blockstack.org/#name-querying-get-all-names

https://core.blockstack.org/v1/names?page=23

I’m not certain that’s the solution (and even if it is, it appears perhaps a function call needs to be added to blockstack.js) as I’m new to this as well but that’s what I found


#4

+1 Also trying to wrap my head around this. Only way I could think of would be scanning the namespace and lookup stored data for every id…

This is the correct answer.

…but seems highly inefficient

Not as inefficient as you would think. An application that wanted to implement a user discovery service can easily determine where everyone’s profile data is hosted, since a Blockstack Core node already does this. From there, an indexing service can be written to fetch each user’s profile, and for each profile, determine whether or not the use the application (by inspecting the profile).

The nice thing about this design pattern is that anyone can run an indexing service for any application, since all it’s doing is crawling users. The index is soft state, and can be reconstructed at any time. This means that if you don’t want to run an index yourself, you should have no problem finding one you can trust. Also, even if the application developer abandons your app, the fact that anyone can start up a user index for it means that apps will remain usable on as long as people want them to.


#5

If you are interested in specifics on how to build this I’ve been working on one: https://github.com/jackzampolin/bsk-idx