Author

Topic: [DEVELOPMENT] Extracting WIF and Address prefix codes from altcoins' sources (Read 1598 times)

member
Activity: 128
Merit: 10
I was able to figure out the compressedWIFPrefix is basically the Letter that the wallet generated private key starts with, in the case of Bitcoin it starts with either L or K which is why you see [LK] and Litcoin is T

The way that I determine the compressedWIFPrefix was by opening a wallet and typing in the console: dumpprivkey "The wallets address" Press enter and it will give you the compressed private key (52 digits), then you can see what letter the key starts with, Litecoin starts with T T77jSKLkPvX4SBgRN8v11jTdnHwb8ckrn7WLjXcNjLikug2dAhaP

To Determine the WIFPrefix I had to run the rest of the code with
window.networkVersion = 0x30;
      window.privateKeyPrefix = 0xb0;
      window.WIFPrefix = 'Put any Number in here to start';
      window.compressedWIFPrefix = 'T';

And the output automatically shows the Private Key Prefix as the first number of the 51 digit string using
https://github.com/cantonbecker/bitcoinpaperwallet


The Private Key WIF (Wallet Import Format) is a code that needs to be keep secret since it can be used to spend any funds that have been sent to the corresponding public key. Keys can be encoded in a number of different formats. The most popular encoding formats (WIF, WIFC, HEX, B64) are shown below.


Public Litecoin Address
LdZ2AU1oWfmqGopivVGG5fmmR4KyM42kva
Litecoin Address Compressed Format
LMvQWzsUppbdxq39JeMv3KqXantVSH2idr


Public Key (130 characters [0-9A-F]): 04C5CE09ABF9C5E1A0ACE700F7729FA996AB5115B05857D8EF550DB34F96A7E184C1BB8E00A07A0 6F3BF64FB3641A13A1618A8822B9791BEDC33AD40116BF68244
Public Key (compressed, 66 characters [0-9A-F]): 02C5CE09ABF9C5E1A0ACE700F7729FA996AB5115B05857D8EF550DB34F96A7E184

Private Key WIF
51 characters base58, starts with a '6'
6v3S2CrndTdGH8QS1Fw9cWZKJWfee52KytmiB687HPbPBdobUX9
Private Key WIF Compressed
52 characters base58, starts with a 'T'
T77jSKLkPvX4SBgRN8v11jTdnHwb8ckrn7WLjXcNjLikug2dAhaP



Private Key Hexadecimal Format (64 characters [0-9A-F]): 79480E439276C481E13799439A9A0BEC103E2701B17851A236650658F685C272
Private Key Base64 (44 characters): eUgOQ5J2xIHhN5lDmpoL7BA+JwGxeFGiNmUGWPaFwnI=

So, it works perfect now!
member
Activity: 128
Merit: 10

Did you ever have any luck figuring out the WIFPrefix or the compressed.WIFPrefix?

Im forking this https://github.com/cantonbecker/bitcoinpaperwallet  and going to make paper wallets for my favorite Alts,


case 'Bitcoin': 
     window.networkVersion = 0x00;
     window.privateKeyPrefix = 0x80;
    window.WIFPrefix = '5';
     window.compressedWIFPrefix = '[LK]';
     break;
   case 'Litecoin':
      window.networkVersion = 0x30;
      window.privateKeyPrefix = 0xb0;
      window.WIFPrefix = '6';
      window.compressedWIFPrefix = 'T';
      break;

I am trying to set up an alt coin paper wallet generator and I havent been able to figure out how exactly to determine or find the value that needs to be place for the WIFPrefix and the compressedWIFPrefix?

I know how to determine window.networkVersion = 0x00; window.privateKeyPrefix = 0x80; from here
https://forum.digitalcoin.co/archive/index.php/t-1447.html
https://bitcointalksearch.org/topic/m.4134858

Now all I need to make sure its 100% functional is the WIFPrefix!

Any help here would be appreciated?

Thanks,
legendary
Activity: 872
Merit: 1010
Coins, Games & Miners
I'm currently rolling my own wallet generator with the use of PYCoin https://github.com/richardkiss/pycoin and i'm having a hard time finding the WIF and Address prefix codes on the altcoins' sources.

BONUS QUESTION: The bip32 codes for each altcoin, where to find'em?

Does anyone know where to find it?

Simple non-dev explanation: Address prefix is for the special first character you see on most coins. WIF prefix is for importing the Wallet into the coins' client.

Some code:
Code:
###### excerpt from networks.py

NetworkValues = namedtuple('NetworkValues',
                           ('network_name', 'subnet_name', 'code', 'wif_prefix', 'address_prefix',
                            'pay_to_script_prefix', 'bip32_priv_prefix', 'bip32_pub_prefix'))

NetworkValues("Bitcoin", "mainnet", "BTC", b'\x80', b'\0', b'\5', h2b("0488ADE4"), h2b("0488B21E")),
NetworkValues("Dogecoin", "mainnet", "DOGE", b'\x9e', b'\x1e', b'\x16', h2b("02fda4e8"), h2b("02fda923")),

As you can see, BTC's wif prefix and address prefix are 0x80 and 0x05 each. DOGE's 0x93 and 0x1e.

I'm at a loss here.... halp plz
Jump to: