cns

Chia Name Service White Paper

Draft v0.1

October 2022

Introduction

About

Chia Name Service (CNS) is a decentralized ecosystem built on Chia Blockchain with its UTXO model and Chialisp Smart Contracts. CNS not only aims to provide name service to users on Chia Blockchain, but also provides cross-chain service with verifiable proof from the most secured blockchain - Chia.

CNS generates the name with the .xch suffix, the name is able to resolve various types of data both on-chain or off-chain, including addresses, content, websites, social accounts, etc. Owners have full ownership and management permission. CNS owner can trade the name like a normal NFT.

Our Vision

CNS is a universal name service that seamlessly connects people, information, assets, and applications in the digital world. Although it is secured by Chia Blockchain, it is chain-agnostic. The CNS is a decentralized, censorship-resistant, and open-sourced digital gateway to Web 3.0.

Our Goals

  • Realize a secure, transparent, and open-name service.
  • Serve as a digital gateway for a person or an organization to Web 3.0.
  • Interoperate between Web 3.0 and the Web 2.0.
  • Build a universal name service for all digital worlds.

Features

  • Domain Name. Allow users to register a single unique domain name for easy memory and access. Domain names can be registered, modified, queried, and transacted on-chain.
  • NFT. CNS is recorded on the chain in the form of NFT, which can be easily queried and interacted with by any application or user. CNS is unique and indivisible and can be transacted and circulated as the NFT in the marketplace. The attribute of the domain can always be modified by the owner, others have no chance to manipulate it. The attribute can be modified by any compatible wallet/client.
  • Digital Gateway. The CNS can store a collection of personal identity data, and represent the unique identity of Web3. Different digital assets can be linked to the CNS, allowing it to become a unique gateway to multi-chain networks. Subdomains can be created for members of the company, community, or organization as validate credentials. By integrating multi-chain data and even the legacy network data in a single place, the Digital Gateway of Web 3.0 to all your assets is formed.

Use case

  • Simplified Payments Instead of having to remember someone’s Chia wallet address, you can easily send them a payment just by knowing their domain name. CNS implements a smart contract that will resolve the chosen domain to the correct address on the blockchain and issue the payment.
  • Custom Information Storage Users can store arbitrary custom information (in the form of key-value pairs) with their domain on the blockchain. This can be useful, for example, if they wish to provide publicly available contact information, such as their email, Twitter handle, etc.
  • Subdomains Owners of domains can mint subdomains which offer even more ability for customization. For example, businesses can have several payment addresses and a unique subdomain linked to each one of them. For regular orders they might use pay.business.cns and for express delivery express-pay.business.cns. Another example of subdomain usage would be for displaying different website content, like the blog. cns for blog posts and contact.blog.cns to show additional contact information.

Domains in Blockchain

Ethereum Name Service

On the Ethereum blockchain, Ethereum Name Service is the most notable name service. The main smart contract is called the Registry, which contains a mapping from domain names to their Resolvers. Each Resolver is another smart contract, which maps domain names to their actual records (for example Ethereum addresses or content hashes). Therefore, to resolve a domain, one first has to look up the correct Resolver in the Registry and then perform the actual resolution. Since Ethereum often has periods of very high transaction traffic, which leads to extreme transaction fees, Ethereum-based projects inevitably inherit these drawbacks.

FIO protocol

The FIO Protocol is a decentralized service layer that bridges the gap between crypto endpoints such as wallets, exchanges, crypto payment processors, and any other application in which crypto assets are held and/or transferred. The FIO Protocol reimagines and enables a better way of sending and receiving blockchain-based value, regardless of the wallet, exchange, token, or coin used. It is worth mentioning that FIO has its blockchain but only acts as a service layer independent of other public chains, which ensures the security of address data on the one hand and ensures that the domain name service is not disrupted by the public chain on the other.

BONFIDA

BONFIDA is a decentralized name service build on the solana blockchain, which has a simple mission of providing a decentralized and yet affordable way to map domain names (represented as .sol) to on-chain data. Where on-chain data can be anything from a Solana (SOL) address to IPFS CID, images, text, and more.BONFIDA supports the domain name exchange in auction way.

Design

Principles

Name Principles

According to Zooko's triangle, the name should follow:

  1. Human-meaningful, names can be meaningful and memorable to humans.
  2. Secure, as long as the Chia Blockchain Consensus is concrete, the CNS can survive various attacks.
  3. Decentralised, every entity can start its resolver service without any central authority.

Everything On-Chain, Non-custody

  1. All critical information is On-Chain, non-custody.
  2. Every domain is an NFT, and can be transferred and exchanged.
  3. Owner of the domain can change the domain reference address afterward, and these changes are also On-Chain.
  4. Protocol is open, you can register, update and exchange in a compatible wallet.

