Author

Topic: Help with python elliptic curve generator (Read 131 times)

member
Activity: 180
Merit: 38
January 14, 2021, 01:09:44 PM
#3
I agree with you it's better to work on the bit level.
With the above you have G[1] so now you can compute G[2] to G[256] and use that as a starting point.
Then you add all 1's in the binary private key and this will take you step by step, or point by point to your final public point.
You really don't need any external libraries for that.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
January 07, 2021, 09:29:06 AM
#2
fastecdsa is a Python module that exposes methods for point addition and multiplication, and it also gives you a convenience method to derive the public key from the private key. I know you don't want that part but it's worth mentioning if you ever want to get t without all the hard work.

Then you can just run the expression Pub = Prv*G directly to get the public key from the private key, assuming you get the x and y coordinates of the G (generator) point of secp256k1.

Code:
from fastecdsa.curve import secp256k1
from fastecdsa.point import Point

# x and y are 256-bit hex numbers
Prv = Point(x, y, curve=secp256k1)

# update: fixed incorrect G points
gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
G = Point(gx, gy, curve=secp256k1)

Pub = Prv*G

https://pypi.org/project/fastecdsa/
member
Activity: 184
Merit: 13
January 07, 2021, 08:53:27 AM
#1
I'm still in training wheels but enjoying learning how to generate my own private key etc. Want help finding good python library to help with the point addition process from private key to generating public key. I dont want to generate all steps in one As I'm enjoying doing it step by step. Thanks
Jump to: