My Goal

I'm trying to register a name on the Ropsten testnet using the FIFSRegistrar located at 0x21397c1a1f4acd9132fe36df011610564b87e24b. I am using MEW to send the transaction.

Label and Hashes

I'll refer to the name as "myName.test", but use the real hashes.

The hash of my label is sha3('myName') = 0xc99b34b53e4b2e6ede6d30a0bb7d62dbb1c54f68113c9c189f572687fc778ecc.

The namehash I am registering is namehash('myName.test') = 0x4c432675fc6a71ce63b71b12db314c4857a215abc7768ad213ebbcf88bdb5bd3.

Transaction Attempt

My transaction is mined and seems to work as expected. In particular I can see in the Event Logs that it called the setSubnodeOwner() function of the ENSRegistry located at 0x112234455c3a32fd11230c42e7bccd4a84e02010. So far so good.

However, when I call the owner() function of the ENSRegistry and pass it the namehash of my name, it returns 0x0. Looks like my name is not registered after all...

Any idea why it is not working?

Thanks in advance.


You are using the wrong namehash. When you use the correct namehash, the contract shows you as the owner.


The correrct namehash of your label hash under .test is 0x944f155a1f09749e7a9ee390f3b20926c9a285939187135286e5a1b7fd39b8c2. Your address, 0x3a81ff1fdf10faa57e3d6f0628613ce276ee4f39, owns that namehash on Ropsten. You can confirm that on MyEtherWallet.com with these steps:

  1. Choose the Ropsten network at top-right
  2. Select the ENS Registry contract from the dropdown
  3. Click Access
  4. Choose the owner function from the dropdown
  5. Copy in the namehash to the node field
  6. Click READ

Confirming ENS ownership

Calculating Namehash

Here is a step-by-step calculation of the namehash:

from web3utils import web3

# namehash(ROOT)
rootnode = b'\0' * 32

# labelhash('test')
testhash = web3.sha3('test'.encode('utf-8'))

# namehash('test')
testnode = web3.sha3(rootnode + testhash)

# labelhash('??myname??')
mynamehash = web3.toAscii('0xc99b34b53e4b2e6ede6d30a0bb7d62dbb1c54f68113c9c189f572687fc778ecc')

# namehash('??myname??.test')
mynamenode = web3.sha3(testnode + mynamehash)

assert web3.toHex(mynamenode) == '0x944f155a1f09749e7a9ee390f3b20926c9a285939187135286e5a1b7fd39b8c2'

Note that this uses a python library, web3utils, which requires a local node.

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.