NipId & NIP References

NipId & NIP References

draft

This NIP extends NIP-73 “External References” to allow ‘all of nostr’ to reference, comment, and react on any published NIP spec in a standardized manner, regardless of which repo or nostr event kind they are posted to. It ALSO establishes a NipId convention by which NIPs from ANY source can be identified universally, which MAY prove useful in other cases.

NipId

Seeing as :

  • ANY Nostr event kind or public website MAY become a source for published Nostr NIPS,
  • AND NO SINGLE website or app or service can reliably claim to be THE canonical source,
  • AND NO SINGLE author or version of a proposal can possibly claim to be the final “way things are done” on Nostr,
  • AND EVERY implementer (and the protocol itself) COULD benefit by having a standardized access to these proposals,
  • AND such a standard SHOULD follow the Nostr protocol for referencing addressable events (content which MAY change over time),
  • AND a working protocol CANNOT be established on a body of NIPs whose content MAY be constantly changing and evolving,

Therefore :

This NIP establishes the following NipId standard, a colon : separated format for identifying a Nostr NIP proposal from ANY source :

// canonical NipId reference format
<source>:<author>:localid>:<version?>

// specific NipId format for NIPs proposed in Nostr event kinds
<kind>:<pubkey>:<d_tag>:<created_at?>

// specific NipId format for NIPs proposed in online NIP repositories
<domain>:<user_name>/<repo_name?>:<file_name>:<commit_id?>

Where :

  1. source :
  • For NIPS published as Nostr events, this is the event kind (unsigned integer) number.
  • OTHERWISE, this is a domain (URI hostname) where the NIP is published.
  1. author :
  • For NIPS published as Nostr events, this is the author pubkey (32-bytes lowercase hex).
  • OTHERWISE, this is a URI encoded user_name and maybe a repo_name, separated by a single backslash /.
  1. localid :
  • For NIPS published as Nostr events, this is the event’s d tag value.
  • OTHERWISE, this can be any file_name in URL slug format (without a file extension).
  1. version (OPTIONAL) :
  • For NIPS published as Nostr events, this is the event’s created_at value.
  • OTHERWISE, this is a repo branch or tag name OR some other string referencing a single IMMUTABLE saved version of this NIP. IF OMITTED, the latest version is ALWAYS the one being referenced.

Examples :

  • github.com:nostr-protocol/nips:73 : NIP-73 on the primary nips repo
  • 30817:0461fcbecc4c3374439932d6b8f11269ccdb7cc973ad7a50ae362db135a474dd:nips-on-nostr : “Custom Nips” NIP by Alex Gleason (latest)
  • 30818:fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1:nkbip-01 : NKBIP-01 by Laeserin (latest)
  • 30817:df67f9a7e41125745cbe7acfbdcd03691780c643df7bad70f5d2108f2d4fc200:versioned-event-kinds:1766760671 : “Versioned Event Kinds” by ManiMe (version)
  • git.vanderwarker.family:nostr/snips:02:b3e05871f03872c413d289c2d405c8f77927c0b9 : SNIP-02 by Stephen Vanderwarker (version)

External References

NIP-73 standard i tags MAY be used to reference NIPs as external content (using NipId consistently across all use cases), with k tag identifying the (preceding) reference as a ‘nip’.

Type i tag k tag
Nostr NIPs ["i", "<nipid>", "<url_hint>", "<rel>"] ["k","nip"]

the i tag :

  1. A NipId (as specified above) MUST be the first argument of a NIP reference i tag.
  2. A URL hint MAY be added as the second argument of the i tag, to suggest a web page without hard linking the reference to a specific repo or nostr client.
  3. A rel string MAY be added as the third argument of the i tag, to designate this referenced NIP as being upstream, preferred, alternate, deprecated, suggested, related, or having some other relationship to the current event. (useful when forking or commenting about NIP events)

the k tag

  1. A k tag MUST directly follow the i tag and it MUST have nip as its value.

Examples :

A reference to a NIP published in the GitHub “primary” NIPs repo SHOULD look like this:

// preferred format matches `a` tag
// <repo-domain>:<repo-owner>/<repo-name>:<NIP-identifier>
[
  ["i", "github.com:nostr-protocol/nips:73", "https://github.com/nostr-protocol/nips/blob/master/73.md", "upstream"],
  ["k", "nip"]
]
// deprecated format matches arbitrary NIP number
[
  ["i", "73", "https://github.com/nostr-protocol/nips/blob/master/73.md"],
  ["k", "nip"]
]

A reference to a NIP published as kind 30817 to NostrHub SHOULD look like this:

// format matches `a` tag
// <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>
[
  ["i", "30817:0461fcbecc4c3374439932d6b8f11269ccdb7cc973ad7a50ae362db135a474dd:nips-on-nostr", "https://nostrhub.io/naddr1qvzqqqrcvypzqprpljlvcnpnw3pejvkkhrc3y6wvmd7vjuad0fg2ud3dky66gaxaqqxku6tswvkk7m3ddehhxarjqk4nmy", "related"],
  ["k", "nip"]
]

A reference to a NIP published as kind 30818 to WikiStr SHOULD look like this:

// format matches `a` tag
// <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>
[
  ["i", "30818:fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1:nkbip-01", "https://wikistr.com/nkbip-01*fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1"],
  ["k", "nip"]
]

Looking for comments…

Searching Nostr relays. This may take a moment the first time this article is opened.