Post
Topic
Board Development & Technical Discussion
Re: Private key to public key (TUTORIAL)
by
BASE16
on 14/09/2020, 14:19:04 UTC
Private key 3 is 3 * G

Add the Generator 3 times.

0x02F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9

Point 1 {x: 55066263022277343669578718895168534326250603453777594175500187360389116729240n,
            y: 32670510020758816978083085130507043184471273380659243275938904335757337482424n}

X:  0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
Y:  0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8

Point 2 {x: 89565891926547004231252920425935692360644145829622209833684329913297188986597n,
            y: 12158399299693830322967808612713398636155367887041628176798871954788371653930n}

X:  0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
Y:  0x1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a

Point 3 {x: 112711660439710606056748659173929673102114977341539408544630613555209775888121n,
            y: 25583027980570883691656905877401976406448868254816295069919888960541586679410n}

X:  0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
Y:  0x388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672
Corrected, thanks!
Now What do I do with:
X:  0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
Y:  0x388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672
?

What do you want to do with it ?
You can turn it into uncompressed public key:

publicKey = '04' + X + Y
publicKey = 04f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9388f7b0f632de 8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672

Or turn it into a even compressed public key:
publicKey = '02' + X
publicKey = 02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9

Or turn it into a odd compressed public key:
publicKey = '03' + X
publicKey = 03f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9

One of the last two is invalid.
You have to turn the X part of the public key into binary BASE2 form and look if it's odd or even:
0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9 ==
0b11111001001100001000101000000001100100100101100011000011000100000100100100110 1000100111110000101111110001001110101010010001010011011010100110001110010000100 0101100000110110111110011001101100001000011000000001111100010001001110111100111 000000011011011111001
Look at the last bit it's a 1 so the compressed public key is odd so it starts with '03'

You can also convert it to WIF:

5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreB1FQ8BZ uncompressed

KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU74sHUHy8S compressed

And you can calculate various addresses but that is far past private to pubkey  Smiley