6

According to this post regarding how to derive the Ethereum address from a public key:

Take the last 40 characters / 20 bytes of this public key (Keccak-256). Or, in other words, drop the first 24 characters / 12 bytes. These 40 characters / 20 bytes are the address. When prefixed with 0x it becomes 42 characters long.

My question is why the last 20 bytes (as opposed to something other than 20), is it an arbitrary decision or is there an underlying mathematical purpose to it?

4

Full public keys aren't really that useful in Ethereum*, as they don't serve any practical use. Taking the last 20 bytes is a:

  1. Heuristic aimed to simplify the management of the key; that is, copy and pasting, checksums or confirmations over the phone in large transfers.

  2. Pre-empting security mechanism. Hashing functions are broken every other decade or so, hence cutting the full public key is a great extra layer of defense. Satoshi did the same in Bitcoin, as the address is hashed twice: SHA-256 and RIPEMD-160 (if one gets broken, you still have the other one as a shield).

*You could use Ethereum for sending messages, but why would you? It's expensive and you could use PGP.

  • 1
    For the note "You could use Ethereum for sending messages, but why would you? It's expensive and you could use PGP": One useful scenario is to communicate with the key holder outside Ethereum, ensuring only he/she can decode the message. For further discussion please see ethresear.ch/t/from-ethereum-keys-to-pgp-communications/1947/3 – Mikko Ohtamaa Aug 8 '18 at 11:46
  • @PaulRBerg That's insightful, I forgot that Satoshi did something similar with Bitcoin addresses – delos Aug 8 '18 at 20:09

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.