10

I am wondering how does the Ethereum domain registration works? From what I can see in the whitepaper, I know there is account-specific data storage, but I don't know if that would be the ideal way to register domains. Generally, one would need some shared data storage between all accounts to have globally unique domains.

How does data registration in Ethereum work?

5

So the whole point of a name reg contract is not to send transactions, rather its sole purpose is to build up a database which other nodes can then query.

Ethereum smart contracts have immutable storage. This means that you can prove your primacy to a specific name, and other people can then reference that as part of a database.

What it comes down to is the credence other entities hold towards a specific name reg Dapp (Network effect, utility, what service it is registering names for etc). In some situations people would want a name reg for a specific purpose, say a list of Escrow contracts for one company, this could then be used internally, or shared. In others as you mention in your question, people would rather look towards a singular name reg which controls a DNS service.

You can have a look at an example name registration smart contract here: https://github.com/ethereum/dapp-bin/blob/master/namereg/namereg.html

Hope you find this useful!

1

The Ethereum network recently introduced a global registrar object which is basicly a public smart contract on the chain.

Here is a snippet of an ethereum client command line output:

namereg: {
    address: "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
    AuctionEnded: function(),
    Changed: function(),
    NewBid: function(),
    PrimaryChanged: function(),
    Registrar: function(),
    addr: function(),
    allEvents: function(),
    content: function(),
    disown: function(),
    name: function(),
    owner: function(),
    reserve: function(),
    setAddress: function(),
    setContent: function(),
    setSubRegistrar: function(),
    subRegistrar: function(),
    transfer: function()
}

The namereg contract allows associating human-comprehensible names with human-incomprehensible data. One of the use cases is creating a global address book for Ethereum addresses. Using a namereg contract, one may send ether to "5chdn" instead of "0x<some hex value>". One may also register things like IPFS hashes, allowing one to use it as a decentralized DNS for a decentralized Web.

To test that, type in your geth console:

registrar = GlobalRegistrar.at('0xc6d9d2cd449a754c494264e1809c50e34d64562b');

To set up your own name and give it a test:

registrar.reserve.sendTransaction('thepiachu', {from: eth.accounts[0]});
registrar.setAddress.sendTransaction('thepiachu', eth.accounts[0], true, {from: eth.accounts[0]});

To test, see if you can resolve "thepiachu" to your ethereum address:

registrar.addr('thepiachu');

Now, whenever anyone want to send you some ether, you only need to do this:

eth.sendTransaction({from: eth.accounts[0], to: registrar.addr('thepiachu'), value: web3.toWei(1, 'ether'), gas: 21000});

You'll need to run the GlobalRegistrar.at() line every time you start geth until this gets hard coded.

You can also replace the second parameter of .setAddress() above with a contract's address to "call it by name".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.