Comments, critique, questions all welcome.
Safe NRS (DNS)
What follows is an outline design that shows how a Name Resolution System (similar to the web Domain Naming System) might be implemented using Safe Network to provide all three sides of Zooko’s triangle:
- Human-meaningful: Meaningful and memorable (low-entropy) names are provided to the users.
- Secure: The amount of damage a malicious entity can inflict on the system should be as low as possible.
- Decentralized: Names correctly resolve to their respective entities without the use of a central authority or service.
Note: “Zooko Wilcox-O’Hearn conjectured that no single kind of name can achieve more than two.” (Wikipedia)
Example Safe NRS Implementation
An outline design for an NRS that achieves all three sides of Zooko’s triangle, and An outline design follows without support for subdomains or additional services, but implementation of these are considered at the end.
Resolving A Web URL
Resolving a web URL involves two stages:
- using the ‘domain+subdomain’ to obtain the address of the structure that holds the content of the website
- using the content structure to locate the data referred to by the path (e.g. a file of HTML stored at an xor address)
Step 2 is outside the scope of this topic which focuses on step 1, where a web client such as a browser uses a domain (and possibly subdomain) according to the proposed NRS scheme to retrieve the data necessary for step 2.
A proposal for Step 2 is presented in the topic: Storage of versioned websites for browsing on Safe Network
In more detail, the client uses NRS name to retrieve the NRS register corresponding to the NRS name. From the register it can obtain the address of the latest Website structure (or an earlier version if required). It retrieves this from the network and uses it to resolve the human readable URL to an xor address, and can load that file from the network. Any parameters applied to the URL will be made available to the page through a scripting API compatible with existing web conventions.
Similarly for URLs contained within the HTML files of the website when loading other pages, images, following links etc.
Obtaining the Register for a Domain
In the past a Safe NRS was demonstrated based on using the hash of the domain to obtain the location of data relating to any services (e.g. a website) also stored on Safe Network for that domain. This was done using the hash of the domain name to obtain an effectively random xor location, and then storing the data for the service at that address, in effect claiming the domain by the owner of the data at it’s xor location.
The proposal here is similar, but relies on the ability to create a RegisterCRDT at such an xor address that can be obtained by any client trying to access a service of the domain (and possibly subdomain). I thought the RegisterCRDT API supported this but it appears not, so that would require a change, or some way for clients to work around the limitation in how the RegisterCRDT address is decided.
Using a RegisterCRDT to reference metadata for a domain provides for versioning and concurrent editing of the metadata for services at the domain. So a client can review all previous services published for a domain, and changes can be made concurrently from more than one device but with guaranteed convergence on a single state after all edits are applied from different devices.
Additional Features
Supporting Subdomains and Services
The above doesn’t include support for expected features such as subdomains or additional services.
Both could though be added by using the main domain register to hold references to multiple Website structures for the root and any subdomains, and similarly for additional services (e.g. such as a Wallet or Filesystem).
Alternatively, each Website might have its own register, and those would be referenced by the main domain register in order to maintain separate version histories for each Website.
Related documents
These are I believe the latest relevant documents but I haven’t reviewed them, and I’m not sure how current or applicable they are now.
-
November 2018 - Naming System
- forum discussion: [RFC 052] Public Name System: Resolution and RDF
- RFC #052: RDF for the Public Name Resolution System
-
August 2019 - XOR-URL encoding
- PR #337: Define our own content-id encoding format for XOR-URLs
- forum post: XOR-URL RFC discussion