Repository navigation
NIP-106 Decentralized Web Hosting on Nostr - #811
Open
studiokaiji wants to merge 7 commits into
Open
studiokaiji wants to merge 7 commits into
studiokaiji wants to merge 7 commits into
Conversation
AsaiToshiya
reviewed
Oct 24, 2023
| } | ||
| ``` | ||
|
|
||
| Moreover, internal links within the `content` should be assigned NIP-33 identifiers instead of event IDs. |
Collaborator
There was a problem hiding this comment.
Will internal links change to NIP-21 naddr?
Author
There was a problem hiding this comment.
Yes. All internal links will be replaced with naddr format.
Comment on lines
+16
to
+18
| - HTML: `kind: 5392` | ||
| - CSS: `kind: 5393` | ||
| - JS: `kind: 5394` |
Collaborator
There was a problem hiding this comment.
I'm not going to make a noise, but I feel like don't need regular events.
Co-authored-by: Asai Toshiya <to.asai.60@gmail.com>
AsaiToshiya
reviewed
Oct 24, 2023
Closed
Copy edits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NIP-106 Decentralized Web Hosting on Nostr
By recording HTML, CSS, and JS on the Nostr relay, it becomes possible to create a decentralized web hosting solution that eliminates the need for centralized servers. Web servers or Nostr clients retrieve these recorded data, transform them into appropriate forms, and deliver them.
Reasons for Hosting on Nostr
Proposed Approach
Each HTML, CSS, and JS file is assigned a
kindfor identification.kind: 5392kind: 5393kind: 5394The "content" field contains the content of the file. However, internal links (
href,src, etc.) referenced within should be replaced with event IDs.Example:
<link rel="stylesheet" href="066b7ca0b167f0adad5c6d619ab1177050423e3979e83b8dfa069992533bdcf5">Implementation on Web Server or Client
Access events using
/e/{nevent}. Since eventneventare specified for each internal link, opening an HTML file enables automatic retrieval of data from this endpoint.By using
nevent, you can expedite the retrieval of relay information by including it internally, which offers the advantage of speed. However, it is also acceptable to implement the retrieval in the usual hex format as an option.Implementation Example (Golang)
Replaceable Decentralized Web Hosting
Additionally, this proposal can be extended to incorporate the NIP-33 based decentralized web hosting specification. This allows tracking of website data with a single identifier, keeping URL paths immutable.
Following the NIP-33 specification, the
kindwould be as follows.kind: 35392kind: 35393kind: 35394Identifiers must be included within the
dtag.Example
{ ..., "kind": 35392, "tags": [["d", "hostr-lp"]] }Moreover, internal links within the
contentshould be assigned NIP-33 identifiers instead of event IDs.Identifier Format
[html_identifier][filepath]Example:
hostr-lphostr-lp/assets/index-ab834f60.cssImplementation on Web Server or Client
Events can be accessed through
/p/{author_hex}/d/{d_tag}.Implementation Example (Golang)
Web Server Implementation Vulnerabilities
The current web server implementation allows access to websites within a single domain. While this reduces the implementation complexity on the server side and provides resilience against blocking, it is not suitable for use with domain-based authorization systems (such as NIP-07). For instance, if signing is permitted for Nostr clients on the web hosting relay, it would grant permission for all web pages hosted on that relay, making it vulnerable to spam postings.
Implementation
Repository: https://github.com/studiokaiji/nostr-webhost
Example Implementation: https://h.hostr.cc/p/a5a44e2a531efcc86491c4b9a3fa67daee8f60c9d2757a12eed95d98c5d6fc42/d/hostr-lp