8

I am reading "Mastering Bitcoin" written by Andreas and I found this explanation about "WIF(Wallet Import Format)"

Key Formats

Both private and public keys can be represented in a number of different formats. These representations all encode the same number, even though they look different. These formats are primarily used to make it easy for people to read and transcribe keys without introducing errors.

http://chimera.labs.oreilly.com/books/1234000001802/ch04.html#base58

I have two questions:

  1. I agree with that a private key as decimal numbers is not easy to use for people. However, the hex format and WIF are very similar. I think that WIF has two advantages compared to hex. One is starting with 5 and the next one is having checksum. Are there any good points of WIF.

  2. Can I sign on a transaction by using WIF without the private key?

I'm keen to know about inside bitcoin. Any information will be helpful for me.

Thanks,

8

Are there any good points of WIF

It is shorter than decimal/hex representation. And, yes, there is checksum.

Can I sign on a transaction by using WIF without the private key?

WIF is a representation of private key.

6

Besides for the checksum, the WIF key is encoded in base58, where similar looking letters, such as uppercase "O" and "I", lowercase "l", and the number "0" are omitted.

WIF does not hide the private key, it merely represents it in an alternative format. A WIF key can be converted back to a private key by walking-back through the formula used to create it: base58 decode the WIF key, drop the mainnet header bytes and checksum trailing bytes off the resulting encoded string, and there you have your private key.

The original Bitcoin client source code explains the reasoning behind base58 encoding:

base58.h:

// Why base-58 instead of standard base-64 encoding?
// - Don't want 0OIl characters that look the same in some fonts and
//      could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won't line-break if there's no punctuation to break at.
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.