Skip to content

NNS

NNS — Neo Name Service is a service that allows manage a domain name as a digital asset (NFT). It has an interface similar to DNS but has significant differences in its internal structure.

Entities:

  • Domain
  • Record
  • Owner
  • Committee

Domain

A domain is a string made of fragments separated by dots (.). It must follow these rules: - Length must be between 2 and 255 characters. - Each fragment must be between 1 and 63 characters. - Fragments can include lowercase letters, digits, and hyphens. - The root fragment must start with a letter. - Other fragments must start and end with a letter or digit.

A domain has an owner and may also have records.

A fee established by the committee is charged upon domain registration. After registration, the owner can manage this asset (add/delete records, transfer ownership to another owner) until the end of the domain registration period.

Record

A record consists of three values: name, type and data.

Record Name

A record name usually follows the domain format. It may have the same value as its domain or be a subdomain. For example:

Domain name
- cats.com

Record names
- cats.com
- siamese.cats.com
- maine.coon.cats.com

Wildcards

Some record types support wildcard names: A, CNAME, TXT and AAAA. When resolving a domain, if there's no exact match, a wildcard record is used. For more details on wildcards, see RFC 1034 and RFC 4592.

Record Type

The following record types are supported:

Type Description RFC
A Address record 1035
AAAA IPv6 address record 3596
TXT Text record 1035
CNAME Canonical name record 1035
SOA Start of authority record 1035
NS Nameserver record 1035
PTR Pointer record 1035
MX Mail exchange record 1035
SRV Service record type 2782
DS Delegation signer record 4034
RRSIG Resource record signature 4034
NSEC Next secure record 4034
DNSKEY DNS key record 4034
NSEC3 NSEC3 record 5155
NSEC3PARAM NSEC3 parameters record 5155
CDS Child delegate set record 7344
CDNSKEY Child DNS key record 7344
Resolvable Record Types

Not all record types are used the same way. - All record types can be listed with methods like getRecords, getAllRecords, or listRecords. - Only some record types can be resolved with resolve method. They are A, CNAME, SOA, TXT and AAAA.

Record data

Record data is a string whose format depends on the record type. Only basic format checks are applied, and these checks are not comprehensive. For record types A, CNAME, TXT, and AAAA, checks are full. For detailed formats, refer to the RFC for each type.

Owner

An owner is a wallet that has the right to manage this NFT (domain).

Committee

The committee makes new tokens (domains), sets, and charges a fee for issuance.

Globally Unique Domain Zone

For more information, see here.

NNS and FrostfsID

You can register a TLD domain without a committee signature by using FrostfsID. You can do it the following way:

  1. Create a new wallet

    $ neo-go wallet init -w wallet.json
    ...
    wallet successfully created, file location is wallet.json
    

  2. Create a new account:

    $ neo-go wallet create -w wallet.json
    Enter the name of the account > morpheus
    Enter new password >
    Confirm password >
    

  3. Get wallet address

    $ neo-go wallet dump-keys -w wallet.json
    NeNYtphoKT7F32vSXNH93YGLtjSAqqsNhv (simple signature contract):
    030f606abe9d2fa39a43b1713ffb85b428b1cdd8ba8d756760fd7ab064ac35a668
    

  4. Create a subject in FrostfsID

    $ frostfs-adm morph frostfsid create-subject \
        --subject-name morpheus \
        --subject-key 030f606abe9d2fa39a43b1713ffb85b428b1cdd8ba8d756760fd7ab064ac35a668
    

  5. Grant permissions to the wallet

    $ frostfs-adm morph frostfsid set-kv \
        --subject-address NeNYtphoKT7F32vSXNH93YGLtjSAqqsNhv \
        --key nns-allow-register-tld \
        --value allow
    

  6. Get NNS hash

    $ curl -s --data '{"id":1,"jsonrpc":"2.0","method":"getcontractstate","params":[1]}' \
        http://localhost:20332 | jq -r '.result.hash'
    0xa9e7730739055bd8d99ef6e64825c1d1fde8456f
    

  7. Register domain

    $ neo-go contract invokefunction -r http://localhost:20332 -w wallet.json \
        0xa9e7730739055bd8d99ef6e64825c1d1fde8456f \
        register \
        "subdomain.domain" \
        hash160:NeNYtphoKT7F32vSXNH93YGLtjSAqqsNhv \
        "email@frostfs.info" \
        10000 1000 1000 1000 -- NeNYtphoKT7F32vSXNH93YGLtjSAqqsNhv:Global