Implementations for registrars and local resolvers for the Ethereum Name Service
JavaScript
Permalink
Failed to load latest commit information.
abi Fix public resolver to use content and setContent instead of hash and… Dec 7, 2016
docs Docs and ensutils updates for reverse registrar Jan 13, 2017
test Added ReverseRegistrar Jan 13, 2017
.gitignore Added docs Dec 15, 2016
DNSResolver.sol Add docs on ENSDNS Jan 4, 2017
ENS.lll LLL file renaming for consistency with the rest of the repo. (#28) Dec 5, 2016
ENS.lll.bin LLL file renaming for consistency with the rest of the repo. (#28) Dec 5, 2016
ENS.sol Factor out ENS interface; move lll code into root Nov 21, 2016
FIFSRegistrar.sol Replace uses of ENS with its abstract interface Nov 24, 2016
HashRegistrar.sol update from master Nov 30, 2016
HashRegistrarSimplified.sol Big rewrite of hash register to be explicitly state-machine based (#35) Jan 10, 2017
PublicResolver.lll Fixed comments associated with function ID change. Renamed two macros… Jan 9, 2017
PublicResolver.sol Fix public resolver to use content and setContent instead of hash and… Dec 7, 2016
README.md LLL file renaming for consistency with the rest of the repo. (#28) Dec 5, 2016
ResolverInterface.sol An LLL implementation of the public resolver (#27) Dec 6, 2016
ReverseRegistrar.sol Added ReverseRegistrar Jan 13, 2017
TestRegistrar.sol Replace 'expiries' with 'expiryTimes' Nov 24, 2016
ens.domains.zone Add docs on ENSDNS Jan 4, 2017
ensutils.js Docs and ensutils updates for reverse registrar Jan 13, 2017
interface.sol Factor out ENS interface; move lll code into root Nov 21, 2016
package.json Upgrade to solidity 0.4 Sep 15, 2016

README.md

ENS

Implementations for registrars and local resolvers for the Ethereum Name Service.

For documentation of the ENS system, see the wiki.

ENS.sol

Implementation of the ENS Registry, the central contract used to look up resolvers and owners for domains.

FIFSRegistrar.sol

Implementation of a simple first-in-first-served registrar, which issues (sub-)domains to the first account to request them.

HashRegistrar.sol

Implementation of a registrar based on second-price blind auctions and funds held on deposit, with a renewal process that weights renewal costs according to the change in mean price of registering a domain. Largely untested!

HashRegistrarSimplified.sol

Simplified version of the above, with no support for renewals. This is the current proposal for interim registrar of the ENS system until a permanent registrar is decided on.

PublicResolver.sol

Simple resolver implementation that allows the owner of any domain to configure how its name should resolve. One deployment of this contract allows any number of people to use it, by setting it as their resolver in the registry.

ENS Registry interface

The ENS registry is a single central contract that provides a mapping from domain names to owners and resolvers, as described in EIP 137.

The ENS operates on 'nodes' instead of human-readable names; a human readable name is converted to a node using the namehash algorithm, which is as follows:

def namehash(name):
  if name == '':
    return '\0' * 32
  else:
    label, _, remainder = name.partition('.')
    return sha3(namehash(remainder) + sha3(label))

The registry's interface is as follows:

owner(bytes32 node) constant returns (address)

Returns the owner of the specified node.

resolver(bytes32 node) constant returns (address)

Returns the resolver for the specified node.

setOwner(bytes32 node, address owner)

Updates the owner of a node. Only the current owner may call this function.

setSubnodeOwner(bytes32 node, bytes32 label, address owner)

Updates the owner of a subnode. For instance, the owner of "foo.com" may change the owner of "bar.foo.com" by calling setSubnodeOwner(namehash("foo.com"), sha3("bar"), newowner). Only callable by the owner of node.

setResolver(bytes32 node, address resolver)

Sets the resolver address for the specified node.

Resolver interface

Resolvers must implement one mandatory method, has, and may implement any number of other resource-type specific methods. Resolvers must throw when an unimplemented method is called.

has(bytes32 node, bytes32 kind) constant returns (bool)

Returns true iff the specified node has the specified record kind available. Record kinds are defined by each resolver type and standardised in EIPs; currently only "addr" is supported.

has() must return false iff the corresponding record type specific methods will throw if called.

addr(bytes32 node) constant returns (address ret)

Implements the addr resource type. Returns the Ethereum address associated with a node if it exists, or throws if it does not.

Generating ABI and binary data

ENS.lll.bin was generated with the following command, using the lllc packaged with Solidity 0.4.4:

lllc ENS.lll > ENS.lll.bin

The files in the abi directory were generated with the following command:

solc --abi -o abi interface.sol FIFSRegistrar.sol HashRegistrarSimplified.sol PublicResolver.sol