A private key is a randomly generated number, typically 256 bits long. The size of this keyspace is what makes it secure: crypto.news quantifies it as roughly 10^77 possible values, a figure it compares to the estimated 10^80 atoms in the observable universe.[2]
The public key is then derived from this private key using elliptic curve multiplication—multiplying the private key by a fixed generator point on the curve. This is a one-way function: fast to compute in the forward direction but practically impossible to reverse, because doing so would require solving the elliptic curve discrete logarithm problem, for which there is no known efficient solution.[2]
Investopedia similarly describes the private key being sent through a hashing function—usually, it says, an elliptical curve function—to create the public key.[3]
Both Bitcoin and Ethereum use the same elliptic curve, known as secp256k1. According to crypto.news, this curve produces 256-bit private keys and 512-bit uncompressed public keys, or 257-bit compressed public keys.[2]
A public key can be stored in two forms. An uncompressed public key is 65 bytes: a 1-byte prefix of 0x04 followed by 32 bytes for the x coordinate and 32 bytes for the y coordinate. A compressed public key is 33 bytes: a 1-byte prefix of 0x02 for an even y value or 0x03 for an odd y value, followed by the 32-byte x coordinate, with the prefix encoding the parity of y so that the y value can be reconstructed.[2]
Investopedia states that an Ethereum public key is 64 bytes, or 128 characters in hexadecimal format, and that on Ethereum the public key is generated automatically by the wallet.[3]
The choice of compression format has a practical consequence. Compressed and uncompressed public keys derived from the same private key produce different Bitcoin addresses, so importing a private key into a wallet that uses a different compression format than the original will generate a different address.[2]