Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFT assets in NNS scenarios #1545

Closed
doubiliu opened this issue Apr 8, 2020 · 18 comments · Fixed by #2201
Closed

NFT assets in NNS scenarios #1545

doubiliu opened this issue Apr 8, 2020 · 18 comments · Fixed by #2201
Labels
discussion Initial issue state - proposed but not yet accepted

Comments

@doubiliu
Copy link
Contributor

doubiliu commented Apr 8, 2020

Summary or problem description

NGD is designing the NNS system. In NNS, domain names have ownership and independence, which is in line with NFT application scenarios.

Need to discuss

  1. Whether it is necessary to design according to the NFT standard in NNS?
  2. Whether the existing NFT standard is enough?

Neo Version

  • Neo 3

Where in the software does this update applies to?

  • Other:NNS
@doubiliu doubiliu added the discussion Initial issue state - proposed but not yet accepted label Apr 8, 2020
@erikzhang
Copy link
Member

I think the domain names should not be permanent. You need to renew them.

@doubiliu
Copy link
Contributor Author

doubiliu commented Apr 8, 2020

I have considered this.In our design, the root domain name is perpetual and is controlled by the committee or administrator. Subdomains are all leased.

@doubiliu
Copy link
Contributor Author

doubiliu commented Apr 10, 2020

An NNS scheme of NFT asset type

In NEO, the contract address and account address is a Hex string which is difficult for humans to remember, and it is not very convenient to use. For ease of use, we introduced the domain name system, using easy-to-remember domain names as a replacement for difficult-to-remember strings. Eg. Users can initiate a transaction directly to a certain domain name, the effect is the same as transferring money to a certain address.

Design Goal

  • Provide domain name services for contract addresses / wallet addresses / other complex strings.

  • Self-service domain name management.

  • Self-service domain name transfer.

  • Create NFT usage scenarios

Scenarios

  • Account alias
  • NeoFS node alias
  • Domain assets complying with NFT standards

Define

Domain Name

Use an simple string to replace account address / contract address / other complex strings. Use a format similar to traditional DNS as the domain name format.

Format:third-level domain.second-level domain.top-level domain.root domain

Using "." As a delimiter, the domain name level increases from right to left, the low-level domain name is the parent domain name of the high-level domain name, and the high-level domain name is the sub-domain name of the low-level domain name. The parent domain name initially owns all the subdomains under it.

NNS supports up to third-level domain names.

Domain lifecycle

In order to avoid long-term occupation of domain name resources by invalid or malicious acts, the root domain name is held by the administrator for a long time. The first-level domain name will adopt the lease model, and the validity period of other domain names is equivalent to the validity period of its first-level domain name.

If the domain name holder still wants to continue to hold the domain name, it needs to renew the first-level domain name.

System Structure

1586770258(1)

The overall system is composed of three parts, NNS Contract ,Registry and Resolver.

NNS Contract

It is responsible for managing the registration, renewal, and transfer of domain names. And it complies with NFT standards.

It supports the following functions:

  • Root domain registration

    function bool registerRootName(String name)

    Register a new root domain name, only the administrator can call this interface.

  • Domain transfer

    public static bool transfer(byte[] to, byte[] tokenid)

    Transfer ownership of a domain name to another person, only the current owner has the right to call it. This interface is one of NFT's standard interfaces.

  • Domain renew

    function bool renewName(String name,int time)

    Renew the lease of the first-level domain name. The initial domain name is valid for one year. After expiration, the validity period can be extended through this interface, but an additional fee is required. Anyone can call this interface.

  • set administrator

    function bool setAdmin(UInt160 address)

    Committee set administrator (multi-signature address)

  • Set the rental price of domain name

    function bool setRentalPrice(long price)

    Set unit price for renewal per cycle

  • Other NFT interfaces

Registry Table

Maintain a list of domain names and store their ownership, resolver, TTL (validity period) and other information

Storage Structure

<NameHash,<owner,resolver,admin,TTL>> DomainList

<owner,List< NameHash>> OwnershipReverseMapping

It mainly supports the following functions:

  • Add new domain

    function bool registerNewName(String name,UInt160 owner,UInt160 admin,int TTL)

    Add a new domain name to the registry and mark its owner and expiration date. Only the registry can call this interface.

  • Update domain ownership

    function bool setOwner(String name,UInt160 owner)

    Set the domain name owner, only the current owner of the domain name can call it.

  • Configure resolver admin

    function bool setResolverAdmin(String name,UInt160 admin)

    Configure the domain name resolver admin, only the current owner of the domain name can call it.

  • Configure TTL

    function bool setTTL(String name,int TTL)

    Set the validity period of the domain name. Can only be called by the NNS Contract.

Resolver

It stores resolver instances for each domain name, and each resolver instance provides a series of methods to resolve the domain name to the corresponding text.

Storage Structure

<NameHash,<Text,recordType>> resolverList

It mainly supports the following functions:

  • set text

    function bool setText(String name,String text,bool recordType)

    The administrator of the resolver can set the text and recordType corresponding to the domain name.

    Currently supports:

    recordType number description
    A 0 contract/account address
    CNAME 1 domain redirection
    TXT 2 domain additional information
    NS 3 specify the subdomain interpreter for this domain name (wildcard matching)
    TBD TBD TBD
  • resolve domain

    function string resolve(String name)

    Returns the text and recordType corresponding to the domain name.

@doubiliu
Copy link
Contributor Author

@erikzhang Hi,da lao. Whether the proposal meets expectations,?If OK, NGD will begin to implement it.

@erikzhang
Copy link
Member

  1. We need to support multiple resolution record types.
  2. The trading hall should not be a built-in function.
  3. There should be only one contract.

@doubiliu
Copy link
Contributor Author

doubiliu commented Apr 13, 2020

OK.We will remove trading hall.Can you explain what the resolution record types mean?We don't very
understand. @erikzhang

@erikzhang
Copy link
Member

erikzhang commented Apr 13, 2020

@doubiliu
Copy link
Contributor Author

I have modified the design. @erikzhang

@erikzhang
Copy link
Member

What is a resolver?

@doubiliu
Copy link
Contributor Author

doubiliu commented Apr 14, 2020

The Resolver is responsible for completing the process of parsing the domain name to the actual string.Because domain name resolution is not only as simple as obtaining an address, many complex resolution logics should be abstracted into this component, such as domain name redirection, format checking, and fuzzy matching.At the same time, the advantage of this kind of component design is to separate the ownership and management of the domain name.This is a reasonable requirement because the holder of the purchased domain name is not necessarily the actual administrator of the domain name. @erikzhang

@erikzhang
Copy link
Member

So the resolvers are contract?

@doubiliu
Copy link
Contributor Author

I can write the default resolver in the NNS contract, and the user can also configure a custom one.Of course, I suggest that it is better to split into two contracts, so that the structure is relatively clear.

@erikzhang
Copy link
Member

I don't think we need custom resolvers. All we need is the default one.

@doubiliu
Copy link
Contributor Author

OK. This modification is very easy, forcing the configuration to use the default resolver.Is there anything else that needs to be modified?

@erikzhang
Copy link
Member

If you're going to support NFT standard, the transfer method is not correct.

@doubiliu
Copy link
Contributor Author

We will do a method format check

@doubiliu
Copy link
Contributor Author

Are there other deficiencies?

@doubiliu
Copy link
Contributor Author

I have modified the design.
Some little change,mainly:

  1. Adjust the transfer method parameter format
  2. Remove a resolver method
  3. Remove a setResolver method
  4. Add a setResolverAdmin method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Initial issue state - proposed but not yet accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants