# 3.2.1 Secp256k1 Curve

In cryptography, secp256k1 is an elliptic curve used for digital signatures and key generation, including in the Bitcoin blockchain.

Note that all elliptic curves are equations defined as y2 = x3 + ax + b. The code Secp256k1 is an elliptic curve used by several blockchains to implement public and private key pairs. For instance, we can define Secp256k1 as a = 0 and b = 7 (i.e., secp256k1 lives on the equation y2 = x3 + 7). Before a user generates a public and private key pair (pk, sk), he/she must first generate a sufficiently large random number (which is going to be sk) and use it to multiply with the private key by the generator point G as sk.G (which is going to be the pk). We use this number to define a point on the secp256k1 curve. Due to the underlying discrete log problem (DLP), no one can derive the private key from the given public key and the generator point (as long as the key size is sufficiently large). Note that for each value of x, the y component is squared in this equation leading to having two symmetric points across the x-axis. Hence, there are two values of y called odd and even numbers. Therefore, public keys can be identified by the x-coordinate and the parity of the y-coordinate. In the blockchain space, this feature is crucial, as it saves significant data storage.

Last updated