0

What happens if you initiate a transaction to a non-existent address in geth? Is there any way to determine if an account exists as a legal address?

Hope you can give me some help, thanks!

2
  • 1
    Technically speaking, all addresses are legal, even if not (yet) owned by anyone. You can check the nonce and see if it's larger than zero, which would give you a pretty good indication whether or not the account is already in use. – goodvibration Dec 2 '20 at 12:00
  • Thanks for your comment! – wei wang Dec 3 '20 at 0:44
0

There is no official checksum for Ethereum addresses, which means that any combination of 40 hex chars (excluding 0x) is a valid address.

There is a workaround though that was proposed by EIP-55. It specifies an algorithm for encoding addresses using a mix of upper and lower cases. According to the original issue 55:

(...) 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.

Before sending any transaction, you could check whether the target address follows the EIP-55 pattern. But be warned: if it doesn't follow, it doesn't mean it is an invalid address, as goodvibration pointed out in his comment.

1
  • Thanks for your answer! – wei wang Dec 3 '20 at 0:44

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.