Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ShinoharaTa opened this issue Sep 18, 2024 · 1 comment

Comments

@ShinoharaTa
Copy link

ShinoharaTa commented Sep 18, 2024

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.

@staab
Copy link
Member

staab commented Sep 18, 2024

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.

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

No branches or pull requests

2 participants