1

I wonder how EIP 55 check proves an address is actually an Ethereum address, or does it prove this at all?

Am I missing an obvious point in Vitalik's code below from EIP 55?

from ethereum import utils

def checksum_encode(addr): # Takes a 20-byte binary address as input
    o = ''
    v = utils.big_endian_to_int(utils.sha3(addr.hex()))
    for i, c in enumerate(addr.hex()):
        if c in '0123456789':
            o += c
        else:
            o += c.upper() if (v & (2**(255 - 4*i))) else c.lower()
    return '0x'+o

def test(addrstr):
    assert(addrstr == checksum_encode(bytes.fromhex(addrstr[2:])))

P.S. I've checked the answers here and here, but none answer my exact question.

1

What do you mean by 'valid Ethereum address'? You can send ETH to any series of 20 bytes, so in that sense there are no invalid addresses.

All EIP 55 does is provide a checksum to be able to detect copying errors: changing a digit will invalidate the checksum. It doesn't say anything about whether there exists a private key for the address, whether anyone has a private key for that address or whether a smart contract is located at that address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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