Wondering what’s next for npm?Check out our public roadmap! »

    @ensdomains/ethregistrar

    2.0.4 • Public • Published

    Eth Registrar

    Build Status License

    Implements an ENS registrar intended for the .eth TLD.

    These contracts were audited by ConsenSys dilligence; the audit report is available here.

    Contracts

    The registrar is separated into several components for simplicity, modularity, and privilege minimisation.

    BaseRegistrar

    BaseRegistrar is the contract that owns the TLD in the ENS registry. This contract implements a minimal set of functionality:

    • The owner of the registrar may add and remove controllers.
    • Controllers may register new domains and extend the expiry of (renew) existing domains. They can not change the ownership or reduce the expiration time of existing domains.
    • Name owners may transfer ownership to another address.
    • Name owners may reclaim ownership in the ENS registry if they have lost it.
    • Owners of names in the interim registrar may transfer them to the new registrar, during the 1 year transition period. When they do so, their deposit is returned to them in its entirety.

    This separation of concerns provides name owners strong guarantees over continued ownership of their existing names, while still permitting innovation and change in the way names are registered and renewed via the controller mechanism.

    EthRegistrarController

    EthRegistrarController is the first implementation of a registration controller for the new registrar. This contract implements the following functionality:

    • The owner of the registrar may set a price oracle contract, which determines the cost of registrations and renewals based on the name and the desired registration or renewal duration.
    • The owner of the registrar may withdraw any collected funds to their account.
    • Users can register new names using a commit/reveal process and by paying the appropriate registration fee.
    • Users can renew a name by paying the appropriate fee. Any user may renew a domain, not just the name's owner.

    The commit/reveal process is used to avoid frontrunning, and operates as follows:

    1. A user commits to a hash, the preimage of which contains the name to be registered and a secret value.
    2. After a minimum delay period and before the commitment expires, the user calls the register function with the name to register and the secret value from the commitment. If a valid commitment is found and the other preconditions are met, the name is registered.

    The minimum delay and expiry for commitments exist to prevent miners or other users from effectively frontrunnig registrations.

    SimplePriceOracle

    SimplePriceOracle is a trivial implementation of the pricing oracle for the EthRegistrarController that always returns a fixed price per domain per year, determined by the contract owner.

    StablePriceOracle

    StablePriceOracle is a price oracle implementation that allows the contract owner to specify pricing based on the length of a name, and uses a fiat currency oracle to set a fixed price in fiat per name.

    Keywords

    none

    Install

    npm i @ensdomains/ethregistrar

    DownloadsWeekly Downloads

    156

    Version

    2.0.4

    License

    ISC

    Unpacked Size

    17 MB

    Total Files

    103

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar