nip/data-functions#2367
Open
samthomson wants to merge 2 commits into
Open
Conversation
Member
|
Aren't clients already doing this for many things, like your comment/reaction count example? |
Author
|
The approach here uses serverless functions (nostrfied in dvms) to make a flexible caching layer any client can build with. I’ve seen clients with custom caching layers, and in best cases nip85 attestations (so at least the data goes back to the data), but not like this. Can you share more? 🙏
…-------- Original Message --------
On Wednesday, 06/03/26 at 15:47 fiatjaf ***@***.***> wrote:
fiatjaf left a comment [(nostr-protocol/nips#2367)](#2367 (comment))
Aren't clients already doing this for many things, like your comment/reaction count example?
—
Reply to this email directly, [view it on GitHub](#2367?email_source=notifications&email_token=ABSIPNFPCY5WGRUNFLOK4AD46AT6TA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINRRGMYDAMZYGQ32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4613003847), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABSIPNBUFME2P5HNYV3M54T46AT6TAVCNFSM6AAAAACZYYIWJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DMMJTGAYDGOBUG4).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Member
|
Is the idea here to publish some custom map/reduce JavaScript code and then some DVM will execute that code and publish the results as events? |
Author
|
@fiatjaf yes/no. It's not prescriptive. I use a 1337 code sample kind for the serverless function, but then define a replaceable 31337 which references a 1337 but also adds config (ttl, dvm relay, read relays, write relays, optional params for the serverless function). It could be used for anything. Reaction/comment counts (or reactions/comments themselves) could be populated, but also anything. for instance above in my example I get tonnes of - nostr - weather data and crunch it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP - conversation/feedback welcome, but it's not review ready yet.
This NIP proposes associating data with code, so that complex data can be recomputed on the fly using DVMs.
Similar to attestation types (npi 85?) where someone crunches data and we just query the output, with this NIP we ask for the crunched data, but provide a serverless function to run in order to populate it if it wasn't already defined (ie cached).
A simple example would be comment/reaction counts, or the reactions/comments themselves. Or more complex would be taking a lots of data (eg several weeks of historical weather data nip-whatever) and doing some aggregations on it.
The goal here is to let clients have snappy experiences while working with derived (not root query) data while:
I've started a rough implementation in relaykit:
A client can then consume as follows:
Here's a comparison showing first load, of me fetching weather data from the last month and calculating an average temperature versus me asking for the same one event of the same derived data:
And here's a second load, ie how it would be for a second visitor to the same client.
Note, if the DVM isn't locked down with a whitelist, then a client can publish a request to the dvm with an ephemeral key to avoid forcing users to login, so this is also a 'guest' friendly solution.