Create Publication

We are looking for publications that demonstrate building dApps or smart contracts!
See the full list of Gitcoin bounties that are eligible for rewards.

Article Thumbnail

Algorand Name Service

The Algorand Name Service (ANS) is a decentralized & community-driven name service for naming network resources on Algorand.

ANS launched on mainnet on Feb 25, 2022, providing infrastructure to name an Algorand wallet address with the .algo domain suffix. Users can also build their .algo profile by linking social media handles and avatars to their .algo names.

This article provides a brief overview of the smart contract design and implementation of ANS.


The Algorand Name Service builds a key-value store of name-address pairs following the Hash Map design pattern of using an Algorand stateful smart contract and smart signatures. Each smart contract is a name registry representing a domain suffix (such as .algo). A name record account opt’s in to the name registry smart contract and mentions the owner address and name’s metadata in its local storage for the smart contract. The desired name is used as input to a standardized TEAL program and compiled, thereby converting the TEAL program into a Logic Signature.

Name Registration

EditorImages/2022/05/19 01:17/ANS-Flowchart-1.jpg

As shown in the above figure, the name registration process involves 5 major steps:

  • Generate Logic Signature
    The desired name is used as input to a standardized TEAL program and compiled, thereby creating a Logic Signature from the resulting TEAL program.
  • Pay Name Registration fee to the escrow address
    The user must pay the name registration fee to the smart contract’s escrow account. The total price is dependent on the length of the name and the desired number of years.
  • Fund Logic Signature
    In order to be able to opt-in to Registry Smart Contract, the Logic Signature must possess 1.2 ALGOs. To meet this requirement, the Logic Signature account is first funded from the future name owner’s wallet.
  • Opt-In to Registry Smart Contract
    Once the Logic Signature representing the desired name is funded with the required minimum balance, an Opt-In transaction is processed to allow the Logic Signature account to be able to allocate local storage on the Name Registry smart contract. This transaction is signed and sent using the Logic Signature account.
  • Add Owner’s Address
    After opting-in to the Name Registry smart contract, the name owner adds their wallet address as the owner of the name by adding a local storage byte key-value. The name owner mentions Logic Signature account address in the accounts array of the transaction.

Name Lookup

EditorImages/2022/05/19 01:22/ANS-Flowchart-2.jpg

Name resolution in ANS involves the same first step as that of Registering for a name. The name to be queried is used as input to the standardized TEAL program to determine the Logic Signature account address. Subsequently, using the indexer API, the Logic Signature account’s local storage is queried for the values corresponding to the Registry smart contract. These values include the owner of the name and social media profiles.

Name Transfer

The Name Transfer operation in ANS involves two steps:

Please note, a name owner must CHOOSE the transfer price and intended recipient before being able to transfer a .algo name.

  1. Initiate Name Transfer
    The owner can initiate a .algo domain name transfer by adding two local storage values of the Name Record Logic Signature account’s local storage corresponding to the registry smart contract. The owner makes an application call to the name registry to add the key values:

   "transfer_price": 69,

  1. Complete Name Transfer
    Once the name transfer is initiated by the original name owner, the intended recipient can go proceed with completing the name transfer. The intended recipient (identified by the current owner by the value of the local storage variable transfer_to) can make an application call to the name registry smart contract by sending a group of three transactions:

  2. Transfer payment to the owner
    Recipient transfers X ALGOs to the original owner. Here, X must be equal to the value of transfer_price set by the original owner

  3. Transfer fee to the registry
    Name transfers involve a convenience fee of 2 ALGOs to be paid by the name buyer to the name registry escrow account.
  4. Invoke accept transfer method in registry smart contract
    The recipient makes an Application call to the registry smart contract with the app argument accept_transfer.

Once this group transaction execution is successful, the owner value of the Name Record is updated and the social links are cleared.


The ANS v1.0 smart contracts were developed using PyTEAL and TEAL v5 and the registry contract remains updatable. The registry smart contract stores suffix info and controller address (that is committed during deployment) and the smart contract escrow account is used to collect all name registration fees. InnerTxns are leveraged for disbursing payments from the smart contract’s escrow address and only the controller’s address is authorized to withdraw funds.

Next steps

The ANS team is building the ANS DAO smart contract that will become the controller of the registry. The DAO smart contract’s escrow account will replace the current controller’s address and will be able to authorize fund disbursements from the registry treasury using contract-to-contract calls in InnerTxns. Further, the ANS DAO smart contract will be able to submit smart contract updates to registry smart contract following the same methodology.