At a glance
- An address is
- A 20-byte identifier, written as
0xfollowed by 40 hexadecimal characters, that names one account on the chain - Two kinds
- An externally owned account, controlled by a private key, and a contract account, controlled by its code
- Where it comes from
- A person's address is derived from their public key; a contract's is derived from its deployer and a counter
- The mixed case
- The capital and lowercase letters are a built-in checksum that catches most typos
- What it is not
- It is not a secret and not a password. An address is public by design; the private key behind it is the secret
Twenty bytes with a 0x in front
An Ethereum address is just a number, 20 bytes long, that the ecosystem writes in hexadecimal with a 0x prefix. That gives the familiar 42-character string.
0x2170Ed0880ac9A755fd29B2688956BD959F933F8
|__| 2 chars: the 0x prefix
|____________________________________| 40 hex chars = 20 bytes
It is the name of an account: where value is held, and where transactions are sent. It is meant to be shared. You give someone your address so they can pay you, exactly as you would a bank account number, and knowing it lets anyone look up your balance and history but never move your funds. Only the private key can do that, and the address is not the key.
Two kinds of account behind an address
Every address is one of two types, and they look identical from the outside.
- An externally owned account (EOA) is a person's account. It is controlled by a private key, and a human (or their software) authorises its actions by signing with that key. It has a balance but no code.
- A contract account is a smart contract. It has a balance and code, and it is controlled by that code rather than a key. It cannot start a transaction on its own; it only runs when something calls it.
You often cannot tell which is which just by looking, which matters for security: sending tokens to a contract that was not written to receive them can lock them forever, and a "wallet" that is actually a contract signs differently from one backed by a key.
Where an address comes from
For a person's account, the address is derived from their public key. The key is hashed with keccak-256, and the last 20 bytes of that hash become the address. The chain of secrets runs one way only: private key produces public key produces address, and none of those steps can be reversed.
address = last_20_bytes( keccak256( public_key ) )
// private key --> public key --> address
// each arrow is one-way: you cannot walk it backwards
A contract's address is computed differently, because a contract has no key. When someone deploys a contract, its address is derived from the deployer's address and a counter (the deployer's nonce), so it is fixed and predictable the moment it is created. A variant, CREATE2, lets a deployer choose an address in advance from a chosen salt, which is how some wallets and factories know a contract's address before it exists.
Why some letters are capitalised
You may have noticed addresses mix upper and lower case. That is not decoration. Hex only needs the digits 0-9 and a-f, so case would normally be meaningless. Ethereum reuses it as a checksum (defined in EIP-55): the capitalisation of each letter is set by the hash of the address itself. A wallet can therefore check that an address is internally consistent and warn you if a single character was mistyped, catching the kind of copy-paste error that would otherwise send funds into a void. If a tool shows an address in all lower case it simply has not applied the checksum; the address is still valid.
The short version. An address is a 20-byte public identifier for an account, shown as 0x plus 40 hex characters. It is either an externally owned account controlled by a private key, or a contract account controlled by its code, and the two are indistinguishable at a glance. A person's address is the tail of the hash of their public key; a contract's is derived from its deployer. The mixed case is a checksum that guards against typos. The address is public; the private key behind it is the only secret that matters.
References & further reading
- Ethereum community, Accounts. Externally owned versus contract accounts, and how addresses are formed.
- Ethereum Improvement Proposals, EIP-55: Mixed-case checksum address encoding. Why the capitalisation is meaningful.
- Ethereum Improvement Proposals, EIP-1014: CREATE2. Choosing a contract address before deployment.