Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

privtopub only works with wif #115

Open
ghost opened this issue Sep 5, 2015 · 2 comments
Open

privtopub only works with wif #115

ghost opened this issue Sep 5, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 5, 2015

This gives a good address:

priv=sha256("blah")
wif = encode_privkey(priv, 'wif_compressed')
pub = privtopub(wif)
addr = pubtoaddr(pub)

Whereas this (as in example in readme)
priv=sha256("blah")
pub = privtopub(priv)
addr = pubtoaddr(pub)

Gives an incorrect address.
(running python2)

@wizardofozzie
Copy link
Contributor

Whereas this (as in example in readme)
priv=sha256("blah") # add "01" flag
pub = privtopub(priv) # or compress(privtopub(priv) )

Hex SEC keys require the appended "compressed" byte.
The first example does this automatically when you call wif_compressed in encode_privkey

@ghost
Copy link
Author

ghost commented Sep 5, 2015

Ah, I assumed, due to the example, that it was handled/ a problem with old-timey python. Just looked through main.py.

I think your code deserves more comprehensive documentations. Some really cool stuff in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant