public key from private key math

Please guide me if following is the actual math to drive public key from a private key then how would this apply to generate public key from private key 1 please guide me step by step

Private keys and public keys With these formalities out of the way, we are now in a position to understand private and public keys and how they are related. Here it is in a nutshell: In ECDSA, the private key is an unpredictably chosen number between 1 and the order. The public key is derived from the private key by scalar multiplication of the base point a number of times equal to the value of the private key. Expressed as an equation:

public key = private key * base point

This shows that the maximum possible number of private keys (and thus bitcoin addresses) is equal to the order.

In a continuous field we could plot the tangent line and pinpoint the public key on the graph, but there are some equations that accomplish the same thing in the context of finite fields. Point addition of p + q to find r is defined component-wise as follows:

c = (qy – py) / (qx – px) rx = c2 – px – qx ry = c (px – rx) – py

And point doubling of p to find r is as follows:

c = (3px2 + a) / 2py rx = c2 – 2px ry = c (px – rx) – py

In practice, computation of the public key is broken down into a number of point doubling and point addition operations starting from the base point.

Let’s run a back of the envelope example using small numbers, to get an intuition about how the keys are constructed and used in signing and verifying. The parameters we will use are:

Equation: y2 = x3 + 7 (which is to say, a = 0 and b = 7) Prime Modulo: 67 Base Point: (2, 22) Order: 79 Private key: 2

First, let’s find the public key. Since we have selected the simplest possible private key with value = 2, it will require only a single point doubling operation from the base point. The calculation looks like this:

c = (3 * 22 + 0) / (2 * 22) mod 67 c = (3 * 4) / (44) mod 67 c = 12 / 44 mod 67

Here we have to pause for a bit of sleight-of-hand: how do we perform division in the context of a finite field, where the result must always be an integer? We have to multiply by the inverse, which space does not permit us to define here (we refer you to here and here if interested). In the case at hand, you will have to trust us for the moment that:

44-1 = 32

Moving right along:

c = 12 * 32 mod 67 c = 384 mod 67 c = 49

rx = (492 – 2 * 2) mod 67 rx = (2401 – 4) mod 67 rx = 2397 mod 67 rx = 52

ry = (49 * (2 – 52) – 22) mod 67 ry = (49 * (-50) – 22) mod 67 ry = (-2450 – 22) mod 67 ry = -2472 mod 67 ry = 7

Our public key thus corresponds to the point (52, 7). All that work for a private key of 2!

• This all looks correct. What specifically is your question? May 17 '21 at 15:26
• example has given over mod 67, i just need an example with MOD 2^256 i tried myself but all went wrong or is their script to whom i just input the private key and it shows all the mathematical steps taken (as like above) to generate public key May 18 '21 at 10:59
• The modulus for secp255k1 is 2^256 - 2^32 - 977, not 2^256 (which isn't prime). May 18 '21 at 17:01