Bitcoin Forum
June 19, 2025, 07:35:51 PM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why private keys are base58 encoded?  (Read 2919 times)
Shevek (OP)
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250



View Profile
July 14, 2011, 11:00:18 PM
 #1

Playing around generation of vanity addresses, I've discovered that private keys are stored as base58 numbers, with the character "5" at the beginning.

But... why?

The reason why public keys are distributed in base58, I can understand: base58 is a kind of base64 without some conflicting characters that could be confused and taken as phising target.

But, private keys never should be cast out. So, base64 seems to be perfect for the goal, because it is the easiest way to "textify" binaries, the most compact and most universal.

For example, the private key:

Code:
5JEiDZ747ZRjB22ie48Gq1ADUZuU2Fjw2xJE5D4LCXcK8E81zAh

In base64 (excluding the starting "5"):

Code:
I3fcciKvYeoG/mTtUnTbX1XAW4WGqrWz1Z2g7/IC1Mz/B4++G

Any clues for this strange election?

Proposals for improving bitcoin are like asses: everybody has one
1SheveKuPHpzpLqSvPSavik9wnC51voBa
bitlotto
Hero Member
*****
Offline Offline

Activity: 672
Merit: 500


BitLotto - best odds + best payouts + cheat-proof


View Profile WWW
July 14, 2011, 11:11:52 PM
 #2

Probably mostly so it is coded like the address. It looks cool.
The first byte of key is 0x80 so begins with 5.

*Next Draw Feb 1*  BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR
TOR2WEB
Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
pc
Sr. Member
****
Offline Offline

Activity: 253
Merit: 250


View Profile
July 15, 2011, 01:35:27 PM
 #3

Even if a private key should never be sent out publicly, it's conceivable that one might want to have a physical copy somewhere printed or written out, like in a safe or something. In that case, it may be useful to have the same base58 encoding to make sure people don't confuse 1 and l and the like.

So, I suspect that encoding it like addresses was just as easy as any other encoding, and lets one do the same writing-down that addresses have.
laanwj
Hero Member
*****
qt
Offline Offline

Activity: 826
Merit: 1030


View Profile
July 15, 2011, 01:47:54 PM
 #4

The idea is that base58 is easier for humans to type in, for example from a scratch card...
Shevek (OP)
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250



View Profile
July 15, 2011, 02:20:26 PM
 #5

Thanks you (everybody) for your 2 cents!

Proposals for improving bitcoin are like asses: everybody has one
1SheveKuPHpzpLqSvPSavik9wnC51voBa
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1198


View Profile WWW
July 15, 2011, 02:34:59 PM
 #6

I chose something similar to addresses because the code was available, it had a checksum against typo's, and 51 characters seemed reasonable enough to bother with implementing something else (base64 being 48 characters with the same level of checksums).

I do Bitcoin stuff.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!