Does case (upper/lowercase) matter for ethereum addresses?
A guide to the case checksum in ethereum addresses.
Table of Contents for Does case (upper/lowercase) matter for ethereum addresses?
Ethereum wallet addresses are 42-character hex strings, which are the last 20 bytes from the private key for a wallet.
(you can always find the public key (wallet address) from a private key, but you can’t do the reverse).
Contract addresses are also 42 characters (but the private key is not known).
Ethereum addresses are not case-sensitive. So 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
is equivalent to 0XC02AAA39B223FE8D0A0E5C4F27EAD9083C756CC2
.
However, you will often see them written with some uppercase, some lowercase. These are known as checksum addresses. The previous address in the checksum format is 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
.
Using that format, tools can validate if it is a ‘valid’ address (technically any address is valid if it uses 0-9A-F characters).
If a program/website outputs an address in the checksum address format, then if you type it somewhere else with a mix of upper/lowercase then it can be checked that you didn’t (or very unlikely) make an error.
EIP-55
This checksum was introduced in EIP-55
This was created by Vitalik Buterin and Alex Van de Sande, back in 2016.
Information about the checksum
Wikipedia describes a checksum as:
A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data integrity but are not relied upon to verify data authenticity.
Checksum algo is defined here: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
Further reading
- EIP-55 https://eips.ethereum.org/EIPS/eip-55
- An implementation of EIP-55 in Solidity https://ethereum.stackexchange.com/a/63953. Probably not useful, but interesting to read
Spotted a typo or have a suggestion to make this crypto dev article better? Please let me know!
Next post
Previous post
📙 Solidity Auditing online quiz
Learn how to audit smart contracts by looking at some example code and trying to find the bugs
⛽ Solidity Gas Optimizations Guide
How to optimize and reduce gas usage in your smart contracts in Solidity
🧪 Guide to testing with Foundry
Guide to adding testing for your Solidity contracts, using the Foundry and Forge tools
📌 Guide to UTXO
UTXO and the UTXO set (used by blockchains such as Bitcoin) explained
📐 Solidity Assembly Guide
Introduction guide to using assembly in your Solidity smart contracts
📦 Ethereum EOF format explained
Information explaining what the upcoming Ethereum EOF format is all about