Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENS reverse lookup with lowercase address? #508

Closed
ellis2323 opened this issue May 9, 2019 · 9 comments
Closed

ENS reverse lookup with lowercase address? #508

ellis2323 opened this issue May 9, 2019 · 9 comments
Labels
discussion Questions, feedback and general information.

Comments

@ellis2323
Copy link

ellis2323 commented May 9, 2019

if you reverse 0xcf83b1c347c558923860bd19702d80e86ff81177 it returns Nothing.
if you reverse 0xCF83B1C347C558923860Bd19702D80e86ff81177 it returns ellis2323.eth

not sure if it was related to #269

The current fix is to convert to checksum address.

@ricmoo
Copy link
Member

ricmoo commented May 10, 2019

Hmm... Which network are you using? It works for me in both cases (the name hash algorithm lowercases everything, so that shouldn't matter as long as I'm using namehash internally).

/home/ricmoo> ethers
homestead> provider.lookupAddress("0xCF83B1C347C558923860Bd19702D80e86ff81177")
'ellis2323.eth'
homestead> provider.lookupAddress("0xcf83b1c347c558923860bd19702d80e86ff81177")
'ellis2323.eth'
homestead> 

@ricmoo ricmoo added the discussion Questions, feedback and general information. label May 10, 2019
@ellis2323
Copy link
Author

ellis2323 commented May 10, 2019

I'm using ethers with infura provider. Not sure, it could be related to infura ?

let  conn = new ethers.providers.InfuraProvider('mainnet', token)
address = web3Utils.toChecksumAddress(address)
let name = await conn.lookupAddress(address)

@ricmoo
Copy link
Member

ricmoo commented May 10, 2019

Hmmm... I still can't reproduce it. Which version are you using?

> ethers.version
'4.0.27'
p = new ethers.providers.InfuraProvider()
> p.lookupAddress("0xCF83B1C347C558923860Bd19702D80e86ff81177").then(console.log)
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      { removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] } }
> ellis2323.eth
> p.lookupAddress("0xcf83b1c347c558923860bd19702d80e86ff81177").then(console.log)
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      { removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] } }
> ellis2323.eth

@ricmoo
Copy link
Member

ricmoo commented May 10, 2019

(also, ethers.utils.getAddress(address) will return the checksum address)

@ellis2323
Copy link
Author

version: 4.0.27. I had replayed my unit tests and I cannot reproduce it.

@ellis2323
Copy link
Author

Found the problem. Initially, I was using this code:

https://docs.ens.domains/dapp-developer-guide/resolving-names

With:

var address = '0x1234...';
var name = await ens.reverse(address);
// Check to be sure the reverse record is correct.
if(address != await ens.lookup(name)) {
name = null;
}

But it doesn't work if the address is not the Checksum version. I don't known how to contact them for this documentation.

My bad

@ricmoo
Copy link
Member

ricmoo commented May 10, 2019

Ah yes. Ethers always returns checksum addresses. You could do something like:

var address = ethers.utils.getAddress('0x1234...');

Which will checksum it from the beginning, so equality checks should pass. :)

@ricmoo ricmoo changed the title ENS reverse with lowercase address ENS reverse lookup with lowercase address? May 10, 2019
@ellis2323
Copy link
Author

Best regards, sorry for the trouble

@ricmoo
Copy link
Member

ricmoo commented May 10, 2019

No worries. Glad it all worked out. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions, feedback and general information.
Projects
None yet
Development

No branches or pull requests

2 participants