Skip to content

NIP-AD: Nostr Web Addresses#2406

Open
fiatjaf wants to merge 2 commits into
masterfrom
web-addresses
Open

NIP-AD: Nostr Web Addresses#2406
fiatjaf wants to merge 2 commits into
masterfrom
web-addresses

Conversation

@fiatjaf

@fiatjaf fiatjaf commented Jul 2, 2026

Copy link
Copy Markdown
Member

The successor to #2393.

Read here.

@pablof7z

pablof7z commented Jul 2, 2026

Copy link
Copy Markdown
Member

Insanely cool!

@pablof7z

pablof7z commented Jul 2, 2026

Copy link
Copy Markdown
Member

I'm assuming relays attribute is optional and if missing use the 10002 of the authors. Right?

@fiatjaf

fiatjaf commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

No, if relays don't exist use "relay.damus.io".

@alexgleason

Copy link
Copy Markdown
Member

Very interesting. What are you working on that inspired this?

In a client like Ditto, I suppose I would fetch every URL I see in any event, and potentially "enrich" the way it's displayed.

Comment thread AD.md
2. [NIP-5A](5A.md) nsites: `nsites.com/something` resolves to an nsite event.
3. Hosted feeds: servers can create feeds using whatever algorithm they want and publish those simply as a `{"ids": [...]}` filter, or something else.
4. People that have websites and blogs fueled by Nostr content can have those sites exist both natively inside Nostr and to people living outside. This also works for `https://njump.me/nevent1...` or client-specific URLs like `https://yakihonne.com/nevent1...`.
5. This fixes pasted links: when a user pastes a URL on a Nostr client the client can preemptively try to resolve that URL into an event and make a native reference instead.

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.

Implementers should be considerate of the usecase: "your client shows it like that? Look how my client shows it: https://webclient.xyz/nevent1..."

People should still have the option to click the original link and not have it completely replaced by something else. Of course it depends on the type of client and type of link.

I don't think any wording needs to be changed, just wanted to note it.

Comment thread AD.md

Such URLs, when pasted on a Nostr client, can be turned into a single event (specially when the filter has `"limit": 1`) or a list of events, and handled accordingly. When used in a normal web browser it can just render HTML like any normal web URL.

To get the Nostr counterpart of any URL, call that URL's domain at path `https://<domain>/.well-known/nostr.json?ad=<original-path>` and look for a key with the desired path in the resulting object. That should contain an object with `{"filter": {<any-nostr-filter>}, "relays": [<relay-to-use>, ...]}`. `"relays"` is optional. If it doesn't exist the `kind:10002` "write" relays of the authors in the filter should be used.

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.

There's slight ambiguity in what <original-path> should be. Clients should probably drop any hash but include any query string. Servers should percent decode so a URL like this still works:

https://golf.com/.well-known/nostr.json?ad=%2Fplayers

and this:

https://golf.com/.well-known/nostr.json?ad=%2Fplayers%3Fplayer%3DMario%26player%3DLuigi

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.

No, let's drop query strings entirely. They are super annoying.

Comment thread AD.md

Such URLs, when pasted on a Nostr client, can be turned into a single event (specially when the filter has `"limit": 1`) or a list of events, and handled accordingly. When used in a normal web browser it can just render HTML like any normal web URL.

To get the Nostr counterpart of any URL, call that URL's domain at path `https://<domain>/.well-known/nostr.json?ad=<original-path>` and look for a key with the desired path in the resulting object. That should contain an object with `{"filter": {<any-nostr-filter>}, "relays": [<relay-to-use>, ...]}`. `"relays"` is optional. If it doesn't exist the `kind:10002` "write" relays of the authors in the filter should be used.

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.

Using ad as the parameter is slightly bothersome. Why am I thinking about the resurrection of Christ while I'm implementing Nostr URL resolution? NIP-05 doesn't say nostr.json?05= it says nostr.json?name=. So I would think nostr.json?url= or nostr.json?path=

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.

It's not about Christ; @fiatjaf wants to sell us ads, obviously

@fiatjaf fiatjaf Jul 2, 2026

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.

Everything is arbitrary, but I'm fine with ?path=.

@arthurfranca

Copy link
Copy Markdown
Contributor

Instead of https://golf.com/players what if we use a convention of adding /n path as a hint to clients like https://golf.com/n/players?

@pablof7z

pablof7z commented Jul 2, 2026

Copy link
Copy Markdown
Member

No, if relays don't exist use "relay.damus.io".

Too late, I used relay.nostr.band but it doesn't work; I'll try again tomorrow

@pablof7z

pablof7z commented Jul 2, 2026

Copy link
Copy Markdown
Member

Instead of https://golf.com/players what if we use a convention of adding /n path as a hint to clients like https://golf.com/n/players?

Why? It can be whatever url you wanted to be

@arthurfranca

arthurfranca commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why? It can be whatever url you wanted to be

Just so that a client won't need to request https://<domain>/.well-known/nostr.json?ad=... for every url it sees, just for those (edit: that hint support) with <domain>/n.

Though I'm not sure if the idea is good, cause there are benefits to not using /n such as this NIP becoming a link preview standard for any url.

@fiatjaf

fiatjaf commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

In a client like Ditto, I suppose I would fetch every URL I see in any event, and potentially "enrich" the way it's displayed.

This is good too, but I really think doing that preemptively before publishing the event (of course it has to be done by the publisher) is the most important thing, otherwise events will be full of broken links in the near future, instead of what could have been static Nostr references.

@fiatjaf

fiatjaf commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

What are you working on that inspired this?

My main motivation was the NIP-29 groups use case, but its scope got a little bit overblown and then @pablof7z's suggestion on the other PR made it even bigger.

@fiatjaf

fiatjaf commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

I am very afraid this will cause people to abuse URLs too much and tie Nostr to the broken DNS game, but I'm hoping for the best.

@staab

staab commented Jul 2, 2026

Copy link
Copy Markdown
Member

I really think doing that preemptively before publishing the event (of course it has to be done by the publisher) is the most important thing

I think the opposite, readers can parse and display whatever they want, but publishers should not re-write users' intent. We had this same debate a long time ago when people proposed doing this to any link that included an nevent. Re-writing user intent would make it very hard to share links to specific clients without wrapping them in backticks or something.

@fiatjaf

fiatjaf commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

I really think doing that preemptively before publishing the event (of course it has to be done by the publisher) is the most important thing

I think the opposite, readers can parse and display whatever they want, but publishers should not re-write users' intent. We had this same debate a long time ago when people proposed doing this to any link that included an nevent. Re-writing user intent would make it very hard to share links to specific clients without wrapping them in backticks or something.

So you think it is better for Nostr if people start filling events with dead links? That's a hard thing to defend.

I'm not advocating for rewriting of user intent, just a nudge into the correct direction (which in 99% of the cases is what the users want anyway).

Clients already suggest you to fill the note with a nostr:npub1... reference when you type a username like @name and no one is unhappy about that. Also no one is saying: "users should just write a literal @name in the content and let the readers do the searching for that name locally at read time".

@alexgleason

Copy link
Copy Markdown
Member

Both are true

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.

5 participants