Bitcoin

Electrum – WIF bit private key retrieval

Assume you have a Wif private key from Electrum 4.0.9.

L2pt3eVopnxfBBvMwrJV2saZeAyQfF77UQSH5WGj5q9LBS6WWBmN (one of these generated from the seed is of course not used)

Using that public key:

14k8mYFC1LBWiBN8WSxpJN48jQYX1FZ6kz

I’m using code from the book “Bitcoin Programming” and the way I generate the private key is to convert the bits in the secret phrase to:

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

So I thought I should put the private key derived from L2pt3eVopnxfBBvMwrJV2saZeAyQfF77UQSH5WGj5q9LBS6WWBmN instead of “dat_test_private_key”.

You then take additional steps to obtain your private key here.

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

Then to get the public key:

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

But no matter what I tried I don’t have the same public key as Electrum so I guess I must be using something. Otherwise, use a different WIF format or derive the public key.

Related Articles

Back to top button