Resolver

  1. The Off-Chain resolver will provide a quick domain resolving service.
  2. Every resolved result can be verified in every full node(by retrieving and parsing an NFT coin's puzzle and solution), Or theoretically by an SPV protocol and even a ZKP protocol. This can avoid malicious resolver attacks and MITM attacks.
  3. Resolver would respond not only to the address itself but also come with some critical information(like how long the reference address is stable, which can be done easily by confirmed_index of the domain NFT).
  4. Resolver is decentralized, even if we disappear, another team can take up the role and provide the resolving service by collecting information from the On-Chain information.

Lifecycle

stateDiagram-v2
    direction LR
    Available
    Grace: Grace Period
    Decaying: Decaying Period
    Available --> Leased : Register
    Leased --> Grace : Expire
    Grace --> Leased : Reclaimed
    Grace --> Decaying : Over
    Decaying --> Available : Over
    Decaying --> Leased : Register

Available Domains

Domains that are available can be immediately leased. Users will be required to pay leasing fees for one or more years. Leasing fees will be dependent on the length of the domain name.

Leased Domains

Leased domains will be represented by ERC721 tokens. The owner of the token will be able to top up leasing fees, transfer the token, and make use of the token (i.e. by using the naming system).

Grace Period

If the registration of a leased domain expires, the domain will enter into a grace period. During this grace period, the owner of the domain will not be able to perform any actions using the token (e.g. setting records on the domain, transferring the domain, etc.). The owner will have the option of reclaiming the domain by paying the lease fees on the domain during this period.

Decaying Period

If an expired domain is not reclaimed during the grace period, it will enter into the Recycling Period. During this period, an auction is used to re-distribute the domain.

Registration

CNS domain names will be assigned through retention, public registration.

  • The domain name of an important website will be retained for three years, and domain holders can verify the domain through their domain name certificate in a private manner.
  • Domain names with 7 or more letters are open for public registration on a first-come-first-served basis.

To use the domain name, users must register a domain. Domain registration is a Chia NFT with some special properties:

  • Domain registrations always have expiry dates. To keep a domain, users must make sure to renew the domain before it expires.
  • Expired domains are sold at auction. Expired names that are not sold at auction can be registered by others.

Renewal

  • The renewal cycle is year based.
  • Names have a minimum registration period of 1 year, and the maximum period is 10 years.

Expiry

  • If the domain name is not renewed by the expiration date, the name will enter a renewal grace period of 90 days, the user can renew it within such period.
  • During the renewal grace period, the name would be invalid, and all modifications to it would be ignored.

carried out the “decaying price premium” [10], where the price of expired names will start at $2,000 combining with normal annual rent and will decrease linearly to normal annual rent in 28 days.

Policy

Names in CNS follow the convention:

<name>.<domain-suffix>

For example, hiya.xch or icer.xch Each field is explained below:

  • Domain Suffix. The domain suffix (such as .xch) identifies the registry to which the name belongs.
  • Name. Name is the main identifier that accepts numbers, letters (case insensitive), _(underscore), -(dash).

Emoji will be transformed into Unicode, for example, 😊 = 567890 = xn-567890,thus 😊.xch is equivalent to xn-567890.xch.

Retention mechanism

TO DO

Subdomains

TO DO

NFT

NFT compatibility

Domain NFT is full compatible with Chia NFTv1, and can be traded, exchanged, transferred, and modified.

Technical Architecture

  • Full Node: This pertains to a full node that is used to obtain data from the Chia blockchain in real-time.
  • Syncer: The Syncer is a device used for real-time analysis of the data on the full node, and to store this data into a database for future reference.
  • Resolver: This is a component that receives requests to resolve domain names from users, and then provides the results of these domain resolutions.
  • Registrar: The Registrar is in charge of receiving registration requests from users and provides NFT Offer for domain name registration. The core private key that verifies the legality of the domain name resides here and requires high-level security protection.
  • Pawket (Wallet): Serving as a user's terminal for the blockchain, the Pawket can perform decentralized registration, resolution, verification, updates, and transactions.
  • xch.cool website: The personalized pages on this website allow one to view their account's NFTs, CATs, XCHs, and other asset information.

Wallet Functions

  • Registration: Submit a registration request to the registrar. If the domain name is available, it can obtain an NFT Offer for the domain name. After signature in the wallet, it sends the transaction directly to the full node for registration.
  • Resolution: Initiate a resolution request to the resolver, providing domain names to get corresponding basic information and NFT coin information.
  • Verification: Based on the NFT coin information obtained during the resolution, verification is carried out via the full node to check 1) whether the coin is a valid and legal domain name NFT, and 2) whether it matches the resolution information.
  • Update: Construct transaction information to update the NFT and submit it to the full node for chaining.
  • Transaction: Domain name NFT is fully compatible with regular NFTs and can be traded on any market capable of handling NFT transactions.

Registration

If you ever try to inspect the registration offer, you will find this offer is special, the trading NFT is not created yet, and will only be created when the offer is successfully accepted.

Beside this, what is the difference between the CNS and the standard NFT?

  1. metadata updater changed
  - `singleton_top_layer_v1_1`
    - `SINGLETON_STRUCT`: ...
    - `INNER_PUZZLE`: `nft_state_layer`
      - `NFT_STATE_LAYER_MOD_HASH`: 0xa0a04d9f57764f54a43e4030befb4d80026e870519aaa66334aef8304f5d0393c2
      - `METADATA`: ...
-     - `METADATA_UPDATER_PUZZLE_HASH`: 0xa0fe8a4b4e27a2e29a4d3fc7ce9d527adbcaccbab6ada3903ccf3ba9a769d2d78b
+     - `METADATA_UPDATER_PUZZLE_HASH`: 0xa020ea3991407203334e6a705517f4cba83f7987353d883f0938633ce7e1740fad
      - `INNER_PUZZLE`: `nft_ownership_layer`
        - `NFT_OWNERSHIP_LAYER_MOD_HASH`: 0xa0c5abea79afaa001b5427dfa0c8cf42ca6f38f5841b78f9b3c252733eb2de2726
        - `CURRENT_OWNER`: 0x80
        - `TRANSFER_PROGRAM`: `nft_ownership_transfer_program_one_way_claim_with_royalties`
          - `SINGLETON_STRUCT`: ...
          - `ROYALTY_ADDRESS`: ...
          - `TRADE_PRICE_PERCENTAGE`: ...
        - `INNER_PUZZLE`: `p2_delegated_puzzle_or_hidden_puzzle`
          - `synthetic_public_key`: ...

the metadata updater can be found here, while the official metadata updater can be found here, main changes is allow changes of custom binding information in the CNS NFT.

  1. metadata changed

If you find any random CNS, and look into the metadata, you will find the extension fields.

  (
    (117 "https://storage.pawket.app/ipfs/QmS7wLEbCy1ppi3mTQCzYYNb7ZWJSP2kxtgrFH35sjfQy6?filename=helloworld.xch.jpg") 
    (104 . 0xe2fb68894b5dc73b656815a2cc5397eae737de9abe5b8015c296a282143bee93) 
    (28021 "https://storage.pawket.app/ipfs/QmNfDdWVAChsrds7oMmciaDrbDmu7B2S9t1w2Ax2K7GawM?filename=helloworld.xchmetadata.json") 
    (28008 . 0x2598205f6f12e1ef872dbdc1abd7fff173167177a3f6d9ff782946e9bdf2206e) 
    (27765) 
    (27752) 
    (29550 . 1) 
    (29556 . 1) 
+   (25976 . 0x67b5ef1c) 
+   (28269 . "helloworld.xch") 
+   (25188))

refer to following code from Pawket for its definition (and also you can find the definition in the updater chialisp code).

imageUri: getHex("u"),
imageHash: getHex("h"),
metadataUri: getHex("mu"),
metadataHash: getHex("mh"),
licenseUri: getHex("lu"),
licenseHash: getHex("lh"),
serialNumber: getHex("sn"),
serialTotal: getHex("st"),

# CNS mandatory fields
expiry: getHex("ex"),
name: getHex("nm"),
bindings: getHex("bd"),

# CNS optional fields
address: getHex("ad"),
did: getHex("id"),
publicKey: getHex("pk"),
text: getHex("tt"),

Rationale

DID

All CNS is created by address directly with DID, this design is for parallelization. DID is not parallel-friendly, so CNS is created by the address which hold the CNS issuing private key.

Also, in the future, to make CNS more decentralized, the single private key will be replaced by a group of threshold signatures.

Conclusion

With such minor changes to NFT, CNS keeps the best compatibility with the whole chia ecosystem.

Resolution

Management

Renewing

Subdomain

Like in the DNS, in the CNS hierarchy, a subdomain is a domain that is a part of another (main) domain. For example, if a domain offered an alternative alias address for receiving donation as part of their main CNS pawket.xch, it might use the subdomain donate.pawket.xch.

The CNS has a tree structure or hierarchy, which includes nodes on the tree being a domain name. A subdomain is a domain that is part of a larger domain. Each label may contain from 1 to 63 octets. The full domain name may not exceed a total length of 253 ASCII characters in its textual representation.

