Derive account name from given WIF key using steem-python module?

in #steem-dev8 years ago (edited)

Hello developers,

I am working on a soft GUI wallet using python, and I was wondering if someone could explain to me how to derive an account name from a WIF key using the steem-python module (steem.readthedocs.io). Basically, I have a user entering their account username and their WIF active key, and I want to check if the WIF key belongs to the account whose username they have entered. What I hope to achieve is demonstrated in this screenshot from @jesta's GUI wallet, Vessel:

Here, I have entered @jesta's username and my one of own WIF keys, and Vessel detects that the WIF key does not belong to @jesta's account. Is it possible for me to accomplish the same thing with steem-python?

Sort:  

When the WIF is entered, I'm using the steem-js method to convert the private key to a public key, and then comparing that public key to what is on the account you entered.

I assume this same method could be done in steem-python.

http://steem.readthedocs.io/en/latest/low_level.html?highlight=wif#steembase.account.PrivateKey

That and the method below it would be a good starting point.

Bumping so @jesta will see!

Hah was getting there!

Haha, thank you @jesta! As per usual, you have come through with an extremely helpful answer!