I just remembered how to do math with hex in python…convert it to an integer like this:
x = ‘HiUikekeJilleivlUyelkbWNoeLpBxcweQqlzAer08cl2vlkjfl38ivlbh3l4lbklboijldfjcobn=’
y = x.decode(“hex”)
z = int(y, 16)
this converts the variable to a integer from base16hex
now “z” is an integer so you can do math with it…
so take the message and convert it the same way and then subtract the unsigned message from the signed one
then convert the new integer back to hex like this:
hex(‘new integer’)
or
import binascii
binascii.hexlify(‘newinteger’)
this should be the hex version of your private key…
from there you can convert it to WIF using pycoin or any other software that will calculate wallet import format
The vk and sk coding works well. One question, about the sk output. When type sk, it shows an object at 0x7f9324da3t98. This is a very short string. Is that what is called a nonce.
yes this is your key that you just generated using the elliptic curve to be used with the private key to sign the message with and is verified with the public key
No, I’m not replacing “hex” with anything. I’m typing:
x = 'HiUikekeJilleivlUyelkbWNoeLpBxcweQqlzAer08cl2vlkjfl38ivlbh3l4lbklboijldfjcobn=’
y = x.decode(“hex”)
X = 'HiUikekeJilleivlUyelkbWNoeLpBxcweQqlzAer08cl2vlkjfl38ivlbh3l4lbklboijldfjcobn=’
y = base64.b64decode(x)
z = int(y, 16)
get error with the ‘z’ as follows:
Traceback (most recent call last):
File “”, line 1, in
ValueError: invalid literal for int() with base 16: b’ PN\x0b\data data’
replace “message” with your message to be signed in the sig = sk.sign(b"message") function
in this case you would place the transaction hex data there to be signed.
the verifying key is the public key
like I said…in this case…
you need the private key instead of a newly generated signing key
fr this you will need to extract the private key from the signature by converting it to an integer and subtracting the unsigned message from the signed message…
then the function would be like this:
import ecdsa
pkey= private key
sk = ecdsa.SigningKey(pkey)
vk =pkey.get_verifying_key()
sig = pkey.sign(b"message")
vk.verify(sig, b"message")
if you watch that video…
the way they came up with “K” is the same way I am suggesting to extract your private key
the guy just subtracts the unsigned message from the signed/hashed one and this gives the private key…
this can be done with any bitcoin/litecoin private key that used a static “K” to sign transactions
which is one reason it is NOT recommended to reuse addresses
good luck with it…I have to wake up early so I am out for the evening
I was thinking about it and actually the way they came up with “K” in the video is the same way you would come up with a unsigned message
so you actually already have your “k” value
you just need to get the private key from it by subtracting you “k”(message) from the signed message