logoAcademy

Accounts, Keys and Addresses

Learn about Accounts, Keys and Addresses in EVM.

Accounts

In the EVM, there are two types of accounts:

  1. Externally Owned Accounts (EOAs): These are accounts controlled by private keys and have no associated code with them. They can send transactions (including Ether transfers) by creating and signing them with their private keys. Essentially, if you are an end user of Ethereum, you're likely using an EOA.

  2. Contract Accounts: These are accounts that have associated code with them (Smart Contracts). Contract accounts can't initiate transactions on their own. Instead, they only perform an operation when instructed to do so by an EOA. This could be a simple Ether transfer or a function call in a smart contract.

Public and Private Keys

In Ethereum, like in many blockchain platforms, we use a cryptographic algorithm called Elliptic Curve Digital Signature Algorithm (ECDSA) to generate a pair of keys: the public key and the private key.

The private key is a 32-byte number chosen at random.

The public key is derived from this private key by using a specific function of the elliptic curve cryptography. This key is 64 bytes and consists of two concatenated coordinates (32 bytes each).

Addresses

An EVM address is derived from the public key through the following steps:

  1. Keccak-256 Hashing: The first step is to pass the public key through the Keccak-256 hashing function (the version of SHA-3 used by Ethereum). Keccak-256 will output a string 64 bytes long. 025ad33e2479a53b02dc0be66eb0ce272fc0f4358c57a8f0a442410c3d831a

  2. Rightmost 20 bytes: The resulting string is then truncated, keeping only the last 20 bytes. In the hex representation that means the rightmost 40 hex digits, since two hex digits (0-9, a-g) represent one byte. e66eb0ce272fc0f4358c57a8f0a442410c3d831a

  3. Adding '0x': Finally, "0x" is added at the start of the address for a total of 42 characters. This "0x" indicates that what follows is a hexadecimal number, and it's a common prefix for hexadecimal in the Ethereum ecosystem. 0xe66eb0ce272fc0f4358c57a8f0a442410c3d831a

This process ensures that each Ethereum address directly corresponds to a unique public key. Also, because the address is a truncated hash of the public key, it's not feasible to regenerate the public key from it.

On this page