Different than traditional DNS, there are two ways to implement subdomains:

  • NFT Approach. Subdomains can be NFT as main domain does, and they will be valid if: The issuer address is the address bound to main domain. Also, this means the subdomain would be invalidated when main domain's bound address changed.
  • Non-NFT Approach. Subdomains work as resolver respond resolving result, and they will be valid if: The main domain bound a resolver address(A record or CNAME) to it, and the resolver resolves the corresponding subdomain.

NFT Approach (Onchain Resolver)

CNS main domain owner only have issuer right over all these subdomains. Owner of main domain may:

  • Invalidated all subdomains (NFT) at once by change the bound address of main domain.

Owner of main domain without ownership of subdomain cannot:

  • Change ownership of the subdomain
  • Change any bound property including address of this subdomain

In this approach, a delegated resolver is acceptable, any on-chain resolver service could serve subdomain with/without fees.

With this approach, main domain owner can issue the subdomain NFT with full customization ability, so the main domain owner can issue subdomain NFT with their own branding on the NFT image, or they can replace the traditional NFT with CNS NFT without losing any existing attribute, but with CNS merit.

Non-NFT Approach (Offchain Resolver)

CNS domain owner have full ownership of all these subdomains. Owner of main domain may:

  • Invalidated all subdomains (NFT) at once by change the bound address of main domain.
  • Change ownership of the subdomain
  • Change any bound property including address of this subdomain

In this approach, a dedicated resolver is required, some service provider may deliver a aggregated resolver service, but without onchain information, the resolver response cannot be validated by wallet client.

Comparison

ApproachProsCons
NFT Approach✅Onchain verification
✅Reuse or delegate onchain resolver
✅Customize NFT
❌Cannot change ownership of subdomain
❌Cannot change bound property
Non-NFT Approach✅Full ownership of subdomain❌No onchain verification
❌Dedicated offchain resolver needed

Guide

Registration

Preparation

  1. Chia Client or Pawket wallet.
  2. Chia Name Service official website: xch.cool

Registration Steps

  1. Go xch.cool and search for a domain name. Currently only characters with 6 or more characters are supported(max 63 characters). The domain name is not case-sensitive and cannot contain special characters or emoji. image

  2. If the domain is available for registration, it will be displayed as available. image

    • If the domain has already been registered, it will be displayed as registered.
    • If the name does not meet the registration rules, Unavailable will be displayed.
  3. Check the details (name, registration fee, annual fee, royalties, etc.), then click Register. image image TIPS

    • The address entered here is the address you want the domain name to be bound to. If it is not filled in, it will automatically point to the owner's address.If you transfer the NFT later, the domain name address will automatically point to the new owner's address.
    • If you have entered a binding address, then even if you transfer the NFT later, the binding address will not be automatically released.
    • You can modify the binding address through the Pawket wallet after purchase. (Currently, only the Pawket wallet can be used to modify it).
  4. After clicking "register", an offer file will be automatically generated. It may take about 10~20 seconds. If the website has too many visitors, it may time out and fail. You can refresh and try again image image There are two ways to accept an offer. You can use Chia Client or Pawket wallet.

  5. Registration with Chia Client . Download the offer file or copy the offer text and paste it to the Chia Client. Check the details then click ACCEPT OFFER. image NOTE: This is a special offer, and your domain name NFT is not actually minted until this offer is accepted. Minting and sending happen at the same time. Therefore, you cannot see the preview of NFT in advance like other offers.Don't worry, you can still accept the offer and wait for the block confirmation. image After the block is confirmed, the domain name will be displayed in your wallet. image

  6. Registration with Pawket. First you need a Pawket web wallet. Then follow the steps.

    • Connect wallet image image image
    • Check the transaction information, add fees (optional) as required, and Sign. image
    • Submit the transaction and wait for the block confirmation. image
    • After the block confirmation,you will see the name NFT in your Pawket.

Security

Deployment

  • Valid Registrar Address: TODO
  • Fee Accountant Address: TODO

Risk Mitigation

  1. How to prevent/mitigate domain squatting.
  2. How to restrict or respect expiry policy (for the cost of a yearly renewal).
  3. How to verify a domain without a central authority. (the mechanism used by keybase can be a great inspiration.)
  4. When we need more metadata (maybe large) to be associated with the domain, how this metadata can be properly handled and stored?
  5. How we work with others to spread the usage of CNS and even integrated it into the Official Client.

Governance

The Total Cost of Registration

  • The total cost of registration includes: registration fee (registration fee is required for the first registration) + annual fee (charged annually) + royalties.
  • The price of CNS is priced in USD and XCH is paid. Therefore, if the currency price fluctuates significantly, we will adjust the XCH amount.

Registration Fee

  • 7+ characters: 0.
  • 6 characters: $6 in XCH.
  • Not available below 6 characters.

Annual Fee

  • 7+ characters: $6 in XCH per year.
  • 6 characters: $10 in XCH per year.
  • Not available below 6 characters.

