Design

The Algorand Name Service is designed using Algorand stateful smart contracts and smart signatures.

The Algorand Name Service builds a key-value store of name-address pairs 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

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

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": X,
   "transfer_to": ALG0ADDR3SS0FINTENDEDR3C1PIENT
}

2. 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:

  1. 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

  2. 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.

  3. 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.

Last updated