{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/EIPs/issues/55","repository_url":"https://api.github.com/repos/ethereum/EIPs","labels_url":"https://api.github.com/repos/ethereum/EIPs/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/EIPs/issues/55/comments","events_url":"https://api.github.com/repos/ethereum/EIPs/issues/55/events","html_url":"https://github.com/ethereum/EIPs/issues/55","id":126609688,"number":55,"title":"Yet another cool checksum address encoding","user":{"login":"vbuterin","id":2230894,"avatar_url":"https://avatars.githubusercontent.com/u/2230894?v=3","gravatar_id":"","url":"https://api.github.com/users/vbuterin","html_url":"https://github.com/vbuterin","followers_url":"https://api.github.com/users/vbuterin/followers","following_url":"https://api.github.com/users/vbuterin/following{/other_user}","gists_url":"https://api.github.com/users/vbuterin/gists{/gist_id}","starred_url":"https://api.github.com/users/vbuterin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbuterin/subscriptions","organizations_url":"https://api.github.com/users/vbuterin/orgs","repos_url":"https://api.github.com/users/vbuterin/repos","events_url":"https://api.github.com/users/vbuterin/events{/privacy}","received_events_url":"https://api.github.com/users/vbuterin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ethereum/EIPs/labels/ERC","name":"ERC","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":43,"created_at":"2016-01-14T09:04:52Z","updated_at":"2016-02-23T17:33:51Z","closed_at":null,"body":"Code:\r\n\r\n```python\r\ndef checksum_encode(addr): # Takes a 20-byte binary address as input\r\n    o = ''\r\n    v = utils.big_endian_to_int(utils.sha3(addr))\r\n    for i, c in enumerate(addr.encode('hex')):\r\n        if c in '0123456789':\r\n            o += c\r\n        else:\r\n            o += c.upper() if (v & (2**(255 - i))) else c.lower()\r\n    return '0x'+o\r\n```\r\n\r\nIn English, convert the address to hex, but if the ith digit is a letter (ie. it's one of `abcdef`) print it in uppercase if the ith bit of the hash of the address (in binary form) is 1 otherwise print it in lowercase.\r\n\r\nBenefits:\r\n\r\n* Backwards compatible with many hex parsers that accept mixed case, allowing it to be easily introduced over time\r\n* Keeps the length at 40 characters\r\n* ~~The average address will have 60 check bits, and less than 1 in 1 million addresses will have less than 32 check bits; this is stronger performance than nearly all other check schemes. Note that the very tiny chance that a given address will have very few check bits is dwarfed by the chance in any scheme that a bad address will randomly pass a check~~\r\n\r\nUPDATE: I was actually wrong in my math above. I forgot that the check bits are per-hex-character, not per-bit (facepalm). 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.\r\n\r\nExamples:\r\n\r\n* `0xCd2a3d9f938e13Cd947eC05ABC7fe734df8DD826` (the \"cow\" address)\r\n* `0x9Ca0e998dF92c5351cEcbBb6Dba82Ac2266f7e0C`\r\n* `0xcB16D0E54450Cdd2368476E762B09D147972b637`"},"comment":{"url":"https://api.github.com/repos/ethereum/EIPs/issues/comments/187806858","html_url":"https://github.com/ethereum/EIPs/issues/55#issuecomment-187806858","issue_url":"https://api.github.com/repos/ethereum/EIPs/issues/55","id":187806858,"user":{"login":"frozeman","id":232662,"avatar_url":"https://avatars.githubusercontent.com/u/232662?v=3","gravatar_id":"","url":"https://api.github.com/users/frozeman","html_url":"https://github.com/frozeman","followers_url":"https://api.github.com/users/frozeman/followers","following_url":"https://api.github.com/users/frozeman/following{/other_user}","gists_url":"https://api.github.com/users/frozeman/gists{/gist_id}","starred_url":"https://api.github.com/users/frozeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frozeman/subscriptions","organizations_url":"https://api.github.com/users/frozeman/orgs","repos_url":"https://api.github.com/users/frozeman/repos","events_url":"https://api.github.com/users/frozeman/events{/privacy}","received_events_url":"https://api.github.com/users/frozeman/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T17:33:51Z","updated_at":"2016-02-23T17:33:51Z","body":"The `0x` is optional and shouldn't be case checked at all.\r\nThough i personally lean to recommend people using the `0x` prefix consistently as it makes a clear distinction between numbers (`234567`), strings (`fad1`) and HEX encoded data (`0xfad1`)"}}