Skip to content

NIP-91 IoT Sensors and Intents#817

Open
fiatjaf wants to merge 1 commit into
masterfrom
iot
Open

NIP-91 IoT Sensors and Intents#817
fiatjaf wants to merge 1 commit into
masterfrom
iot

Conversation

@fiatjaf
Copy link
Copy Markdown
Member

@fiatjaf fiatjaf commented Oct 11, 2023

@frbitten
Copy link
Copy Markdown
Contributor

How would it be done if you wanted to keep the data private? Guarantee the use of a private relay? Would you use encrypted data? Would you use private messages within nostr?

It would work very well for a public knowledge network of climate information, for example.

@shaibearary
Copy link
Copy Markdown

What if the data from sensor has different unit specified in nip

@mutatrum
Copy link
Copy Markdown

Matter looks like a decent evolving standard, which already tackled quite a lot of different device types. IMO it would make more sense to have a Matter over Nostr type of bridging?

@vitorpamplona
Copy link
Copy Markdown
Collaborator

Now we wait for the first implementer. :)

@Charlie67j
Copy link
Copy Markdown

Home assistant does a pretty good job at defining entities and data types for a home and probably commercial application. Industrial applications would require a different set of entities/data types. https://developers.home-assistant.io/docs/core/entity/

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 11, 2023

What is Matter? Can you drop a link? @mutatrum

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 11, 2023

How would it be done if you wanted to keep the data private? Guarantee the use of a private relay?

For now, yes. We don't have to solve all the things at once.

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 11, 2023

What if the data from sensor has different unit specified in nip

You perform conversion, should be a simple formula in most cases -- or we make a new kind for data in a different unit if that is impossible.

But maximum interoperability requires everybody publishing data in the same unit -- someone will have to perform conversion somewhere.

Comment thread 91.md
}
```

Ideally each device would have its own public key, which allows for easy command-and-control and comes with built-in trus guarantees (i.e. you know you're getting the data from the correct device if you know its key and can check the signature), but the `device` tag exists for when that is too cumbersome and more than one device is using the same key.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trust guarantees?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant was that you can know for sure who is publishing the data given the signature, but it's definitely confusing. Please reword.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant was that you can know for sure who is publishing the data given the signature, but it's definitely confusing. Please reword.

I got it and the previous comment is about typo haha.
suggestions:
"and ensures data authenticity with build-in properties. "

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, sir, I'm not an English speaker (and I still don't see the typo).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"built-in trus guarantees" is missing a t in trust.

@fiatjaf fiatjaf changed the title NIP-91 IoT skeleton NIP-91 IoT Sensors and intents Oct 12, 2023
@fiatjaf fiatjaf changed the title NIP-91 IoT Sensors and intents NIP-91 IoT Sensors and Intents Oct 12, 2023
@arthurfranca
Copy link
Copy Markdown
Contributor

@Charlie67j (From WIP 107) : The typical usage scenario would be for an IoT device (client) to publish a value(s) to the MQTT server on change of state. [...] Another client will subscribe to this "topic" for display and if you choose so, to store the state in a database of some kind for later analysis. In this way the good data is saved and the relay/broker/server stays lightweight.

Shouldn't the events be replaceable? So maybe use 18000-18999 range instead. The subscriber keeps the history if it wants.

@Charlie67j
Copy link
Copy Markdown

@Charlie67j (From WIP 107) : The typical usage scenario would be for an IoT device (client) to publish a value(s) to the MQTT server on change of state. [...] Another client will subscribe to this "topic" for display and if you choose so, to store the state in a database of some kind for later analysis. In this way the good data is saved and the relay/broker/server stays lightweight.

Shouldn't the events be replaceable? So maybe use 18000-18999 range instead. The subscriber keeps the history if it wants.

That's my point. For typical IoT data, there is no reason for the vast majority of the data to be stored. That's one reason that MQTT servers don't store data, only state, but MQTT clients devices and services might. Typically the client connections are also treated as ephemeral with a timeout setting to forget the device should it not connect for a certain amount of time. It could be minutes, it could be months... The ability to ascertain if the last known state is valid, or simply the last time that a device was online begins to be a functional requirement as the requirements of trust go up. They have solved this in some ways with the Sparkplug B Specification for devices and MQTT servers. That's all I"m saying. I'm not intending to ruin the fun. There is the other issue of the sheer number possible combinations of devices, entities, data types and attributes that will far outnumber 1000. Trying to hard code this is not feasible. I've worked on a couple of projects where we had to solve this problem. That's another conversation.

@mutatrum
Copy link
Copy Markdown

mutatrum commented Oct 13, 2023 via email

@Charlie67j
Copy link
Copy Markdown

Charlie67j commented Oct 13, 2023

Caveat: I haven't read the actual Matter protocol specs, but what I do know is they have the device topology worked out. It's a transport layer agnostic system, so on the surface it would look like an easy step to mangle this onto Nostr. https://csa-iot.org/all-solutions/matter/

On Wed, 11 Oct 2023, 21:40 fiatjaf_, @.> wrote: How would it be done if you wanted to keep the data private? Guarantee the use of a private relay? For now, yes. We don't have to solve all the things at once. — Reply to this email directly, view it on GitHub <#817 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANN34JTX2DINGQ4JDKE7BVTX63Y3NANCNFSM6AAAAAA54A7WT4 . You are receiving this because you were mentioned.Message ID: @.>

I've tried to read the standard, but it seems that CSA is acting as a gatekeeper for such information. I've heard the promise for a while, but I'm still waiting. Not surprising. Over my career there has been a repeating cycle of some company or organization promising to bring order to the chaos and then becoming compromised by big money board members or combative participants that don't agree with the standard. My personal favorite is relaxing the standard so that a company may show the badge of conforming to the standard, but you need to use that specific company's software/gateway/client to get all the useful features that are not part of the standard, but easily could be... Call me jaded. A simple [Device]/[Attributes]/[Properties]/[value] arrangement is usually all that's needed. I do hope that they are completely open and successful. The next question would be if their definitions also apply for commercial and industrial IoT models and devices. I don't really care who knows the temperature of my refrigerator, but there could be some interesting use cases in the industrial market for interacting with remote sites where key signing could be used to authenticate a command from a remote operator.

@frnandu
Copy link
Copy Markdown
Contributor

frnandu commented Oct 14, 2023

Adding nostr implementation to https://tasmota.github.io would be very cool.
I have a bunch of ESP32 devices around the house firmwared with tasmota.
Currently using home assistant over VPN to control the devices from outside the house.
I could have a read/write permission list on my private relay for all devices public keys and according to that be able to control a device by signing an event to my private relay which the device would listen, check if public key is allow to perform an action and react to.
Very cool! :)

@v0l
Copy link
Copy Markdown
Member

v0l commented Oct 15, 2023

I was pushing weather station data to kind 1008, moved script to 8003 for now, would be nice if you can push multiple k/v pairs in tags otherwise i would have to push multiple events.

You can find the data on wss://relay.snort.social

data from stations:

{
  "time": "2023-10-15 22:42:37",
  "model": "Fineoffset-WHx080",
  "subtype": 0,
  "id": 196,
  "battery_ok": 1,
  "temperature_C": 4.2,
  "humidity": 90,
  "wind_dir_deg": 45,
  "wind_avg_km_h": 0,
  "wind_max_km_h": 0,
  "rain_mm": 658.80005,
  "mic": "CRC"
}

@frbitten
Copy link
Copy Markdown
Contributor

Could I create a private chat with all the keys for my IOT devices and control and configure them via NOSTR? This way you would be able to use a public relay but keep the data and communication private.

Is this approach possible? What would the event types look like in private chats?

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 16, 2023

Could I create a private chat with all the keys for my IOT devices and control and configure them via NOSTR? This way you would be able to use a public relay but keep the data and communication private.

Is this approach possible? What would the event types look like in private chats?

This is the entire point of the original IoT NIP #814

NIP91 is confusing sensors as IoT devices. A sensor sends data to something that connects to the internet, which is why its an Internet of Things. Any device that can connect to the internet can also encrypt data, even the IoT lightbulbs in my house. What makes nostr IoT special is the very fact I can communicate with devices in my home without having to invite the state and corporations in.

Sure you can do sending of data over clearnet, such as weather stations and the like, but its really not that interesting. Devices could just send data to some server.

A future of IoT with control over our personal networks through tcs, is a serious threat to liberty of humanity. Nostr can and should fix! ALL the IoT devices in my house would be able to connect to a nostr relay and ALL would be able to do encryption.

@frbitten
Copy link
Copy Markdown
Contributor

This is the entire point of the original IoT NIP #814

NIP91 is confusing sensors as IoT devices. A sensor sends data to something that connects to the internet, which is why its an Internet of Things. Any device that can connect to the internet can also encrypt data, even the IoT lightbulbs in my house. What makes nostr IoT special is the very fact I can communicate with devices in my home without having to invite the state and corporations in.

But with MQTT this has been done for some time. What does NOSTR add in addition to what MQTT already does? Having MQTT and having a private nostr relay is not the same thing.

The only advantage I see in using NOSTR for private data is not needing to have a server at home and being able to use the NOSTR network securely.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 16, 2023

Im not advocating a private nostr relay.

Your 2nd point applies to everything that has been built for social networks on nostr

Im saying this nip (91) is fairly redundant, just send data to some open-weather service. It certainly doesn't interest me.

Keeping the state and corps out of personal network does interest me. Did you read the original nip #814 (107)?

Could I create a private chat with all the keys for my IOT devices and control and configure them via NOSTR? This way you would be able to use a public relay but keep the data and communication private.

What you said is the whole point of #814

@vitorpamplona
Copy link
Copy Markdown
Collaborator

@arcbtc You can just GiftWrap the event for the private use case: #716

You don't need the Seal+Rumor solution if you don't want to block the receiver from rebroadcasting the event and breaking privacy. Thus, just create a public 8003 kind as usual and then GiftWrap it on a 1059 kind to make it private

In that way, people watching your relays won't even know you are transferring IoT packages and you help increase the anonymity set of your actual DMs, once DMs get GiftWrapped as well.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 16, 2023

#814 is not reliant on running relays, you can use public relays.

Sure, event can be clearnet or NIP04 (or whatever comes next when its ready).

NIP91 has been created for sensor data only, wholly underestimating the power of pretty much all IoT devices, as if the sensors themselves are the IoT device, which doesn't exist. Even for the dumbest IoT devices its a sensor connected to a micro-controller, that can do everything needed to create a proper event/DM (as outlined in #814)

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 16, 2023

GiftWraps are also not reliant on running relays. That was the point of making them: To privately transfer any sensitive Nostr event through public relays.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 16, 2023

When its ready for DMs LFG!

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 16, 2023

I think the most interesting part of this is standardizing public data broadcasts and using the native Nostr authentication properties to control things that are at least partly public.

If the goal is to send private messages then I don't think we need a NIP, you can just use whatever is the standard for private messages but make devices chat between them using some proprietary messaging mechanism. Or the need for a NIP must be justified better with more concrete use cases.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 16, 2023

I just think it should not be placed inside a kind:4 directly. Otherwise, we will be forcing every DM client to deal with weird JSON files as message contents. They should have their own kinds, public and private if needed, like the ones laid out here.

@frbitten
Copy link
Copy Markdown
Contributor

Wouldn't it make sense to have an update on kind 4 with a tag indicating what the content is from another kind? This way, customers would be able to filter easily and it would be a comprehensive solution for all other possible types.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

Wouldn't it make sense to have an update on kind 4 with a tag indicating what the content is from another kind?

Well, if we care about backward compatibility, that would still break all DM clients out there that will just be showing JSON bare files in the DM screen. A new kind can be just like kind 4 if people want. It just doesn't break existing user interfaces.

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 17, 2023

Why would a normal person try to DM an IoT device and vice-versa?

If they want, shouldn't they be allowed to?
You could just make the IoT device act as a chat bot.
You don't need any NIPs for this.

@Charlie67j
Copy link
Copy Markdown

Charlie67j commented Oct 17, 2023 via email

@shaibearary
Copy link
Copy Markdown

One simple example would be to change the temperature setpoint of your thermostat to make your home warmer before you get there. A similar example in the commercial world might be to remotely allow access to a building, or set lighting levels in a space. In the industrial world it is less common to allow remote control of systems, but rather use for remote monitoring. Safety being the largest reason behind this. The counter to that general rule are systems that by nature are remotely operated. Again, the most common interaction would be changing setpoints for temperature, speed, pressure, etc. of the equipment. IoT devices publishing data from a remote system or site for storing in a database for monitoring, alerting, alarming and reporting will typically be 100,000:1 compared with publishing TO a remote device to change settings, etc. and this is true in residential, commercial, and industrial markets. At scale we expect many gigabytes of data (Sometimes 60+Gb) from a small industrial remote site to flow through an MQTT server each month. It feels to me that there is a general misunderstanding of what IoT/IIoT means/is, the capabilities of existing solutions (including FOSS and open source), and where nostr would be a good fit/addition to the existing technology stacks in residential, commercial, and industrial systems.

On Mon, Oct 16, 2023 at 9:49 PM fiatjaf_ @.> wrote: Why would a normal person try to message an IoT device and vice-versa? — Reply to this email directly, view it on GitHub <#817 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALUGNPB76KELUSIEGFF6J3X7XP3PAVCNFSM6AAAAAA54A7WT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGUZDONBQGE . You are receiving this because you were mentioned.Message ID: @.>

it doesnt have to be DM right?

@frbitten
Copy link
Copy Markdown
Contributor

Why would a normal person try to DM an IoT device and vice-versa?

If they want, shouldn't they be allowed to? You could just make the IoT device act as a chat bot. You don't need any NIPs for this.

What I mentioned was that to not have to have a private relay, I could use a public relay and create a private chat between all my device accounts. So the end, which is the user interface, can receive all messages securely without having to expose data to everyone. Which I think is more complex than using MQTT, which is why I don't see much use in NOSTR for IOT in private data which is the majority of its use.

@motorina0
Copy link
Copy Markdown
Contributor

If the content of the event is encrypted then:
Advantages:

  • it is easier to spinoff a home relay (no SSL configs, which can be a show stopper for many)
  • can publish to public relays with (almost) no privacy lost

Disadvantages:

  • the devices have to do the ecrypt/decrypt logic (the lib is already there for signing and sig verification)
  • the device that publishes the data (sensor) can only encrypt for one receiver. If more receivers are needed, then different events have to be published.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 18, 2023

The whole purpose of IoT over Nostr is to circumvent Orwellian TCs in IoT software and hardware, which is achieved by encryption (something all IoT devices can do).

Thats what is outlined in the original proposal #814, and that is what nostr IoT SHOULD be. Not this strange lorawan over websockets affair

This NiP (91), is VERY confused, treating nostr like lorawan, sending instructions as event kinds, even though the device will be communicating over websockets NOT lorawan, AND most communication will be to non-generic devices. ie my solar batteries battery manage system, sending array of non-generic sensor data and I will send an array of instructions back.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 18, 2023

Why would a normal person try to DM an IoT device and vice-versa?

If they want, shouldn't they be allowed to? You could just make the IoT device act as a chat bot. You don't need any NIPs for this.

Nonesense, that data structure should be the same. Something simple like a light would share clear obvious commands on/off, timer etc. there will be some generic commands. Most IoT devices will not have generic commands and sensor data, which invalidates NIP91 entire event kind proposal. We are talking Internet of Things, all the things, not just a wind sensor sending data over lorawan.

It must be encrypted and generic enough for many devices, but also have "some" shared data types. Like #814

IoT devices are just clients and clients who need privacy to communicate between themselves or with users. All are just clients, with tha right to privacy. Privacy is what makes nostr IoT great.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 18, 2023

Wouldn't it make sense to have an update on kind 4 with a tag indicating what the content is from another kind?

Well, if we care about backward compatibility, that would still break all DM clients out there that will just be showing JSON bare files in the DM screen. A new kind can be just like kind 4 if people want. It just doesn't break existing user interfaces.

We just need a flag (not social media). NIP04 is used in nostr market as well. NIP04 is just encrypted data, social media doesn't have the monopoly on that

@frbitten
Copy link
Copy Markdown
Contributor

Wouldn't it make sense to have an update on kind 4 with a tag indicating what the content is from another kind?

Well, if we care about backward compatibility, that would still break all DM clients out there that will just be showing JSON bare files in the DM screen. A new kind can be just like kind 4 if people want. It just doesn't break existing user interfaces.

We just need a flag (not social media). NIP04 is used in nostr market as well. NIP04 is just encrypted data, social media doesn't have the monopoly on that

My issue is that there is no standard. Therefore, each entity dictates the format that interests it and therefore it is not possible to easily integrate several devices.
If there were a standard format, even within NIP04 it would be easy to have an application that could talk to numerous devices quickly.

@arcbtc
Copy link
Copy Markdown
Contributor

arcbtc commented Oct 18, 2023

Which is why there are common tag types in #814
For those that share generic commands/sensor-readings.
For many IoT devices they have custom commands/sensor-readings.
In #814 a device could send/receive multiple commands/readings in the same note. Its more defining a note structure. Much of NIP15 markets is data sent over NIP04

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 18, 2023

Can we leave this NIP proposal open for public IoT data -- private IoT data goes in the discussion on the other NIP, how about that?

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 18, 2023

I would strongly suggest separating device status updates and IoT data streams from an RPC interface with the IoT device. It doesn't make any sense to use the same kinds for both use cases.

@motorina0
Copy link
Copy Markdown
Contributor

My issue is that there is no standard. Therefore, each entity dictates the format that interests it and therefore it is not possible to easily integrate several devices.

  • the standard is what we have to define in this/some NIP
  • this is already done in other NIPs. For example in the Nostr Market - NIP15 there is a JSON structure defined for DMs. Clients and Merchants that follow this standard can do commerce.
  • we need to create generic enough data structures for IoT that accommodate current and future sensor data and commands

@motorina0
Copy link
Copy Markdown
Contributor

I would strongly suggest separating device status updates and IoT data streams from an RPC interface with the IoT device. It doesn't make any sense to use the same kinds for both use cases.

  • can't we simplify and see the entire Nostr IoT as devices DM-ing each other?
  • the DM content can be sensor data or command data (JSON structures to be defined, see NIP 15 as an example)

Note:

  • devices only publish and listen to certain allowed pubkeys (not to the entire world) so new kinds and tags become kind of redundant.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 19, 2023

All event kinds can be DMs. Just encrypt and p-tag the receiver. There is no reason to force the use the text DM for RPC calls.

This is why almost no one implements NIP-15, but most clients implement NIP-47, which is a similar RPC strategy.

@motorina0
Copy link
Copy Markdown
Contributor

This is why almost no one implements NIP-15, but most clients implement NIP-47, which is a similar RPC strategy.

Clarifications:

  • NIP-15 is a market place with stores, products, orders and payments (all stored on Nostr, no web-server required)
  • NIP-47 is a way of reaching your lightning wallet over Nostr
  • the two NIPs have a slight overlapping on the payment part
  • a NIP-15 application can support NIP-47 for allowing a new mode of payment

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 19, 2023

a NIP-15 application can support NIP-47 for allowing a new mode of payment

Yes. And yet, no one is doing that. In fact, NIP-47, NIP-46, and DVMs are all older than NIP-15 and their authors went to the trouble of creating brand new NIPs to avoid using NIP-15's scheme. That should tell you how much people dislike the approach.

The only way to use a kind:04 or kind:14 (with GiftWraps) to talk to IoT devices is to create a natural language interface (like ChatGPT/Voice assistants). No JSONs, no HTMLs whatsoever. Otherwise, all it's going to do is break the UX of chat clients with ugly machine code.

Create separate kinds for separate payloads. Then clients can decide to support the kind and appropriately render it or not.

@motorina0
Copy link
Copy Markdown
Contributor

I think this discussion is derailing a little bit, my comments:

NIP-47, NIP-46, and DVMs are all older than NIP-15 and their authors went to the trouble of creating brand new NIPs to avoid using NIP-15's scheme.

  • if they are older they could not try avoid something from the future

Otherwise, all it's going to do is break the UX of chat clients with ugly machine code.

I think I see where the confusion lies:

  • We are still discussing in the social-network/chat-app context. Which is NOT the case. The devices don't "socialize" they don't go on chat apps.
  • I will NOT enter my "human" private into a device.
  • I will NOT enter my thermostat's private key into a chat app, UNLESS:
    • I want to use the chat app to test that my device is working (which is OK)

Create separate kinds for separate payloads.

  • this is not such a big deal, it could be done. Is the kind value the main concern here?
  • one small advantage of using kind: 4 is more privacy. The event does not leak that is a IoT related one.

Then clients can decide to support the kind and appropriately render it or not.

  • the clients don't care about random DMs on the relay, they ONLY care about DMs to/from them.
  • the normal chat clients are not affected in any way unless they know a device's pubkey and explicitly want to communicate with it.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 19, 2023

Is the kind value the main concern here?

Yes, this is why this PR exists: To define event kinds and payloads away from kind:4.

But you are failing to see the reason. Clients choose which types to support. A decision to support human DMs should not mean that you have to parse all the stuff that comes from IoT devices and vice versa. There is no point in mixing the two (human and machine code). Both sides lose when it happens.

A client that supports kind:4 supports human DMs.
A client that supports each of the kinds listed here support each of the IoT services, each with their own payload definition.

Clients can then choose to support only Temperature sensors and nothing else. It makes everybody's life easier.

@motorina0
Copy link
Copy Markdown
Contributor

Show me where it is specified (implicit or explicit) that NIP04 MUST be "human readable". That is just a social-network bias.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 19, 2023

Kind:4 was made by and for social networking clients. Same for the new kind:14. If you don't want social networking bias, don't use those specific numbers. You can choose any other of the 65000 event kind options to do a non-biased/machine version of DMs. You don't need to use the same old DM kind to transfer new payloads.

@motorina0
Copy link
Copy Markdown
Contributor

OK, enough of this. Some serious questions which in my opinion are blockers.

To all participants in this thread:

  • please help me with your answers so we can move forward (or let me know if the questions are stupid)

Questions:

  1. must ALL the IoT data published to public relays be encrypted?
  2. can some of the IoT data stay in clear text (eg: reveal that it is a temperature event, but encrypt the value of it)?
  3. does an IoT Client App actually query for particular kinds and tags or only for pubkeys?
    • in the real world a user knows its devices and each device has its own pubkey
    • the user does not want "any temperature event", just the ones from its devices
    • a user will add the pubkeys of the devices on its IoT Client App
    • anIoT Client App will not query for kind alone since it can get data from unwanted devices
  4. how can a a device broadcast its encrypted state to multiple listeners without publishing multiple events

My answers:

  1. yes
  2. no
  3. no
  4. I don't know. There might be a NIP for this that I'm not aware of.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 19, 2023

  1. No, Nostr should offer public and private data feeds. Maybe in different NIPs, different authors, different operations, but over time options will be there for sure.

  2. Yes. Not everything must be extremely private to the point of not even leaking the type of event. Over time, we will definitely have options for: (i) extreme privacy, where no metadata leaks using something like GiftWrapps & Rumors to avoid verifiable leaks; (ii) semi-private, where a regular kind:4/kind:44-encrypted payload that exposes metadata - event type, people involved, date/time, and other indexing options - are used, and (iii) fully public, where information is visible to everyone. Different use cases will need to use different types.

  3. Yes. IoT Clients will never support EVERYTHING IoT. It's too broad. They will have to choose which types of IoT payloads they will want to support. Making a separate kind for each one of those choices is the Nostr-native way to go. We can try to group them into types that make sense but breaking the field down is necessary to keep things simple and interoperable for implementers.

  4. DMs will never work for this. You will have to encrypt to some type of shared secret to avoid duplicating a ton of data for each receiver. There are multiple ways to do this, but all of them is based on clients sharing the knowledge of a secret. And that secret can leak, thus Trust between all receivers is paramount.

It's fine to take just one of these use cases to make a NIP for your needs. Just be aware that others will definitely exist.

@frbitten
Copy link
Copy Markdown
Contributor

  1. DMs will never work for this. You will have to encrypt to some type of shared secret to avoid duplicating a ton of data for each receiver. There are multiple ways to do this, but all of them is based on clients sharing the knowledge of a secret. And that secret can leak, thus Trust between all receivers is paramount.

It's fine to take just one of these use cases to make a NIP for your needs. Just be aware that others will definitely exist.

  1. Do chats/groups not use encrypted messages, allowing only those who are part of it to have access to the content? Couldn't I create a chat between my app and the devices?
    Use cases where a device needs to send messages to a large number of listeners? I couldn't imagine a scenario where this number would be greater than 5. Because there will always be something to centralize actions and decisions.

@vitorpamplona
Copy link
Copy Markdown
Collaborator

vitorpamplona commented Oct 19, 2023

Do chats/groups not use encrypted messages, allowing only those who are part of it to have access to the content? Couldn't I create a chat between my app and the devices?

There are chats where the same message is encrypted to each receiver, which works well for small groups, and there are NIPs for large groups. Those require a shared secret of some sort.

Use cases where a device needs to send messages to a large number of listeners? I couldn't imagine a scenario where this number would be greater than 5. Because there will always be something to centralize actions and decisions.

Yep, I don't see it as well. I am close to two kinds of IoT:

  • Healthcare IoT, which must take the extreme privacy route through public relays and will most likely never be shared with anyone but the owner and maybe their doctor. Giftwrapping this stream for each receiver is more than enough.
  • Manufacturing IoT, which will likely take a public event in a private relay. There will be 1000s of sensors and lots of heavy data mining going on. So, the collection is somewhat private, but each event must be public to run data mining quickly enough. Leaking is not as important.

There will be public sensors: weather stations, crowd-control systems, traffic counting devices, etc. Those are all public.

Then there is the smart home stuff, whose control (write access) is generally shared between 2-3 accounts. GiftWrapping those should be fine as well.

@fiatjaf
Copy link
Copy Markdown
Member Author

fiatjaf commented Oct 20, 2023

@motorina0 I think these questions make no sense because there are two completely different use cases at play here. One is a kind of RPC interface between private devices. These can use a single encrypted event kind for these devices to talk between each other, and we can maybe standardize some kind of JSON-RPC interface between them.

The other -- which this PR is about -- is just public data being broadcasted to the world for everyone to see, so no encryption ever at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.