Royalty

  • The royalty percentage is 5%.

Example: (when XCH price is $40)

  1. Total registration cost for 7+ characters:

    • Registration fee: 0
    • Annual fee: 0.15 XCH
    • Royalty: 0.0075 XCH (0.15 × 5%)
    • Total: 0.1575 XCH
  2. Total registration cost for 6 characters:

    • Registration fee: 0.15 XCH
    • Annual fee: 0.25 XCH
    • Royalty: 0.02 XCH ((0.15+0.25)×5%)
    • Total: 0.42 XCH

Disclaimer:

The above fees are for reference only. Due to the real-time fluctuations in the price of XCH, there may be some differences in the dollar valuation of the domain. We will make adjustments regularly to keep its dollar price around this level.

It's Time! The CNS Airdrop Program Has Launched!

Dear friends, it's been a while!

After enduring a prolonged bear market, we finally see the dawn of a bull market. Although the price of XCH has not changed markedly, we have a group of very loyal users, a group of firm supporters of the Chia blockchain. It is because of you that Chia ecological developers, including CNS, are motived to keep moving forward.

Now, it's time!

We are thrilled to announce that on the first anniversary of CNS's launch, we are unfolding our CNS token airdrop program! Simultaneously, several other things are happening:

  • We will be releasing the renewal function of CNS in the near future, and gradually lifting the character registration limit later in the year (all currently expired domain names will automatically be extended until the renewal function becomes available).
  • We have partnered with ChiaXGRANT, where a part of the CNS sales revenues will be injected into ChiaXGRANT's fund pool, serving to support the development of the entire Chia ecosystem.
  • We have completed the snapshot for the first airdrop. Remember, there will be more than one airdrops, so there are plenty of opportunities for you!
  • We will launch a CNS token incentive program, designed to promote the integration of CNS in the Chia ecosystem.

Here are more details:

CNS Renewal Plan:

CNS beta was officially opened for public registration on February 14th, 2023, limiting registrations to domain names composed of six characters or more, and only for a one-year period. For the past year, CNS's domain service has been running stably. You can enter the domain name for transfer operations in the Pawket wallet, or visit yourname.xch.cool to view your personal homepage.

After a year of operation and exploration, we are confident that we can support more traffic and provide more services. We decided to release the renewal feature for CNS soon, and gradually remove the character limitation on registration throughout this year. Here is our plan:

  • All domain names that are about to expire soon will get an automatic extension until March 14, 2024. Even if your domain name shows to be expired before this, you can still use it as normal.
  • After March 15, all expired domain names can be renewed. We will open the renewal channel on our official site at that time, so please be alert for our latest news.
  • After each domain name expires, if you don’t renew it straight away, the domain resolution services associated with your domain name will pause and enter a 90-day grace period. During this grace period, you can renew your domain at any time without worrying about someone else registering it. Once successfully renewed, your domain can be resolved normally.
  • If you fail to renew your domain during the grace period, it will be released for others to register.
  • If you have any questions about renewing, feel free to leave a message on our discord. Our staff will be happy to assist you.

ChiaXGRANT Collaboration:

At the outset, CNS pledged that part of our sales revenues would be devoted to supporting the Chia ecosystem. To fulfil this commitment, we have partnered with ChiaXGRANT, planning to donate all registration fee portion (not including annual fees and royalties) of the CNS sales revenue over the past year to ChiaXGRANT to support the development of the Chia ecosystem. We are also going to continue investing more funds in the future and looking forward to getting more outstanding developers to join the big Chia family!

Breakdown of CNS sales revenue:

  • Royalties: 5%, awarded to the distributors. If you want to become a distributor of CNS, refer to our deployment methods published on Github for guidance.
  • Registration fee: This is the fee charged when registering a CNS domain for the first time. This portion serves as the ecosystem fund, supporting the development of Chia ecosystem projects, including CNS.
  • Annual fee: Charged annually, used for project maintenance.
  • For example, the current sale price for a 6-character CNS domain name is 0.4xch, of which, 0.15xch constitutes the registration fee and goes into the ecosystem fund, while 0.25xch is the annual fee used for project maintenance. An additional 5% royalty is given to CNS distributors.

CNS Token Distribution:

We have launched our token CNS (AssetID:ba36df73e5f4ddd5c298bba7030678ebc1bbc5d4431663cffd0747099f81d8bb), with an initial supply of 100,000,000 tokens. These tokens are aimed at driving the governance and propelling incentives within the CNS ecosystem. CNS token holders can participate in governance voting, or engage in strategies like staking and liquidity provision to earn rewards.

