What roles of WIF(Wallet Import Format)?

8

2

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,

zono

Posted 2015-01-25T13:19:37.643

Reputation: 1 569

Answers

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.

amaclin

Posted 2015-01-25T13:19:37.643

Reputation: 5 763

3Another important feature of the WIF is that it encodes whether the public key for the private key is to be used as an uncompressed/compressed public key.morsecoder 2015-01-25T17:11:16.200

Can someone clarify what a SIPA format key is? BCI Wallet (JavaScript) source code refers to this. Seems like it maybe an archaic WIF synonym.Wizard Of Ozzie 2015-01-30T07:54:56.953

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.

shmuli

Posted 2015-01-25T13:19:37.643

Reputation: 235