nostr-protocol / nips

Nostr Implementation Possibilities
2.39k stars 582 forks source link

NIP90 - Add addressable job results and spontaneous job results #1546

Open blackcoffeexbt opened 3 weeks ago

blackcoffeexbt commented 3 weeks ago

This PR adds addressable job results and spontaneous job results to the NIP90 spec.

Extending NIP90 to support these features will allow the use of Nostr DVMs by IoT devices rather than implementing IoT in a standalone spec. The will also be uses for these updates beyond IoT.

Addressable Job Results will allow IoT devices with high frequency data updates to use public relays without bloating a relay's resources. This range is optional and the standard job result range 3600 - 36999 still exists if this isn't desired.

Spontaneous Job Results have been added to the spec to allow a DVM to operate autonomously. A DVM can publish events without the need of a job request trigger. This can be useful in the case of periodic or triggered IoT updates or other non-IoT uses such as a DVM reacting to a news event.

pablof7z commented 3 weeks ago

can you give some examples of what kind of data would be published? I'm not sure I'm reasoning about this without more context

blackcoffeexbt commented 3 weeks ago

Sure. I've PRd a kind to the DVM repo with some more detail. Does this help @pablof7z ?

nostr-protocol/data-vending-machines#31

blackcoffeexbt commented 3 weeks ago

@pablof7z you can test a DVM IoT simulator I've put together here:

https://nostr-relay-h4xor.vercel.app/

Send a request (bottom textarea) with

{"kinds":[5107,6107,36107,31990],"limit":0}

and then send a job request with

{"content":"","kind":5107,"tags":[["i","[{\"method\": \"getLocationTemperature\",\"params\": [\"location\", \"50,1\"]}]","text","wss://relay.nostriot.com"],["output","text/plain"],["p","22b9d2fa2910974d02138af239a341a09ec60560338eb0f8814ec5729ae25c64"]]}

This is a demo of a standard job request and result but might help you understand the direction I want to go with this