RIF RNS: RIF Name Service | Rootstock (RSK)
RNS provides an architecture which enables the identification of blockchain addresses by human-readable names.
The stack
Motivation
By adding a name resolution service, also known as “alias”, the probability of errors is significantly reduced. In addition, centralizing the access to multiple resources associated with a human-readable name improves the blockchain platform user experience. As resource names may change over time, the system needs to be flexible to support frequent changes.
Currently over the World Wide Web, the Domain Name System (DNS) is responsible for mapping human-readable names to IP addresses. RNS is a decentralized and secure service that works over RSK's blockchain.
Design
RNS is a hierarchical name space inspired by DNS, with the hierarchy roughly corresponding to organizational structure, and uses the "." character to delimit its levels.
The design goals of the RIF Name Service influence its structure.
- The primary goal is a consistent name space which will be used for referring to resources.
- All data associated with a name is tagged with a type, and queries can be limited to a single type.
- Because we want the name space to be useful in dissimilar networks and applications, we provide the ability to use the same name space with different protocol families or management. The RNS tags all data with a class as well as the type, so that we can allow parallel use of different formats for data of type address.
- There may be tradeoffs between the cost of acquiring data, the speed of updates, and the accuracy of caches. The owner of the domain, who is the source of the data, should weigh these tradeoffs, and decide what to store, and how to cache.
Elements of the RNS
RNS has two major components:
-
The RNS Registry, which is specification for a tree structured name space and data associated with the names.
Conceptually, each node and leaf of the domain name space tree names a set of information, and query operations are attempts to extract specific types of information from a particular set. A query names the domain name of interest and describes the type of resource information that is desired.
-
RNS Resolvers are contracts that provide information from a name in response to client requests.
Resolvers must be able to answer a query directly, or pursue the query using referrals to other resolvers. A resolver will typically be a contract's public function that is directly accessible to user programs or other contracts; hence no protocol is necessary between the resolver and the user program.
These three components roughly correspond to the three layers or views of the domain system:
- From the user's point of view, the domain system is accessed through a simple resolution operation. The domain space consists of a single tree and the user can request information from any section of the tree.
- From the resolver's point of view, the domain system is composed of an unknown number of names. Each name has a corresponding resolver that provides information for a set of resolution types directly.
- From the registry's point of view, the domain system consists of a hierarchical tree where each leaf has an owner (contract or account) and an associated resolver that provides information of the name.
Guidelines on use
Before RNS can be used to hold naming information for some kind of object, two needs must be met:
- A convention for mapping between object names and domain names. This describes how information about an object is accessed. Find specs here
- Resource record types and data formats for describing the object. Find specs here.
The guideline for finding a specific record for a name is as follows:
- Calculate the name identifier with
namehash
function. - Get the name's resolver address via
resolver(bytes32)
. - Determine if resolver supports desired resource record via ERC-165 interface detection.
- Get the desired resource record. Find currently standardized resolvers here.
Guidelines on integration
Resource records
A domain name identifies a node. Each node has a set of resource information, which may be empty. The set of resource information associated with a particular name is composed of separate resource records (RRs). The order of RRs in a set is not significant. Resource records associated with a name are found in the domain's resolver