8

Some guy on reddit found an address with 235 ETH in his wallet. He was confused about how he managed to get so much ETH. Commentators told him that it is the global registrar object.

Here is an interesting snippet of his 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()
}

What is namereg? What is the global registrar?

3

The Global Registrar seems to already be hard coded into geth.

beefee@Kumquat:~$ geth console
I0330 00:29:31.337735    8794 database.go:71] Alloted 16MB cache to /home/beefee/.ethereum/chaindata
...
at block: 1235423 (Tue, 29 Mar 2016 10:10:53 AEDT)
modules: admin:1.0 db:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 shh:1.0 txpool:1.0 web3:1.0
> registrar
{
  address: "0x33990122638b9132ca29c723bdf037f1a891a70c",
  Changed: function(),
  PrimaryChanged: function(),
  Registrar: function(),
  addr: function(),
  allEvents: function(),
  content: function(),
  disown: function(),
  name: function(),
  owner: function(),
  register: function(),
  reserve: function(),
  setAddress: function(),
  setContent: function(),
  setSubRegistrar: function(),
  subRegistrar: function(),
  transfer: function()
}
> registrar.addr("BeefPool.net")
"0xbeef281b81d38096cd8b1d8f69f77be100000000"
> registrar.owner("BeefPool.net")
"0xbeef281b81d383336aca8b2b067a526227638087"

The answer 5chdn seems to give an invalid Global Registrar.

// Using the default hard-coded registrar
> registrar.addr("ethpool")
"0x4bb96091ee9d802ed039c4d1a5f6216f90f81b01"
// Invalid Global Registrar from 5chdn
> registrar = GlobalRegistrar.at('0xc6d9d2cd449a754c494264e1809c50e34d64562b');
{
  address: "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
  Changed: function(),
  PrimaryChanged: function(),
  Registrar: function(),
  addr: function(),
  allEvents: function(),
  content: function(),
  disown: function(),
  name: function(),
  owner: function(),
  register: function(),
  reserve: function(),
  setAddress: function(),
  setContent: function(),
  setSubRegistrar: function(),
  subRegistrar: function(),
  transfer: function()
}
> registrar.addr("ethpool")
"0x"

Also, from https://github.com/ethereum/go-ethereum/blob/master/common/registrar/registrar.go#L56-L63 :

  GlobalRegistrarAddr = "0x33990122638b9132ca29c723bdf037f1a891a70c" // frontier
  HashRegAddr         = "0x23bf622b5a65f6060d855fca401133ded3520620" // frontier
  UrlHintAddr         = "0x73ed5ef6c010727dfd2671dbb70faac19ec18626" // frontier

Here they are:

https://live.ether.camp/account/33990122638b9132ca29c723bdf037f1a891a70c https://live.ether.camp/account/23bf622b5a65f6060d855fca401133ded3520620 https://live.ether.camp/account/73ed5ef6c010727dfd2671dbb70faac19ec18626

  • 1
    In geth-1.4.6 I get a ReferenceError for both namereg as well as registrar. Did this change with the last couple of geth versions or what? – TMOTTM Jun 19 '16 at 20:12
5

A 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.

The global registrar is a commonly shared namereg contract that (as I understand it) will be integrated with user-friendly clients like Mist by default.

1

Update: Note, this is the testnet registrar!

Cool, in addition to the other answer, it's already implemented. 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('5chdn', {from: eth.accounts[0]});
registrar.setAddress.sendTransaction('5chdn', eth.accounts[0], true, {from: eth.accounts[0]});

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

registrar.addr('5chdn');

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

eth.sendTransaction({from: eth.accounts[0], to: registrar.addr('5chdn'), 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".

  • registrar.addr('5chdn'); returns "0x" for me, is that correct ? – euri10 Mar 29 '16 at 9:55
  • It seems this is the testnet registrar, oops :-) – Afr Mar 29 '16 at 13:52

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.