Author

Topic: Correct / incorrect WIF (Read 211 times)

member
Activity: 170
Merit: 58
June 30, 2020, 03:57:41 AM
#4
Surprisingly, '99' flag resulted in 'K' or 'L' in every random private key that I've tried  Undecided
But it wont work with well-written clients.

Apparently there is no check for this in bitcoinj library, it accepts WIFs not only with 99 (as long as checksum is OK):
L4V2zpTnbnoTqzfXiyBXsZiaJkPj926jYtxNK65wmGePWWHtzM3W (bf)

legendary
Activity: 1039
Merit: 2783
Bitcoin and C♯ Enthusiast
June 29, 2020, 08:53:01 AM
#3
Surprisingly, '99' flag resulted in 'K' or 'L' in every random private key that I've tried 

There are a bunch of different variations that could give similar looking key strings. Here are 3 examples from Bitcoin.Net test vectors:
Code:
5GPHYxaeAAqL2egjmyU8Kaaqh831aw12XJ92y2rgRWi1zc
L5HydKmZoMcqfoY9Rgi8BRnWGmDw9YhoUS9ArnToVxvyFbM9GyfJ
KwFAa6AumokBD2dVqQLPou42jHiVsvThY1n25HJ8Ji8REf1wxAQb
Same with BIP-32 extended keys.
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
June 29, 2020, 05:37:09 AM
#2
The private key KztWMvdFrpEScTmRBVwfmtzqYzb1rcu5PKGGKf6FUij16N2NYS88 has the correct checksum but the "Compressed flag" is '0x99' instead of '0x01'.
In HEX: 806d786c3b9976d286362f4969d3fdf7ccd6abe2314e7435bd7c270837ab19a28e99029474a9
Green = Private key | Purple = Checksum | The Byte after the private key should be the 'compressed public key' flag.

The correct WIF should be: KztWMvdFrpEScTmRBVwfmtzqYzb1rcu5PKGGKf6FUij164yixbkN if you set "01" as the flag instead of "99".

Surprisingly, '99' flag resulted in 'K' or 'L' in every random private key that I've tried  Undecided
But it wont work with well-written clients.
member
Activity: 170
Merit: 58
June 29, 2020, 03:54:50 AM
#1
Hello

We know that WIF has checksum. I use bitcoin-core library for reading WIF and then retrieving address etc. Usually, when I provide wrong (synthetically incorrect) WIF, parser complains. But recently I have found a few WIFs which are accepted, pubKey is retrieved etc, even if checksum is wrong. What I am missing?

KztWMvdFrpEScTmRBVwfmtzqYzb1rcu5PKGGKf6FUij16N2NYS88
retrieved:
priv: 6d786c3b9976d286362f4969d3fdf7ccd6abe2314e7435bd7c270837ab19a28e
pub: (d4b8c48cd5633ea6bdd2f282f70901b1d9b120631c155263737fdb1f4ef06ace,ffca79e0ca3d894d1f6e26690c0feac80dc9039b084de3b646e15b39d3c02be5,c737176f36ac61ce342338898eba8f65539ee6727b74445b31f9597407c0caf6)
address:
18NYbvmXvQ2nducAyGJ8wrsUnyJ5rZc5RD

but checking for example on: https://learnmeabitcoin.com/guide/wif
checksum is incorrect, it should be:
KztWMvdFrpEScTmRBVwfmtzqYzb1rcu5PKGGKf6FUij164yixbkN


Jump to: