nips icon indicating copy to clipboard operation
nips copied to clipboard

Feature Request: Define New Kinds for Cumulative Database Functionality in Nostr

Open ShinoharaTa opened this issue 1 year ago • 4 comments
trafficstars

I view Nostr as an open database. However, using kind 30078 requires constantly monitoring the original values, which makes it unsuitable for use as a cumulative database.

To utilize Nostr as a cumulative database for topics and records, I would like to propose defining new kinds. Additionally, I aim to define the data structure using NIP numbers.

Proposed Data Structure

{
  ...
  "content": "{\"title\": \"The workout log.\", \"about\": \"my training logs.\"}",
  "tags": [
    ["d", database_identify_name],
  ],
  ...
}

The basic structure involves using kind n to define title, about, and other fields in the database. In the tags, the "d" tag will be used to include identifiers such as table names.

Using kind n+1, the identifier is updated. The "e" tag will be used to associate with events of kind n, enabling the retrieval of lists. The data will be stored as JSON strings in the content field, allowing flexibility in data representation.

{
  ...
  "content": "data object to string",
  "tags": [
    ["e", <database_create_event_id>, <relay-url>],
  ],
  ...
}

Rationale

While this approach is very similar to kind 40, 41, 42 used in Public Chat, it should be classified separately to serve distinct roles from Public Chat functionalities.

Currently, I considered combining kind 1 with hashtags, but this approach would lead to timeline pollution, making it unsuitable for my intended use.

Benefits

Implementing this mechanism would allow, for example:

Daily Workout Logs: Users can maintain daily workout records and compare them with friends. Relay Monitoring: It becomes easy to monitor the operational status of relays and keep logs akin to system logs. Conclusion

Defining new kinds for cumulative database usage in Nostr will enhance its functionality and provide more structured and efficient ways to manage and retrieve data without the need for constant monitoring of original values.

ShinoharaTa avatar Sep 18 '24 01:09 ShinoharaTa

Normally, it's best practice to create a new kind for each new data type. What you're doing (and what nip 78 is doing) is creating a namespace-within-a-namespace. Better to just use kinds, unless you have no aspirations for interoperability. If that's the case, I wouldn't object to an PR to NIP 78 that adds support for non-replaceable events. Just be aware that using public relays for this kind of thing may be considered spam.

staab avatar Sep 18 '24 15:09 staab

Currently, I considered combining kind 1 with hashtags, but this approach would lead to timeline pollution, making it unsuitable for my intended use.

Do you want to just create kind 1 posts that are seen only under the hashtag? If so #1233 is for you

vitorpamplona avatar Sep 24 '24 20:09 vitorpamplona

PR to NIP 78 that adds support for non-replaceable events

That should be done regardless.

fiatjaf avatar Sep 24 '24 20:09 fiatjaf

Thank you for your feedback. I will submit a PR to add kind ~30079~ 7078 to NIP-78.

ShinoharaTa avatar Sep 26 '24 16:09 ShinoharaTa

I'll close this issue because #1518 is open.

AsaiToshiya avatar Jan 02 '25 17:01 AsaiToshiya