ERC-55: Mixed-case checksum address encoding
Metadata
Status: FinalStandards Track: ERCCreated: 2016-01-14
Authors
Vitalik Buterin (vitalik.buterin@ethereum.org), Alex Van de Sande (avsa@ethereum.org)
Specification
Code:
In English, convert the address to hex, but if the i
th digit is a letter (ie. it's one of abcdef
) print it in uppercase if the 4*i
th bit of the hash of the lowercase hexadecimal address is 1 otherwise print it in lowercase.
Rationale
Benefits:
- Backwards compatible with many hex parsers that accept mixed case, allowing it to be easily introduced over time
- Keeps the length at 40 characters
- 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.
Implementation
In javascript:
Note that the input to the Keccak256 hash is the lowercase hexadecimal string (i.e. the hex address encoded as ASCII):