Keys and addresses
Keys and addresses are used in the Ethereum blockchain to represent ownership and transfer ether. The keys used are made up of pairs of private and public parts. The private key is generated randomly and is kept secret, whereas the public key is derived from the private key. Addresses are derived from public keys and are 20-byte codes used to identify accounts.
The process of key generation and address derivation is as follows:
- First, a private key is randomly chosen (a 256-bit positive integer) under the rules defined by the elliptic curve
secp256k1
specification (in the range [1
,secp256k1n − 1
]). - The public key is then derived from this private key using the Elliptic Curve Digital Signature Algorithm (ECDSA) recovery function. We will discuss this in the Transactions and messages section, in the context of digital signatures.
- An address is derived from the public key, specifically, from the rightmost 160 bits of the Keccak hash...