Skip to content

Improving Nip01 Text#963

Closed
vitorpamplona wants to merge 38 commits intonostr-protocol:masterfrom
vitorpamplona:improving-nip01
Closed

Improving Nip01 Text#963
vitorpamplona wants to merge 38 commits intonostr-protocol:masterfrom
vitorpamplona:improving-nip01

Conversation

@vitorpamplona
Copy link
Copy Markdown
Collaborator

@vitorpamplona vitorpamplona commented Jan 3, 2024

I have added some missing info and reduced some of the verbosity of the text. Moved kind:1 definition to NIP-10 (since it's not mandatory) and added descriptions about the replaceable tags.

Is this better?

Read here

@arthurfranca
Copy link
Copy Markdown
Contributor

It looks better.
One important thing that got deleted was the implied descending sort order if using limit filter when the original text said "last n events ordered by the created_at"

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

Yep, it was duplicated. I kept only in the json descriptor.

01.md Outdated
* `["EVENT", <subscription_id>, <JSON-serialized string of the event>]`, used to send events requested by clients.
* `["EOSE", <subscription_id>]`, used to indicate the _end of stored events_ and the beginning of events newly received in real-time.
* `["CLOSED", <subscription_id>, <message>]`, used to indicate that a subscription was ended on the server side.
* `["CLOSED", <subscription_id>, <prefix>:<message>]`, used to indicate that a subscription was ended on the server side.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why isn't the OK message listed here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I split them into a subscription protocol and a publishing protocol.

@fiatjaf
Copy link
Copy Markdown
Member

fiatjaf commented Jan 4, 2024

I like this, let's do it.

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

vitorpamplona commented Jan 4, 2024

@fiatjaf maybe later we can move the NOTICE part to a non-mandatory NIP. They are cool, but I think we must make NIP-01's feature set as small as possible while still covering the entire protocol.

01.md Outdated
This NIP defines the mandatory part of the Nostr protocol. New NIPs may add new optional (or mandatory) fields, messages, and features to the structures and flows described here.

## Events and signatures
# Events
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I always call these Notes instead of Events in my codebases, but maybe the ship has sailed on that one because of ["EVENT",...]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"event" was probably a poor name choice, but "relay" too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought kind 1 events are "notes". All notes are events but not all events are notes.

- [NIP-08: Handling Mentions](08.md) --- **unrecommended**: deprecated in favor of [NIP-27](27.md)
- [NIP-09: Event Deletion](09.md)
- [NIP-10: Conventions for clients' use of `e` and `p` tags in text events](10.md)
- [NIP-10: Text Notes](10.md)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIP-10 is more about threads than Text Notes, you can have threaded events of different kinds.

Copy link
Copy Markdown
Collaborator Author

@vitorpamplona vitorpamplona Jan 4, 2024

Choose a reason for hiding this comment

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

NIP-10 is more about threads than Text Notes

Yes, but I think we need a place to coalesce all behaviors that are specific to kind:1. Getting it out of NIP01 opens space to add much more information about what should and should not be on kind 1s. NIP-10 can easily become that home since it was already kind1 specific.

threaded events of different kinds

The e and a definitions has been moved to NIP-01 since the previous restructuring. Now NIP-10 only defines what those mean for the kind:1 context.

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

FYI, I just noticed NIP01 never defines the type of each attribute in the Relay protocol messages. I think this new hack of using the js syntax highlight can be quite effective to separate type and description in a <> inside the json.

@fiatjaf
Copy link
Copy Markdown
Member

fiatjaf commented Jan 4, 2024

What if we moved the basic protocol stuff to NIP-00 and used NIP-01 for the "basic microblogging client flow" including kind 0 and kind 1 -- then we can even include implementation recommendations like to which relays connect and how to better load threads, for example? Even conflicting alternative recommendations if that's the case.

@staab
Copy link
Copy Markdown
Member

staab commented Jan 4, 2024

I think if we're going to restructure things that heavily, we might as well get rid of the NIP system

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

I do think it makes sense to separate the basic microblogging stuff out of the core protocol discussion but I am not sure the "basic microblogging stuff" is a well-defined set right now. For instance, I don't consider kind:0 to be "microblogging stuff".

@pablof7z
Copy link
Copy Markdown
Member

pablof7z commented Jan 5, 2024

ACK on moving nip-01 to nip-00 and extracting the microblogging flow to it's own NIP.

I agree with @vitorpamplona in that kind:0 is not part of the microblogging flow

@alexgleason
Copy link
Copy Markdown
Member

What if we moved the basic protocol stuff to NIP-00

It will make NIP-11's supported_nips potentially wrong. One thing I noticed after a bunch of NIPs were combined into NIP-01 is that you can no longer tell which relays support replaceable events or parameterized events.

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

which relays support replaceable events or parameterized events

In theory, both are required to be supported these days.

@pablof7z
Copy link
Copy Markdown
Member

pablof7z commented Jan 6, 2024

It will make NIP-11's supported_nips potentially wrong.

Only as far as supported_nips not indicating that NIP-00 is supported, but given that NIP-00 is required that can be implied (otherwise it's not nostr and you wouldn't see a supported_nips at all)

The only caveat is that NIP-01 must remain backward-compatible so relays don't lie when they say they support NIP-01.

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

This is also ready to merge if people agree it's better than the current NIP-01 description.

01.md Outdated
All single-letter (only English alphabet letters: a-z, A-Z) tag names are indexed by relays for faster queries.

These are just conventions and relay implementations may differ.
This NIP defines the format of 3 standard tags: `e`, `p`, and `a`. Tags `e`, `p` can be used to reference events and pubkeys respectively, and tag `a` references the latest version of a replaceable event. Clients MAY `a`- and `e`-tag parameterized replaceables simultaneously.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
This NIP defines the format of 3 standard tags: `e`, `p`, and `a`. Tags `e`, `p` can be used to reference events and pubkeys respectively, and tag `a` references the latest version of a replaceable event. Clients MAY `a`- and `e`-tag parameterized replaceables simultaneously.
This NIP defines the format of 4 standard tags: `e`, `p`, `a` and `d`. Tags `e`, `p` can be used to reference events and pubkeys respectively, and tag `a` references the latest version of a replaceable event. Clients MAY set `a`- and `e`-tag parameterized replaceables simultaneously.

Copy link
Copy Markdown
Collaborator Author

@vitorpamplona vitorpamplona Jan 11, 2024

Choose a reason for hiding this comment

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

Do we really need to duplicate the definition here? Tag d was already defined in the previous section.

Comment on lines +98 to +103
| Name | Value | Other Params |
| ---- | ---------------------------------------------------------- | ----------------------- |
| `e` | `<32-byte lowercase hex of an event id>` | `<relay URL, optional>` |
| `p` | `<32-byte lowercase hex of a pubkey>` | `<relay URL, optional>` |
| `a` | `<kind>:<32-byte lowercase hex of a pubkey>:` | `<relay URL, optional>` |
| `a` | `<kind>:<32-byte lowercase hex of a pubkey>:<d-tag value>` | `<relay URL, optional>` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where is now #d ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

hum.. I was hoping d wouldn't be part of this table since it's different than the other referencing tags.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let me explain why I have difficulties with the "d" tag.
I looked at the README and saw: "Aha, there's an official #d. Let me have a look at what this means."
I then go to NIP-01 where it's supposed to be defined. I ctrl-f through the page on GitHub and don't find it.

After your PR here, when I ctrl-f, I'll still be confused because I'm lazy and I'll find two things:

  • A statement saying

    This NIP defines the format of 3 standard tags: e, p, and a.

    Where the heck is now #d?

  • A table with e, p and a
    Why the heck is it missing #d?

01.md Outdated
# Signed Events

Event is the only object type available. It is a hashed and signed payload in the following format:
Events are the only data type transferred across the network. They consist in 4 main attributes:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5 main attributes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

3 m'lord, 3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

6 if you count id?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5 things are hashed: pubkey, created_at, kind, tags, and content. The other 2 are generated: id, sig

@vitorpamplona
Copy link
Copy Markdown
Collaborator Author

Closing this due to partial adoption via other PRs. Though I still think the Relay section is better described here (separated by action) than in the current nip01.

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.

10 participants