Mistakes can get fairly expensive when it comes to dealing with money. Because of this, Bitcoin implemented error detection using checksums to catch attempts to use invalid addresses. Ethereum decided to take more compositional approach and delegate this functionality to higher-level systems, but while they are being created and adopted many users are losing their money. Implementing checksum is fairly easy, but the tricky part is doing it in a backwards compatible way. Take a minute and try to come up with a way to add checksums to Ethereum addresses without changing them. Hint:
Ethereum Addresses are based on the Hexadecimal format (also base16 or hex). [...]. Ethereum addresses are not case sensitive and can be used as lowercase or uppercase.
Since addresses are case insensitive, what if we use casing to embed checksum information? That's exactly what Vitalik proposed in EIP-55:
Basically we are computing a checksum using keccak256
and use its hex representation as a mask to decide whether hex digit of the address should be upper-cased based on a value of the checksum at the same position:
Older clients ignore the case and don't perform the check, hence backwards compatibility, but newer clients perform the check and detect errors.
It's fascinating that such a simple, cheap and backwards compatible technique:
On average there will be 15 check bits per address, and the net probability that a randomly generated address if mistyped will accidentally pass a check is 0.0247%. This is a ~50x improvement over ICAP, but not as good as a 4-byte check code.
This underscores the value of a specification, as it defines correct behavior and as such enables behavior preserving changes. It’s an interesting example of a clever way to embed additional information.