EC Private Key Example - secp256k1

This section describes the elliptic curve, E(0,7), also named as secp256k1, and the subgroup parameters, which are used in Bitcoin, Ethereum, and many other cryptocurrency apps.

Now let's look at a good example of using EC (Elliptic Curve) private and public key pairs in real software applications as mentioned in "What is the math behind elliptic curve cryptography?" by Hans Knutson at hackernoon.com/what-is-the-math-behind-elliptic-curve-cryptography-f61b25253da3.

Bitcoin, Ethereum, and many other cryptocurrency apps use an elliptic curve called secp256k1:

Named elliptic curve: secp256k1
    y2 = x3 + 7

The diagram below shows the elliptic curve, secp256k1, in the real number space:

Elliptic Curve: secp256k1 or E(0,7)
Elliptic Curve: secp256k1 or E(0,7)

Bitcoin, Ethereum, and many other cryptocurrency apps actually use the subgroup defined by the following parameters in hexadecimal format. See "Elliptic Curve Cryptography: ECDH and ECDSA" by Andrea Corbellini at andrea.corbellini.name/2015/05/30/elliptic-curve-cryptography-ecdh-and-ecdsa/.

p =  0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
a =    0
b =    7
G = (0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,
     0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8)
n =  0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
h =    1

Andrea Corbellini also shared Python script, ecdhe.py, to generate a private and public key pair for Alice:

C:\herong>python ecdhe.py

Curve: secp256k1
Alice's private key: 
   0xc2cdf0a8b0a83b35ace53f097b5e6e6a0a1f2d40535eff1cf434f52a43d59d8f
Alice's public key: 
  (0x6fcc37ea5e9e09fec6c83e5fbd7a745e3eee81d16ebd861c9e66f55518c19798, 
   0x4e9f113c07f875691df8afc1029496fc4cb9509b39dcd38f251a83359cc8b4f7)

By the way, the named curve, secp256k1, refers to the elliptic curve, E(0,7), and those subgroup parameters together as EC domain parameters.

Last update: 2019.

Table of Contents

 About This Book

 Geometric Introduction to Elliptic Curves

 Algebraic Introduction to Elliptic Curves

 Abelian Group and Elliptic Curves

 Discrete Logarithm Problem (DLP)

 Finite Fields

 Generators and Cyclic Subgroups

 Reduced Elliptic Curve Groups

 Elliptic Curve Subgroups

 tinyec - Python Library for ECC

EC (Elliptic Curve) Key Pair

 EC Private and Public Key Pair

 Is EC Private Key Secure

EC Private Key Example - secp256k1

 Generate secp256k1 Keys with OpenSSL

 EC Key in PEM File Format

 EC Key File with Curve Name

 Create EC Public Key File

 ECDH (Elliptic Curve Diffie-Hellman) Key Exchange

 ECDSA (Elliptic Curve Digital Signature Algorithm)

 ECES (Elliptic Curve Encryption Scheme)

 Terminology

 References

 Full Version in PDF/EPUB