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

Cannot use uppercase address in isAddress #1256

Closed
sc0Vu opened this issue Dec 27, 2017 · 3 comments
Closed

Cannot use uppercase address in isAddress #1256

sc0Vu opened this issue Dec 27, 2017 · 3 comments

Comments

@sc0Vu
Copy link

sc0Vu commented Dec 27, 2017

I've try many times to use uppercase address in isAddress, but it always return false.
Test address input 0XCA35B7D915458EF540ADE6068DFE2F44E8FA733C.
After trace the source code, I found the els if didn't work (it return false in first if).
So the uppercase address cannot using...

https://github.com/ethereum/web3.js/blob/bacd46e94e31ec5d4d70c4396f42eb6ff6146a20/packages/web3-utils/src/utils.js#L81

@taylorjdawson
Copy link

Can you include a code snippet of how you are using the isAddress method?

@eepstein
Copy link

Why isn't this just using the isValidAddress() function from https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md ?
Why hand-roll the logic for this when there's a package that implements the standard?

@eepstein
Copy link

@sc0Vu from what I understand, case can be significant in ETH addresses. In particular, the default is that addresses are all lowercase, and that if addresses contain a mix of upper and lower case then the case of the A-F digits is providing a kind of in-line checksum of the address to help prevent typos.

So... not working with uppercase hex digits may be by design. For details on the clever mixed-case checksum, see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants