# Introduction

Aleo Name Service (ANS), a protocol and program definition designed to resolve short, human-readable names to service and resource identifiers on the Aleo network.

ANS aims to simplify the interaction with Aleo's resources by allowing memorable and updatable human-readable identifiers.

It supports public and private domain names, each serving distinct use cases and privacy needs.

The goal of public domain names is to provide stable, human-readable identifiers that can be used to specify network resources. In this way, users can enter a memorable string, such as ‘snowtiger.ans’ or ‘wallet.leo’, and be directed to the appropriate resource.

For a private domain name, users can transfer Aleo Credits(ACs) to a ANS domain, and the holder can claim the ACs without let others know the real aleo address.

You can try ANS out for yourself now by using the [ANS Manager App](https://aleonames.id)


# Integrate ANS into dApp

The API service provided by [aleo-name-service-api](/developer-guide/ans-indexer). We recommend that developers run their own Indexer or use the API service deliver by [Obscura](https://docs.obscura.network/), but developers can use the official ANS Indexer service for development and testing during the development phase.

### Query the primary name of an address

Check if an address has set a primary domain name. A 404 response means it has not been configured.

```typescript
// Replace "aleo1s......abcdef" with the address you want to lookup.
const address = "aleo1s......abcdef";
const response = await fetch(`https://testnet-api.aleonames.id/primary_name/${address}`);
const { name } = await response.json();
```

### Convert ANS name to address

Check if a domain name has a corresponding address. A 404 response indicates that it has not been registered. If the returned address is not an Aleo address, it means the domain is privately registered and not publicly disclosed.

```typescript
// Replace "test.ans" with your ANS name. 
// For private name, the address will be "Private Registration".
const name = "test.ans";
const response = await fetch(`https://testnet-api.aleonames.id/address/${name}`);
const { address } = await response.json();
```

### Convert ANS name\_hash to Human-readable Name

Convert an ANS name\_hash to its human-readable name. A 404 response indicates that the name has not been registered. The returned data includes a `balance` field, which represents the ACs (Aleo Credits) received by this ANS without a set password. Users can withdraw these ACs as needed.

```typescript
// Replace "2161886410952211525886505790676792679800209349697935268316503861742165891860field" with your ANS name_hash. 
const name_hash = "2161886410952211525886505790676792679800209349697935268316503861742165891860field";
const response = await fetch(`https://testnet-api.aleonames.id/hash_to_name/${name_hash}`);
const { name, balance } = await response.json();
```

### Query resolver content

Query a domain name's configured resolver content. A 404 response indicates it has not been set up. If configured

```typescript
// Replace "test.ans" with your ANS name. replace category with category you want to lookup.
const name = "test.ans";
const category = "btc";
const response = await fetch(`https://testnet-api.aleonames.id/resolver?name=${name}&category=${category}`);
const { content } = await response.json();
```

#### Query avatar

The avatar falls under a resolver category. To retrieve a domain name's assigned avatar, specify `category="avatar"`. If an avatar has been set up, the 'content' will point to the avatar image hosted on IPFS.


# Integrate ANS into Wallet

#### Overview

Integrating the Aleo Name Service (ANS) into your wallet application enhances user experience by enabling more human-readable transactions and providing additional security features. This document outlines the key integration points for incorporating ANS within your wallet to leverage these benefits.

#### Key Integration Points

1. **Displaying Primary Name and Avatar**
   * **Objective**: Display the user's ANS primary name and avatar in the wallet interface.
   * **Implementation**: Utilize the provided APIs to query the ANS primary name and avatar settings. When a wallet is connected, check if the user has set a primary name or avatar and display these within the wallet interface accordingly.
2. **Transfers Using ANS**
   * **Objective**: Allow users to initiate transfers using ANS domains instead of Aleo account addresses.
   * **Details**:
     * **Public ANS**: If the ANS domain is public, the wallet should offer the user the option to send ACs (Aleo Credits) directly to the ANS or to the Aleo account associated with the ANS. Since public ANS domains are linked to a visible Aleo address, the recipient's account details are retrievable.
     * **Private ANS**: If the ANS domain is private, transfers should be directed to the ANS domain itself. The wallet can enable users to set a password for the transfer, adding an extra layer of security. Recipients must verify this password to claim the ACs.
     * **Security Considerations**: For transfers to ANS, if ACs are sent, the holder of the ANS domain can withdraw these credits. Note that if the ANS is in a public state at the time of withdrawal, the user’s Aleo address will be exposed in the transaction record.
     * Refer to the "**Privacy Credit Transfer Scheme**" from ARC0137 for specifics on implementing secure, private transfers. For further details, see [ARC0137 on GitHub](https://github.com/AleoHQ/ARCs/discussions/45).
3. **Activities and NFT Display**
   * **Objective**: Enhance the transaction history by replacing Aleo addresses with ANS domain names and support NFT displays.
   * **Implementation**:
     * **Activity Display**: Modify the activities display logic to show ANS domain names instead of Aleo addresses wherever applicable, provided the user has set up such a mapping.
     * **NFT Display**: If the wallet has the capability to display NFTs, include ANS as an NFT, showcasing it similarly to other NFT assets in the wallet.

#### Security and Privacy

* **Password Protection**: When transferring ACs to an ANS domain, offering the option to set a password can help secure the transaction.
* **Address Exposure**: Users should be aware that if they opt to use public fees, their Aleo addresses will be exposed in the transaction records.&#x20;

#### API Usage

* Provide specific API endpoints for querying ANS settings (e.g., primary name, avatar) and performing secure transactions using ANS.

#### Conclusion

Integrating ANS into your wallet improves usability by replacing complex Aleo addresses with readable domain names and enhances security through optional password-protected transfers. Additionally, the capability to display ANS as NFTs brings visual appeal and familiarity for users interacting with NFT assets.

#### Action Items

* Review the [ANS API documentation](/developer-guide/integrate-ans-into-dapp).
* Implement the primary name, avatar display features, and NFT display capabilities.
* Support transfers via ANS with security options.

By following this guide, your wallet will be fully equipped to handle ANS features, thus enhancing both usability and security for your users while also embracing the growing trend of NFT display within the crypto wallet environment.


# ANS Indexer

If developer need to integrate ANS in backend, then [aleo-name-service-api ](https://github.com/s-t-soft/aleo-name-service-api)will be your best choice.

This API continuously reads data from the ALEO chain, parses it, and stores it in a local PostgreSQL database. It then provides a high-performance REST service to access parsed ANS data for your business needs.

Obscura uses this indexer to deliver a stable and reliable ANS API service. For more information, visit [Obscura](https://docs.obscura.network/).


# FAQs

1. **What is the Aleo Name Service (ANS)?**

ANS is a user-friendly protocol on the Aleo network, allowing easy mapping of human-readable names to network resources and identifiers.

2. **What is Aleo?**

Aleo is the pioneering platform for developing private applications, leveraging zero-knowledge cryptography for enhanced speed, integrity, and scalability.

3. **Why choose Aleo for privacy?**

Aleo stands out as the inaugural platform offering privacy-centric smart contracts. Unlike other solutions, Aleo integrates privacy at its core rather than as an add-on.

4. **Why is privacy important?**

Privacy is a fundamental human right, akin to closing shades at home for comfort, not secrecy. It's about maintaining freedom without needing to prove innocence.&#x20;

5. **Does my ANS domain have an expiration date?**&#x20;

No, ANS domains do not have an expiration date. Once you purchase a domain, it is yours permanently. There is no need for renewal or yearly fees.

6. Is ANS a standard zNFT, and can I trade it?

Yes, ANS is a standard zNFT. It will soon be supported by trading platforms, allowing you to buy, sell, and trade your ANS domain names just like any other NFT. Stay tuned for updates!


# Privacy Policy

**Effective as of 2024. 02. 15**

Welcome to the Aleo Name Service ("ANS"). We are committed to protecting your personal information and respecting your privacy. This Privacy Policy outlines how we handle the personal information we gather from you through our various channels, including our website, mobile apps, social media platforms, marketing initiatives, live events, and other services linked to this policy (collectively, the "Service").

Please note, we may issue additional or supplemental privacy notices for specific interactions, such as those with job applicants, or for distinct products and services at the point of collecting personal information.

### Personal Information We Collect

Information You Provide:

* **Contact Data**: Includes first and last name, email address, and phone number.
* **Communications Data**: Interactions with us via the Service, social media, etc.
* **Marketing Data**: Preferences for marketing communications and engagement insights.
* **Other Data**: Additional information as described in our Privacy Policy or disclosed upon collection.

#### Third-Party Sources

We may enrich data we get from you with sources including:

* **Public Sources**: Government records, social media platforms, and other public databases.
* **Private Sources**: Data from private entities like social media and data licensors.
* **Marketing Partners**: Information from marketing collaborations.
* **Third-Party Services**: Data from services linked to ours, like virtual currency wallets, including wallet addresses and service provider information.

#### Automated Data Collection

Our automated systems, service providers, and partners collect data like:

* **Device Data**: Operating system, device model, browser type, IP address, unique identifiers, and general location.
* **Online Activity Data**: Browsing behavior, such as pages viewed, time spent per page, and website navigation patterns.
* **Cookies and Similar Technologies**: Utilization of cookies (session, persistent, first-party, third-party), local storage technologies, and web beacons for enhancing user experience and personalizing content.

#### Data About Others

We offer functionalities for users to invite friends. We collect the invitees' contact details upon user consent to send invitations.

By continuing to use our Service, you consent to the collection and use of your information as outlined in this document.

### How We Utilize Your Personal Information <a href="#how-we-use-your-personal-information" id="how-we-use-your-personal-information"></a>

Your personal information is utilized in various ways, detailed below and at specific collection points:

#### Service Delivery and Operations

Your personal information aids us in:

* Offering, managing, and enhancing our Service and operations;
* Tailoring the service, including recognition of previous login devices and memorizing your selections and preferences;
* Communicating about the Service through announcements, updates, security alerts, and support messages;
* Informing you about events or contests you're involved in;
* Customizing your experience based on your interests and needs;
* Supporting the Service and addressing your inquiries.

#### Research and Development

We apply your information to:

* Analyze and refine our Service and operations;
* Innovate new products and services.

#### Marketing and Advertising

Your information is used by us, our partners, and third parties for marketing purposes:

* **Direct Marketing**: Sending you personalized marketing communications. Opt-out instructions are available in the [Opt-out of marketing](#opt-out-of-communications) section.

#### Events, Promotions, and Contests

Your information is crucial for:

* Managing promotions and contests;
* Communicating with you about your participation;
* Following up or marketing to you post-event.

#### Service Improvement and Analytics

We employ your information to:

* Enhance our Service and operations;
* Analyze Service usage to understand user behavior and preferences.

#### Compliance and Protection

Your information helps us:

* Adhere to laws and legal requests;
* Safeguard rights, privacy, and safety;
* Conduct audits and enforce terms;
* Prevent and address fraud, cyber threats, and illegal activities.

#### With Your Consent

We may seek your consent for specific uses of your information, especially when required by law.

#### Creating Non-Identifiable Data

We can convert your information into non-identifiable formats for lawful business uses, such as analysis and service improvement.

#### Cookies and Similar Technologies

We use cookies and related technologies for:

* Technical operations, enhancing your navigation experience;
* Improving service functionality;
* Conducting analytics to understand Service interaction and user preferences.

### How We Share Your Personal Information

We share your personal information with various parties as detailed below and as further described in our Privacy Policy, other related notices, or at the moment of collection.

* **Affiliates:** This includes our parent company, subsidiaries, and any other affiliated companies.
* **Service Providers:** We collaborate with third-party providers who perform services on our behalf or assist us in operating our Service or business. This can include hosting, IT support, customer service, email distribution, marketing, market research, and web analytics.
* **Third Parties Designated by You:** With your direction or consent, we might share your information with third parties.
* **Business and Marketing Partners:** We share information with third-party partners with whom we co-host events or promotions, jointly offer products or services, or whose offerings might interest you.
* **Linked Third-Party Services:** If you log in to our Service using, or link our Service with, a third-party service (like a virtual currency account), we might share your information with those third-party services. How they use your information is dictated by their own privacy policies and your settings with them.
* **Professional Advisors:** We may disclose information to professional advisors such as lawyers, auditors, bankers, and insurers when necessary for the professional services they provide to us.
* **Authorities and Others:** For compliance and protection purposes, we may share your information with law enforcement, government authorities, and private parties when we believe in good faith it's necessary or appropriate.
* **Business Transferees:** In the event of a business transaction (like investments in or financing of ANS, public offerings, or a merger, sale, transfer of our businesses, assets or shares), we may need to share personal information with potential partners, their advisors, or third-party acquirers. Similarly, in cases of insolvency, bankruptcy, or receivership, your personal information may be transferred as one of our business assets.

### Your Rights

#### Access and Update Your Information

You have the right to access and update your personal information as permitted by law.

#### Opt-Out of Communications

You can opt-out of marketing emails by following the unsubscribe instructions in the emails. You'll still receive service-related emails.

#### Cookies

Browsers can be set to reject cookies. If disabled, our Service may not function correctly. For cookie management, visit [https://allaboutcookies.org](https://allaboutcookies.org/).

#### Blocking Images/Clear GIFs

Browsers and devices can prevent images from loading, which disables web beacons.

#### Do Not Track

We do not respond to "Do Not Track" signals. More at [http://www.allaboutdnt.com](http://www.allaboutdnt.com/).

#### Providing Personal Information

Not providing required information may hinder our service delivery.

#### Third-Party Platforms

Connection settings on social media or third-party platforms may limit the information we receive. Revoking access does not affect previously obtained information.

### Other Sites and Services

Our Service may link to third-party sites not controlled by us. We're not responsible for their actions and encourage reviewing their privacy policies.

### Security

We implement measures to protect your personal information. However, no system is entirely secure.

### International Data Transfer

Your information may be transferred internationally. We ensure legal compliance with data protection laws for cross-border transfers.

### Children

Our Service is not intended for children below the legal age limit. If we discover that a child under legal age has provided us with personal information, we will delete such information from our systems.

### Changes to This Privacy Policy

We may update this policy. Changes will be announced via the Service. By continuing to use the Service after updates, you accept the revised policy.

<br>


