-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Web3.isAddress doesn't work for non prefixed checksumed values #715
Comments
This is due to a discrepancy between In [79]: is_checksum_formatted_address('d3CdA913deB6f67967B99D67aCDFa1712C293601')
Out[79]: True
In [80]: is_checksum_address('d3CdA913deB6f67967B99D67aCDFa1712C293601')
Out[80]: False We could:
I'm torn. I like having a very strict representation of checksummed addresses (as well as an unambiguous requirement that they have |
The reason it works this way is because of how EIP-55 defines the checksum addresses. According to spec, it's not a valid checksum address if it does not have the "0x" prefix. Note that the So this seems like the right solution:
|
Ok, but the real question here is *what is the
If it's either of the valid variations then I think the function is poorly named, so I'd posture that the right fix is to update the docs as you specified, but to remove the checksum checking from the |
Good point. It used to be that I suppose it should be: "is this address valid as an input to: def is_address(v):
return is_hex_address(v) or is_binary_address(v) |
Once this is merged in |
What was wrong?
As stated in the docs http://web3py.readthedocs.io/en/latest/overview.html#Web3.isAddress the function Web3.isAddress(value) should allow both 0x prefixed and non prefixed values.
If the address is not checksumed, it's ok not to have the 0x:
But if it's checksumed
No problem if we add the 0x:
How can it be fixed?
Changing the documentation to state that checksumed addresses must have 0x or changing the function to accept checksumed addresses with 0x. I would just remove 0x at the beginning of the function (if found) and work with the address as that.
The text was updated successfully, but these errors were encountered: