namecoin – How does Ethereum area registration works?

0
63


The Ethereum community not too long ago launched a international registrar object which is basicly a public good contract on the chain.

Here’s a snippet of an ethereum consumer command line output:

namereg: {
    handle: "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
    AuctionEnded: operate(),
    Modified: operate(),
    NewBid: operate(),
    PrimaryChanged: operate(),
    Registrar: operate(),
    addr: operate(),
    allEvents: operate(),
    content material: operate(),
    disown: operate(),
    identify: operate(),
    proprietor: operate(),
    reserve: operate(),
    setAddress: operate(),
    setContent: operate(),
    setSubRegistrar: operate(),
    subRegistrar: operate(),
    switch: operate()
}

The namereg contract permits associating human-comprehensible names with human-incomprehensible knowledge. One of many use circumstances is creating a world handle e book for Ethereum addresses. Utilizing a namereg contract, one could ship ether to “5chdn” as an alternative of “0x<some hex worth>”. One may additionally register issues like IPFS hashes, permitting one to make use of it as a decentralized DNS for a decentralized Internet.

To check that, sort in your geth console:

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

To arrange your individual identify and provides it a check:

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

To check, see when you can resolve “thepiachu” to your ethereum handle:

registrar.addr('thepiachu');

Now, each time anybody need to ship you some ether, you solely want to do that:

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

You may must run the GlobalRegistrar.at() line each time you begin geth till this will get exhausting coded.

You too can exchange the second parameter of .setAddress() above with a contract’s handle to “name it by identify”.

LEAVE A REPLY

Please enter your comment!
Please enter your name here