jb55 on Nostr: For example: once I add WoT scoring to nostrdb, nostrscript query filters will be ...
For example: once I add WoT scoring to nostrdb, nostrscript query filters will be able to do queries such as:
{give me all the notes of kind 1 with wot > 5}
the nostrscript is a simple wasm function:
{wot_score(note.pubkey) > 5}
Paired with a query: {“kinds”: [1]}
which can be jit compiled and run alongside the nostr query. Possibilities are endless really.
Maybe you could represent this as:
{“kinds”: [1], “reducer”: “nscriptabcdef…”}
{give me all the notes of kind 1 with wot > 5}
the nostrscript is a simple wasm function:
{wot_score(note.pubkey) > 5}
Paired with a query: {“kinds”: [1]}
which can be jit compiled and run alongside the nostr query. Possibilities are endless really.
Maybe you could represent this as:
{“kinds”: [1], “reducer”: “nscriptabcdef…”}
quoting note1m0d…qj69Pairing a nostr query with a nostrscript(wasm) filter makes a lot of sense: the nostrscript can be jit-compiled and cached, and the query plan is determined from the base nostr query so that the results can start returning instantly and efficiently. I think I just came up with a new kind of database powered by nostr 🤔
Arbitrary but fast sandboxed code execution to query a database sounds really cool, and it can be really fast, fast as strfry.
What if instead of just filtering, we pass a reducer, so you could effectively do map-reduce over nostr data 🤔 this can be used for counting and grouping nostr notes in arbitrary ways, directly from a query, efficiently. Holy shit.