Name Service

Overview

The Name contract is deployed on the PUT chain, defining a generic domain name service implementation that supports different types and sizes of content mapping, such as PUT addresses, ppl-token mint, ppl-nft, etc.

They can be mapped through the Name contract, in addition to that, a range of custom types, like resource addresses, can be stored.

Domain name division in domain name service

Name contract classifies domain names into top-level domain, first-level domain (or Domain) and domain name resolution.

In the contract, there are top-level domain account (called top-level account), domain accounts (Domain), domain name resolution accounts (Resolve) and address resolution accounts (Address).

The address resolution account is generated from the real resource address mapped to the domain name and points back to the real domain name.

Domain name format and charging rules

The top-level domains are created internally, after which Domain accounts and Resolve accounts can be created under the top-level domains.

The top-level domain account data defines charging rules, the maximum space to be used for the domain name resolution account, and others among which the charging rule is a 5-byte-long u128 array that stores the charging rules for different domain name lengths, where

  • 1-3 characters are read from index 0 to charge the defined charging amount,

  • 4 characters from index 1 of the array,

  • 5 characters from index 2,

  • 6 characters from index 3,

  • and 7-32 characters from index 4.

The domain names with 1-3 characters are rare and free during creation, but they need to be renewed according to the charging rules.

The maximum space available for the Resolve account is the space requested in the data field of the Resolve account, and the data space of all Resolve accounts under the Top-level domain is requested as the maximum space available for all Resolve accounts.

Domain account

The Domain account can be seen as the administrative account of the Resolve account, with the owner field as its administrative account.

Multiple domain name resolution accounts can be created under the Domain account, and the domain name resolution account provides the function of mapping domain names to real resource addresses.

The Domain account does not store the address resource values under the Domain account.

Resolve account and Address account

The Resolve account is a real account that stores the resource value.

An Address account is created along with the resolve account and generated by resource value as the seed and stores the value of the real domain name that points to the domain name resolution account.

There is a parent field in the Resolve account that points to the Domain account.

The Resolve account has the same ownership as the Domain account for having no owner account.

Last updated