bitshares1-core icon indicating copy to clipboard operation
bitshares1-core copied to clipboard

valid WIF private key does not validate

Open nmushegian opened this issue 10 years ago • 7 comments

https://bitsharestalk.org/index.php?topic=13340.0;topicseen

nmushegian avatar Jan 15 '15 18:01 nmushegian

I think this is the problem:

>>> PrivateKey.fromWif("5H2m3sfuRM51FwxeMURLto7sqZ58mgQYi7jrRxGAFKrK")
AssertionError: Expected version 128, instead got 63

The version is the 1st unsigned byte in the decoded private key.

jcalfee avatar Jan 15 '15 20:01 jcalfee

Actually, there is more to this.. the checksum does not match how we are calculating it. If we support this, the private key import could be enhanced to check the version and then verify the checksum a little differently.

Here is my comment: # BTS checksum includes the version

jcalfee avatar Jan 15 '15 20:01 jcalfee

So not all WIF keys are created equal? Is there any info about what all the different variations are?

nmushegian avatar Jan 16 '15 19:01 nmushegian

https://en.bitcoin.it/wiki/List_of_address_prefixes

Bitcoin-js is ignoring the version byte: https://github.com/bitcoinjs/bitcoinjs-lib/blob/e42c497a3c9afe67c86ba0a602b5a0e9bd66e604/src/eckey.js#L32-L33

jcalfee avatar Jan 16 '15 21:01 jcalfee

Wait what does the network byte have to do with this? I thought private keys had no network byte and they are only added when creating the address?

nmushegian avatar Jan 16 '15 22:01 nmushegian

From my understanding it is safe to use the same private key over and over .. i.e. in BTS, MUSIC, PLAY .. but also in Bitcoin .. or am I missing something here?

xeroc avatar Mar 19 '15 13:03 xeroc

It is about as secure as using the same password on every website where you're registered. IOW: don't do that.

pmconrad avatar Mar 19 '15 14:03 pmconrad