Global Seach of Data

Hello,

I am new to the topic of using blockstack in distributed applications.

Therefore, I have a question where I have difficulties imagen it:

Assume we have a peer network with a lot of user profiles. As I understood, the data of the user profiles are only accessible when they are logged in and have an opening session. Reads and writes from the application side have to be permissioned. I wonder, how to do a global search over the user profiles in this kind of data storage (like traditional databases, where I can query the data of all users for certain conditions). For instance, one user using the application would like to check e.g. which user profiles using the application are matching certain conditions to contact them. Is that possible? Also in the case, where some users are offline? Are there any examples or documentation for that?

thanks a lot

Yes, it’s possible – you can directly query a user’s signed profile JWT using their username.

Example:

$ curl -sL http://stacks-node-api.stacks.co/v1/names/dweb2018.id.blockstack | jq
{
  "address": "SP233FRD7H1DEPM84978NCKD08XA6JZ1P2EVZ6DH3",
  "blockchain": "stacks",
  "last_txid": "0x",
  "resolver": "https://registrar.blockstack.org",
  "status": "registered_subdomain",
  "zonefile": "$ORIGIN dweb2018.id.blockstack\n$TTL 3600\n_http._tcp\tIN\tURI\t10\t1\t\"https://gaia.blockstack.org/hub/1DEgVRD265SBPvfaQeNAVZr8Pmiz1v2Mkf/profile.json\"\n\n",
  "zonefile_hash": "9a47cdc40e4d404011954be6e3e57f2e71a3fcf5"
}

From there, you can access the profile via the zone file’s _http._tcp URI record (https://gaia.blockstack.org/hub/1DEgVRD265SBPvfaQeNAVZr8Pmiz1v2Mkf/profile.json).

You’ll need to build a crawler to get every name’s profile, and keep in mind that app-specific data is often encrypted.

Here is some previous work: GitHub - vrepsys/blockstats: Blockstats collects Blockstack data and converts it into statistical time series.

1 Like