A public-key cryptography (or asymmetrical cryptography) is one that uses pairs of keys: 1. public key (open to anyone); and 2. private key (only known to the owner). In the case of Bitcoin which uses such cryptography, then what is the relationship between one’s private key, public key, and public address??
1. Private key
A private key is essentially a randomly generated, 32-byte number.
2. Public key
A public key can be derived from the private key using what’s called Elliptic Curve Cryptography. Bitcoin uses a specific elliptic curve called secp256k1 over the finite (prime) field of (2²⁵⁶-2³²-2⁹-2⁸-2⁷-2⁶-2⁴-1) number of elements, using the generator point (on the curve) G=(x, y) where (in hexademical):
Formula: public key = (private key) * G
Elliptic curve: y² = x³+a x+b
secp256k1 curve: y² = x³+7
In the formula, note that the multiplication (a number times a point) is done via group law on the elliptic curve.
3. Public address
A hash function h() is one that can be used to map data of arbitrary size to data of fixed size. It satisfies two properties: 1. one-way — given h(x)=y, it’s computationally infeasible to find z such that h(z)=y; and 2. collision-free — it’s computationally infeasible to find x and y such that h(x)=h(y).