0

Suppose I have a Wif private key from Electrum 4.0.9:

L2pt3eVopnxfBBvMwrJV2saZeAyQfF77UQSH5WGj5q9LBS6WWBmN ( this one or the other generated from the seed is non used of course )

with a corresponding public key:

14k8mYFC1LBWiBN8WSxpJN48jQYX1FZ6kz

I am using the code from the book "programming bitcoin" and the way we create private key is by converting the bits of a secret phrase like this:

secret = little_endian_to_int(hash256(b'dat_test_private_key'))

So I was thinking I just had to put the private key derived from L2pt3eVopnxfBBvMwrJV2saZeAyQfF77UQSH5WGj5q9LBS6WWBmN instead of "dat_test_private_key"

then we do more step to get our private key here:

https://github.com/jimmysong/programmingbitcoin/blob/master/code-ch13/ecc.py

Then to get our public key:

public_key = print(private_key.point.address(testnet=False))

But no mater what I tried I dont have the same public key as electrum, so I guess I must be off something or they use a different WIF format or the way they derive public key

3
  • What do you mean by "original bits"? Commented Mar 31, 2021 at 23:56
  • I have updated my post, but I guess I am gonna go for the bitcoin libraries and dont go too deep for my project, I have even had a reply from Jimmy song for my problem, but it hadnt fixed it
    – Saxtheowl
    Commented Apr 1, 2021 at 0:40
  • There are tons of ways for converting passwords/phrases/seeds into keys. Presumably Electrum is using a very different one. That doesn't mean any is right or wrong. Commented Apr 1, 2021 at 1:00

1 Answer 1

0

So I was thinking I just had to put the private key derived from L2pt3eVopnxfBBvMwrJV2saZeAyQfF77UQSH5WGj5q9LBS6WWBmN instead of "dat_test_private_key" Blockquote

Are you trying to hash the private key and use it as the secret?
You could try something like this instead:

secret = int(derived_private_key_hex, 16)

Your Answer

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

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