The token distribution plan is as follows:

  • Founding team: 2.5% — to be locked for three years, with 1/3 unlocked annually.
  • Execution/Operation/Advisory team: 12.5% — set aside to cover labor costs for the execution/operation/advisory team over the next five years.
  • Airdrops: 25% — we expect to have 4 to 5 rounds of airdrops. The first round has already been snapshotted. More on the airdrop program can be found below.
  • Community Incentives: 37.5% — destined to incentivize the community members to participate in the building of CNS.
  • Treasury: 22.5% — used for providing liquidity, issuing staking rewards, and other purposes.

Beyond these distributions, CNS tokens will be designed to have an inflationary model. The inflation rate will not exceed 2% annually, the specific figure will be determined by governance voting.

CNS Airdrop Program:

25% of CNS tokens (i.e., 25 million tokens) will be used for airdrops, targeting CNS registered users and partners.

Starting this year, we will conduct multiple rounds of airdrops. The first round was snapshotted on February 14, 2024. The airdrop targets for this round are:

  • CNS registered users - based on the addresses bound with CNS domain names (by default, bound addresses are domain name holding addresses).
  • CNS pre-launch testing users - based on the addresses bound with CNS test domain names (by default, bound addresses are testing domain's holding addresses).
  • Holders of PassPaw NFT.
  • Anyone that have donated more than 0.001 XCH to Pawket.xch (xch16xwqtf2d4jljks8lfpp4xnz8jak7jqjxc07y9tqlgt4grdp5hr4q7vcx3s), or have made a direct donation to the Pakwet team.

The snapshot for this airdrop has already been taken, with all tokens directly sent to the corresponding addresses. There's no need to manually claim. We will announce the list of qualified addresses later.

Don't believe in any airdrop links from the comment section! Stay safe!

Finally, let’s anticipate together that the upcoming year will be even more exciting for the Chia ecosystem!

Beyond

API

APIPathTypeSummary
Resolvehttps://walletapi.chiabee.net/Name/resolvePOSTresolve address or name
Resolvehttps://walletapi.chiabee.net/Name/allGETget all names and corresponding address
Verifyhttps://walletapi.chiabee.net/Wallet/get-coin-solutionPOSTget the information for verification
Registerhttps://cns.api.pawket.app/api/priceGETget price for the CNS to register or renew
Registerhttps://cns.api.pawket.app/api/registerPOSTrequest to register or renew certain CNS
  • for testnet, prefix testnet.
    • Resolving/Verify: https://testnet.walletapi.chiabee.net/
    • Register: https://testnet.cns.api.pawket.app/

Resolve

NOTE:

  1. You can access the hosting service of CNS, or resolve it by yourself with or without this reference code
  2. We are still working towards a more decentralized solution like the mechanism in the inscription chain.

Single resolve

Here you can resolve the address through our API for demonstration purpose.

POST https://walletapi.chiabee.net/Name/resolve

Request:

{
  "queries": [
    {
      "name": "chianameservice.xch",
      "type": "address"
    }
  ]
}

Response:

{
  "answers": [
    {
      "name": "chianameservice.xch",
      "type": "address",
      "time_to_live": 600,
      "data": "2fa8cc93dec82f50a7781ced27b6c2ee5a8e5efd1d70606b877c58bb8545e906",
      "proof_coin_name": "0x59cffe9b0d863c74e04bd41aad96f39ca74bf8494d09e74aa387ad2dbc81086d",
      "proof_coin_spent_index": 4952003,
      "nft_coin_name": "0x56506bca506dc262a27355a08f77d45c02bc7b48de09d1b1ab4d84864bd370df"
    }
  ]
}
FieldDescription
namethe CNS name
typeresolving type, for reverse resolving, it could also be name
time_to_livethe time in seconds that tells the client how long the resolution should be cached and then update.
datathe resolving address in Hex format, convert to xch address by bech32m tool
proof_coin_namethe last spent coin that prove the resolving is right
proof_coin_spent_indexthe latest change time (a.k.a. proof coin spent time) which is represented in block height
nft_coin_namethe nft represented the CNS, and hold all the NFT information

NOTE:

  • the data is in Hex format, and in this case, it should be: xch1975vey77eqh4pfmcrnkj0dkzaedguhhar4cxq6u803vthp29ayrqp0ydw2
  • You can either get accurate block time from block chain or just roughly calculated like I did in Pawket here: Code

Reverse resolving

Sometime, we need to reverse resolving, from address to name, here is the example.

POST https://walletapi.chiabee.net/Name/resolve

Request:

{
  "queries": [
    {
      "name": "2cf90f43d2e01dce3a590bf71b944c0adb9d6b0cd50f24473a37606f9a601378",
      "type": "name"
    }
  ]
}

Response:

{
  "answers": [
    {
      "name": "slezisatoshi.xch",
      "type": "name",
      "time_to_live": 600,
      "data": "2cf90f43d2e01dce3a590bf71b944c0adb9d6b0cd50f24473a37606f9a601378",
      "proof_coin_name": "0x8549f5ac17c9ec80d00b2865ddde14040b7bb664fa23637cfdb822aead528043",
      "proof_coin_spent_index": 3247777,
      "nft_coin_name": "0x1dfa73a03ecd550074f35646553b7e5dd928b6fd9265597935142ddb62eae62e"
    }
  ]
}

If the address is resolving to multiple names, the earliest change would be responsed.

Retrieve All

For some application, it's better to get all domain names at once, and resolve them locally with periodical update.

Here you can resolve the address through our API for demonstration purpose.

GET https://walletapi.chiabee.net/Name/all

Response:

[
  {
    "nft_coin_name": "0x2a436bde91fa3535d44c7ccce7b216bc65be7171d628d1624d195a050274fd4b",
    "last_change_coin_name": "0xc6e8127b66c194caad44eadad66d18bfab37e0343a9c2be0be35aada79a9b971",
    "last_change_spent_index": 3224782,
    "name": "pawket.xch",
    "address": "d19c05a54dacbf2b40ff4843534c47976de90246c3fc42ac1f42ea81b434b8ea",
    "bindings": {
      "address": "d19c05a54dacbf2b40ff4843534c47976de90246c3fc42ac1f42ea81b434b8ea"
    }
  },
  {
    "nft_coin_name": "0x4ca2e68be9e7089bde96add07e5cec2b1fa13f5728f9dcfbb5c46d644cb05151",
    "last_change_coin_name": "0xa902271587fd5b96599c31eb592df940c3f36d08289b0d756ad49511de2fb617",
    "last_change_spent_index": 3225668,
    "name": "onlyfansnft.xch",
    "address": "7946dd4415470e985bbe94c4d0a953958d0c6d901dcab8762b27d36160d8462a",
    "bindings": {}
  }
]

the address is the Hex format of address, convert to xch address by bech32m tool.

UI

Loading

After resolving, client need to get detail of proof coin, then this loading state could tell user it is verifying.

Verified

After verifying, it could tell user it's verified.

Not Found

If the address is not found in the resolver, then the error may tell user.

Verify

The security of CNS resolving can be greatly upgraded by doing verification, which require access to synchronized full node.

The quick and dirty way is just resolve without verify, but to resist the malicious resolver, the client are persuade to verify the proof in the client side.

Here is the steps:

  1. download coin data from blockchain for the proof coin
  2. parse(uncurry) the coin and check the correctness of name and binding address
  3. check the next coin of this proof coin is not spent (that the proof coin is the latest changes)

API to check coin

Different client may have different way to get the coin details, here is one way to demonstrate this function.

POST https://walletapi.chiabee.net/Wallet/get-coin-solution

Request:

{
  "coinIds": ["0x59cffe9b0d863c74e04bd41aad96f39ca74bf8494d09e74aa387ad2dbc81086d"]
}

Response:

[
  {
    "coin": {
      "amount": 1,
      "parent_coin_info": "0x804037b1362351a6e9b29f0dc3a821a81143dc499fd953a1b9573ed95fc4836e",
      "puzzle_hash": "0x10d14864451e4c2e6e94d58512b29f7de603e77713ed62e4b23f1b8af44f3b0d"
    },
    "puzzle_reveal": "0xff02ffff01ff02ffff0...",
    "solution": "0xffffa0793d3984ad2321...",
    "confirmed_index": 4946819,
    "spent_index": 4952003,
    "timestamp": 1707986063
  }
]

Register

Price

Get the price for domain registering.

GET https://cns.api.pawket.app/api/price

Request:

?name=123458.xch&year=1&renew=false
KeyRequired?Description
nameYesthe name to register, typically suffix with .xch
yearYeshow many year to register or renew, max 99
renewNowhether to get price for register or renew

Response:

{
  "name": "123458.xch",
  "price": 400000000000,
  "annualFee": 250000000000,
  "registrationFee": 150000000000,
  "royaltyPercentage": 500,
  "success": true
}
KeyTypeDescription
nameStringthe name to register or renew
priceNumberthe total price for register or renew, in mojo
annualFeeNumberthe annual fee for this name, in mojo
registrationFeeNumberthe registration fee for this name, in mojo
royaltyPercentageNumberthe royalty percentage in 1/10000, e.g. 500=5%
successBooleanwhether success to get price information
codeStringif failed, this is the error code
reasonStringif failed, this is the reason
argumentsString[]if failed, this is the arguments for reason

Register

Get the offer for registering or renewing.

POST https://cns.api.pawket.app/api/register

Request:

{
  "name": "123458.xch",
  "royaltyAddress": "",
  "address": "",
  "publicKey": "",
  "did": "",
  "text": "",
  "renew": false,
  "year": 1
}
KeyRequired?Description
nameYesthe name to register, typically suffix with .xch
yearYeshow many year to register or renew, max 99
royaltyAddressNothe default royalty address of this CNS NFT, format like xch1...
addressNothe default binding address, format like xch1
publicKeyNothe default binding publick key, format usually like 0x...
didNothe default binding DID, format like did:chia:...
textNothe default binding text, can be arbitrary text except double quotes
renewNowhether to get price for register or renew

Response:

{
  "name": "123458.xch",
  "offer": "offer1qqr83....",
  "image": "/9j/4AAQSkZJRg....",
  "success": true
}
KeyTypeDescription
nameStringthe name to register or renew
imageStringthe NFT image in base64
offerStringthe offer string
successBooleanwhether success to get register offer
codeStringif failed, this is the error code
reasonStringif failed, this is the reason
argumentsString[]if failed, this is the arguments for reason

FAQ

Before Registration

What is CNS?

  • CNS (Chia Name Service) is a decentralized domain name service built on the Chia blockchain. Use CNS to receive on-chain assets such as XCH, CATs, NFTs, etc. without copying and pasting lengthy and illegible addresses. Name format example: pawket.xch

Which wallets currently support CNS?

  • Currently only Pawket wallet supports using CNS instead of an address to send assets.

Is CNS only for storing Chia addresses?

  • In addition to Chia addresses, CNS can also bind other information such as public key, DID, and text. In the future, social accounts such as Email and Twitter may be supported as well.

Can I use a CNS name to point to my website?

  • Pointing to other websites is not supported for now.
  • However, CNS has its own profile homepage (name.xch.cool, eg pawket.xch.cool), which displays your NFT assets, transaction history, etc. In the future, it will support custom decoration of your profile homepage.

What is the length range for registering a CNS name?

  • Currently it supports registration of names within the range of 6 ~ 63 characters.
  • 6 characters or less are temporarily unavailable.
  • More than 63 characters are unavailable either.

How much does it cost to register a CNS name?

  • The fee includes registration fee (needed to pay for the first registration) and service fee (charged annually).
    • CNS is priced in USD and paid in XCH.
    • 7 characters and above: 0 registration fee + about $6 service fee/year;
    • 6 characters: about $6 registration fee + $10 service fee/year.
    • Disclaimer:The above fees are for reference only. Due to the real-time fluctuations in the price of XCH, there may be some differences in the dollar valuation of the domain. We will make adjustments regularly to keep its dollar price around this level.

Can I register a name other than .xch?

  • For now, only .xch names are supported for registration.

When Registering

What are the rules to register a CNS name?

  • Letters, numbers, and hyphen "-" are supported, and the hyphen "-" cannot be used for the first 4 digits.
  • Special symbols and emoji are not supported.

Can I choose the registration period when registering?

  • Currently you can only choose the registration period for one year.

Do I have to bind a Chia address when registering?

  • If you do not fill in the binding address when registering, the CNS owner's address will be bound by default, which means, the assets received under this name will enter the owner's address. After forwarding or trading to others, the binding address will be automatically updated to the address of the new owner.
  • If you fill in the binding address (which can be different from the holding address), the address will not change after forwarding or trading. The owner can modify the binding address.

Do I have to add fees?

  • It's up to you. The transaction will speed up after adding fees, and the transaction can be completed without adding fees. Adding fees is recommended during sandstorms.

After payment, how to confirm whether the registration is successful?

  • You can check it in wallet NFT or blockchain explorer.

After Registration

How to add/modify my binding information?

  • In the Pawket wallet, find the corresponding NFT, and click it to add/modify in the Binding Information.

How do I transfer my CNS to someone else?

  • In the Pawket wallet, find the corresponding NFT, click it and select transfer, and you can also perform other transactions, such as selling, moving to DID, etc.

How to send a transaction using CNS?

  • In the Pawket wallet, when sending a transaction, you just need to enter the CNS name in the address bar.

How to renew my CNS?

  • Under development, stay tuned.

How to unregister my CNS?

  • Currently not supported.
  • Tips:
    1. If the binding address is cancelled in the binding information, it will be bound to the holder address of the CNS NFT by default.
    2. If the NFT of CNS is burned (the NFT is sent to a verifiably unspendable address: xch1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm6ks6e8mvy), the CNS cannot be deregistered.

About Us

Sutulabs is currently one of the most active development teams on the Chia blockchain, with products including wallets ( Pawket ), developer tools ( Mixch ), and domain names ( Chia Name Service ). The Founder @Icerdesign is the winner of the 2022 Chia Clover Developer Challenge.

cns