According to this answer: https://bitcoin.stackexchange.com/a/63996/100526 When he wants to generate a public key from the private key, he has used K=k*G. but I can't understand it's result. If we assume our private key is (according to the answer) :


and according to Secp256k1 G point is:

- Compressed form (prefix 02)
02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798 

 - Uncompressed form (prefix 04)
04 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8 

So to calculate the public key I used this site: https://www.boxentriq.com/code-breaking/big-number-calculator

I used compressed form and private key: 0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798 * 0F479245FB19A38A1954C5C7C0EBAB2F9BDFD96A17563EF28A6A4B1A2A764EF4

and result is :


but in that answer the result is :


what's wrong?


2 Answers 2


When talking about math using a curve, when we use terms like addition and multiplication, we don't mean normal additional and multiplication. We are referring to operations on the curve that have properties similar to addition and multiplication. To get the correct results, you have to use the actual operations on the curve, not normal addition and multiplication.

  • Ok thank you,I got it. but in how we calculate it in the computers view? I know about it if we have a point like A and another point like B, with add these two we will have C, and if we reverse c in X line we will have another point. Or about multiplication in the Math view. I want to know how can I write a function that get Private key as input and give us public key as output? All we have in computers like 2*2=4 and I can't find relation between these. Apr 3, 2020 at 9:57
  • 1
    @HamidNaghipour You need a tool that specifically does secp256k1 point addition at least. Then you can do multiplication by repeated addition. For example, you can compute 9*k by adding k to itself (giving 2*k), then adding that result to itself (giving 4*k), then adding that result to itself (giving 8*k), then adding k to that result (giving 9*k). Apr 3, 2020 at 17:51
  • after many researches on this topic, I got it. Now I'm looking a way how to create a function that does point addition. Could you please edit your answer? I want to accept it with these extra information. Thanks a lot. Apr 4, 2020 at 7:13
  • Thank you for your help. I added the answer that I needed it. Apr 7, 2020 at 8:03
  • could you please answer my question: bitcoin.stackexchange.com/questions/95676/… May 3, 2020 at 9:42
It was my fault.

G is a point on the Elliptic curve. It means G has a number for X and another one for Y. so uncompressed G in Secp256k1 is G(x,y):

- Uncompressed form (prefix 04)
04 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8 

X = 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798

Y = 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8 

And 04 to show this is an uncompressed form of G.

This point is Base point or Generator point that it used in k=K*G.

* is not like * in math like 2*2 = 4. It is a sign to show one of operators on curve.

we have 3 operators on a curve :


Addition is for add two points. According to we have a point like P1(x1,x2), and another point like Q1(x2,y2), so we can't use 2+2 = 4, we need some other calculation for P+Q. The result of P+Q is another point on the curve that we can call it R.

Doubling is double a point on the curve, and the result of this is a point on the curve too. so P+P=R.

When we say k*G, we want to multiple our private key to a point on the curve.

We need to do these : Convert our private key to binary base.

With a for on all bits we start to check: For each of this bits we do some doublePoint and addPoints. This is a predefined role and we have to follow it.

But how we can calculate a addition of two points?

λ = ( yq – yp ) / ( xq – xp)
xR = λ2 – xp – xq
yR = λ(xp – xR) – yP

With this. first we need to calculate λ, it is our slope.

Then we can calculate our x and y for new point. and the result is our

p+q = R

and what about doubling?:

λ = (3x2) +a / (2y) 
xR = λ2 - 2x 
yR = λ(x - xR) – y

with these, now we can calculate K=k * G.

There are many other tips to calculate Public key from Private key.

This one is a good implementation in PHP: https://github.com/BitcoinPHP/BitcoinECDSA.php/blob/master/src/BitcoinPHP/BitcoinECDSA/BitcoinECDSA.php#L350

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.