78

I sent some amount of ETH to a wallet. I checked the wallets balance on ether chain. I entered the address in the search field and noticed both lowercase and uppercase versions of the address seemed to work.

I wanted to buy a few bucks more, but now I'm not sure if there is something wrong with the address I created. I'd be grateful for some guidance.

1
  • No, it's case insensitive.
    – Eric
    Jun 9, 2022 at 5:01

3 Answers 3

87

Ethereum wallet addresses are in hex [0-9A-F]*. While the address itself is case-insensitive (A is the same as a to the network), the case sensitivity is used as a (optional) checksum. It was built as an after-thought to an addressing scheme that lacked basic checksum validation.

https://github.com/ethereum/EIPs/issues/55#issuecomment-187159063

The checksum works like so:

  1. lowercase address and remove 0x prefix
  2. sha3 hash result from #1
  3. change nth letter of address according to the nth letter of the hash:
  • 0,1,2,3,4,5,6,7 → Lowercase
  • 8, 9, a, b, c, d, e, f → Uppercase

So, you sha3 hash the address, and look at each Nth character of the sha result. If it's 7 or below, the Nth character in the address is lowercase. If it is 8 or above, that character is uppercase.

(Brought from an old Ethereum forum whose link is now broken.)

3
  • 9
    And the purpose of a checksum is to help make sure you typed in the address correctly. If there was no case-sensitivity check you could accidentally type "a" instead of "b" and send it to the wrong address. But if you accidentally type "a" instead of "B" (there's a 50% chance the letter was supposed to be capitalized), then you wallet software / exchange would throw an error Feb 12, 2019 at 18:44
  • 4
    Actually it's more than that. Even if you'd accidentally type "a" instead of "b" in an otherwise checksummed address, an error would be detected, because the capitalization pattern of the other letters would now be invalid.
    – CherryDT
    Jan 31, 2020 at 15:30
  • 4
    ^"More than that" (@CherryDT) refers to the probability. the probability that a user mis-typing an "a" instead of "b" will be detected by this capitalization checksum is greater than 50%. using an a instead of b will not only change the capitalization of the current character but also the following characters. so the probability to detect the error will be something like (1 - (0.5 * 0.5 * ... remaining_characters)), which can be guess-timated to 1 - very_small_number which is high probability; like 99.x %
    – xst
    Jul 10, 2021 at 7:57
47

Capitalization simply means the address has a checksum. You should use the capitalization address because of this, but both will work.

4
  • 1
    To verify, any addresses that's fully capitalized can be converted to an checksum address with right capitalization. So in that sense addresses are case insensitive - both addresses are the same. Unlike for example the unix/linux file system where you can have a file named 'Ethereum' and one named 'ethereum' in the same directory. Isn't that right?
    – Gerbrand
    Sep 8, 2016 at 12:23
  • 3
    @JorisBontje I think this answer could still be clarified. Changing the letters to upper case doesn't give the address a checksum.
    – Peter Hall
    Jun 21, 2017 at 13:27
  • 5
    what does capitalization address mean exactly? this answer is a bit ambiguous
    – knocte
    Jun 29, 2017 at 7:22
  • Capitalization tells you whether or not the address is checksummed. An address with mixed case is checksummed. An address with any other casing is not checksummed (so, all lower case == not checksummed, all upper-case == not checksummed). See eips.ethereum.org/EIPS/eip-55. Aug 10, 2022 at 18:58
11

Look at this examples:

> Web3.utils.toChecksumAddress("0x03fB09251eC05ee9Ca36c98644070B89111D4b3F".toLowerCase());
'0x03FB09251eC05ee9Ca36c98644070B89111D4b3F'
> Web3.utils.toChecksumAddress("0x03fB09251eC05ee9Ca36c98644070B89111D4b3f".toLowerCase());
'0x03FB09251eC05ee9Ca36c98644070B89111D4b3F'
> Web3.utils.toChecksumAddress("0x03fB09251eC05ee9Ca36c98644070B89111D4b3e".toLowerCase());
'0x03Fb09251ec05eE9CA36c98644070B89111D4b3e'
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3f".toLowerCase());
true
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3F".toLowerCase());
true
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3F");
true
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3f");
false
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3e");
false
> Web3.utils.isAddress("0x03FB09251eC05ee9Ca36c98644070B89111D4b3E");
false

Note the last char ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.