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

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

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

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

herong> python

Curve: secp256k1
Alice's private key:
Alice's public key:

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

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)

 EC Cryptography in Java

 Standard Elliptic Curves



 Full Version in PDF/EPUB