Bitcoin Forum
April 30, 2024, 08:23:56 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with python elliptic curve generator  (Read 131 times)
release (OP)
Member
**
Offline Offline

Activity: 184
Merit: 14


View Profile
January 07, 2021, 12:53:27 PM
 #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
1714508636
Hero Member
*
Offline Offline

Posts: 1714508636

View Profile Personal Message (Offline)

Ignore
1714508636
Reply with quote  #2

1714508636
Report to moderator
Bitcoin mining is now a specialized and very risky industry, just like gold mining. Amateur miners are unlikely to make much money, and may even lose money. Bitcoin is much more than just mining, though!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714508636
Hero Member
*
Offline Offline

Posts: 1714508636

View Profile Personal Message (Offline)

Ignore
1714508636
Reply with quote  #2

1714508636
Report to moderator
1714508636
Hero Member
*
Offline Offline

Posts: 1714508636

View Profile Personal Message (Offline)

Ignore
1714508636
Reply with quote  #2

1714508636
Report to moderator
1714508636
Hero Member
*
Offline Offline

Posts: 1714508636

View Profile Personal Message (Offline)

Ignore
1714508636
Reply with quote  #2

1714508636
Report to moderator
NotATether
Legendary
*
Offline Offline

Activity: 1582
Merit: 6717


bitcoincleanup.com / bitmixlist.org


View Profile WWW
January 07, 2021, 01:29:06 PM
Last edit: January 16, 2021, 11:34:53 AM by NotATether
Merited by ABCbits (1)
 #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/

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
BASE16
Member
**
Offline Offline

Activity: 180
Merit: 38


View Profile
January 14, 2021, 05: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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!