Zero Knowledge
Search…
⌃K

ZNS Architecture

ZNS Smart Contract Architecture
ZNS is made up of four primary contracts that should be deployed in the following order:
Registrar:
Registrar.sol is the root contract for creating and storing Registries. New Registries are created by calling the createRegistry() method by providing a valid:
  • domain: a globally unique and Member-defined root domain
  • ref: a reference to an arbitrary content source such as a url like https://zer0.io/network/zero
  • registryType: a valid registry type to aid with indexing registries. Valid registry types are defined by the ZNS DAO (See Governance & Staking section below).
  • stakePrice: the price of registering an entry (a domain) with the Registry such as zero:guild
  • registryTokenAddress: the address of the registry's RegistryToken.
RegistryToken:
RegistryToken.sol is the associated token contract for a specific Registry that is based on the OpenZepplin ERC20 standard.
The RegistryToken is responsible for the financial related activity of a Registry including adding and removing stakers, minting and burning a registry's tokens, and depositing and withdrawing (via staking) funds into the RegistryToken contract itself.
A new RegistryToken is created on construction by providing a valid:
  • owner: the owner's Ethereum address
  • tokenName: the token's name such as 'Infinity'
  • tokenSymbol: the token's ticker such as 'INI'
  • tokenSupply: the token's initial total number of tokens in circulation
  • stakePrice: the price for registering a new registry entry (a domain)
Registry:
Registry.sol is the contract responsible for managing and updating registry entries (called ‘domains’) within an individual Registry. A Registry must be initialized by calling the init() function after creation by providing a valid domain, ref, registryType and registryToken address.
A new RegistryEntry can be added by calling the CreateRegistryEntry() method and providing a valid domain and ref.
RegistryController:
RegistryController.sol is the main contract that validates permissible Member actions on a particular Registry, RegistryEntry, and RegistryToken. After creation and initialization, all interactions with the contract-set for a particular Registry must happen via RegistryController for security purposes.
After a new RegistryController is created it must be initialized by calling the init() method and providing a valid registry address and registryToken address.