Ethereum Name Service

Nick Johnson <nick@ethereum.org>

Why do we need another name service?

What makes a good name service?

Components of ENS

ENS Registry

<ROOT> 0x00000000 eth 0x93cdeb70 swarm.eth 0x495940b6 wallet.eth 0x4bcc8335 nick.wallet.eth 0xefcbf86e

ENS Registry

Node Owner Resolver 0xcef05643 0xdbb0ae7d 0x09483e37 0x3eb880c3 0x2dcd64b0 0xcd990dca 0xf56dfa6e 0xc222d0df

Namehash

nick.wallet.eth.

Namehash

nick.wallet.eth.

Namehash

SHA3(eth)SHA3(wallet)SHA3(nick)

Namehash

SHA3(eth)SHA3(wallet)SHA3(nick) 0x4f5b81270x46a31f1f0x5d5727cb

Namehash

SHA3(eth)SHA3(wallet)SHA3(nick) SHA3(0, 0x4f5b8127)0x46a31f1f0x5d5727cb

Namehash

SHA3(eth)SHA3(wallet)SHA3(nick) SHA3(0, 0x4f5b8127)SHA3(           , 0x46a31f1f)0x5d5727cb 0x93cdeb70

Namehash

SHA3(eth)SHA3(wallet)SHA3(nick) SHA3(0, 0x4f5b8127)SHA3(0x93cdeb70 , 0x46a31f1f)SHA3(           , 0x5d5727cb) 0x4bcc8335

Namehash

SHA3(eth)SHA3(wallet)SHA3(nick) SHA3(0, 0x4f5b8127)SHA3(0x93cdeb70 , 0x46a31f1f)SHA3(0x4bcc8335 , 0x5d5727cb) 0xefcbf86e

Resolvers

contract SimpleResolver is owned {
    mapping(bytes32=>address) addresses;

    function has(bytes32 node, bytes32 kind)
            constant returns(bool)
    {
        return kind == "addr" && addresses[node] != 0; 
    }

    function addr(bytes32 node) constant returns(address)
    {
        if(addresses[node] == 0)
            throw;
        return addresses[node];
    }

    function setAddr(bytes32 node, address addr) owner_only
    {
        addresses[node] = addr;
    }

    function()
    {
        throw;
    }
}
            

Registrars

contract FIFSRegistrar {
    ENS ens;
    bytes32 rootNode

    function FIFSRegistrar(ENS _ens, bytes32 _rootNode) {
        ens = _ens;
        rootNode = _rootNode;
    }

    function register(bytes32 label, address newOwner) {
        address owner = ens.owner(sha3(rootNode, label));
        if(owner != 0 && owner != msg.sender)
            throw;

        ens.setSubnodeOwner(rootNode, label, newOwner);
    }
}
            

Auction-based registration

An interim solution

Questions and comments?

nick@ethereum.org

https://gitter.im/ethereum/go-ethereum/name-registry

https://github.com/ethereum/EIPs/issues/137