Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: italianMiner72 on October 31, 2015, 08:12:04 PM



Title: converting 52bit private keys to Base58 format
Post by: italianMiner72 on October 31, 2015, 08:12:04 PM
Hi.
i need to convert my bitcoin private key from 51bit standard to 52bit Base58 standard.
from mi qt-wallet i get 52bit private key format with command "dumpprivkey bitcoinaddress"
this 52bit PK start with L or K
and now.. how to convert it to 51 bit Base58 format, who start with 5?

for example this is a 51 bit PK:
Lerwgnsfdlkgh45h745lhgshvelakmr6l4j5l74j5lyelsdnfgeD
this is a base58 PK
5werkòljhyewnbasdARTGSvgsLFgjAERgjaSRGjeRk134t5yawg

this are fake PK.. of course!

many thanx!


Title: Re: converting 52bit private keys to Base58 format
Post by: achow101 on October 31, 2015, 08:15:43 PM
This page will help: https://en.bitcoin.it/wiki/Wallet_import_format. The L or K prefixes are because they refer to compressed public keys, so when you convert, you will not get the same bitcoin address.


Title: Re: converting 52bit private keys to Base58 format
Post by: shorena on October 31, 2015, 08:17:30 PM
Hi.
i need to convert my bitcoin private key from 51bit standard to 52bit Base58 standard.
from mi qt-wallet i get 52bit private key format with command "dumpprivkey bitcoinaddress"
this 52bit PK start with L or K
and now.. how to convert it to 51 bit Base58 format, who start with 5?

for example this is a 51 bit PK:
Lerwgnsfdlkgh45h745lhgshvelakmr6l4j5l74j5lyelsdnfgeD
this is a base58 PK
5werkòljhyewnbasdARTGSvgsLFgjAERgjaSRGjeRk134t5yawg

this are fake PK.. of course!

many thanx!

bit is not the same as symbols. The keys you export from bitcoin core with the above command are in WIF and as such in Base58[1]. A private key starting with L or K is indicating a compressed pubkey while an uncompressed pubkey has a privkey starting with a 5. If you convert from uncompressed to compressed (or the other way around) you will end up with a different address. Is that what you want?

[1] https://en.bitcoin.it/wiki/Base58Check_encoding



Title: Re: converting 52bit private keys to Base58 format
Post by: italianMiner72 on October 31, 2015, 08:41:16 PM
Hi.
i need to convert my bitcoin private key from 51bit standard to 52bit Base58 standard.
from mi qt-wallet i get 52bit private key format with command "dumpprivkey bitcoinaddress"
this 52bit PK start with L or K
and now.. how to convert it to 51 bit Base58 format, who start with 5?

for example this is a 51 bit PK:
Lerwgnsfdlkgh45h745lhgshvelakmr6l4j5l74j5lyelsdnfgeD
this is a base58 PK
5werkòljhyewnbasdARTGSvgsLFgjAERgjaSRGjeRk134t5yawg

this are fake PK.. of course!

many thanx!

bit is not the same as symbols. The keys you export from bitcoin core with the above command are in WIF and as such in Base58[1]. A private key starting with L or K is indicating a compressed pubkey while an uncompressed pubkey has a privkey starting with a 5. If you convert from uncompressed to compressed (or the other way around) you will end up with a different address. Is that what you want?

[1] https://en.bitcoin.it/wiki/Base58Check_encoding



ok!
if i understand well, i can not convert compressed 52bit format to 51bit directly...
but if so...
i have my bitcoin address...
i imagine 2 command
1) extract_compressed_52bit bitcoin_address
2) extract_uncompressed_51bit bitcoin_address

command 1) is:
dumpprivkey bitcoi_address

but what about command 2)????

confused....  ??? ??? ??? ??? ???


Title: Re: converting 52bit private keys to Base58 format
Post by: dserrano5 on October 31, 2015, 08:46:47 PM
if i understand well, i can not convert compressed 52bit format to 51bit directly...
but if so...
i have my bitcoin address...
i imagine 2 command
1) extract_compressed_52bit bitcoin_address
2) extract_uncompressed_51bit bitcoin_address

command 1) is:
dumpprivkey bitcoi_address

but what about command 2)????

confused....  ??? ??? ??? ??? ???

There's usually no reason to want to do that. I suspect you want to achieve something and think this is the means, however I think you're probably mistaken. Why do you want to do this?


Title: Re: converting 52bit private keys to Base58 format
Post by: italianMiner72 on October 31, 2015, 08:54:45 PM
i try to explain better...
i purchased some museCoin on IPO.
now MuseCoin wallet was released... and i need 51bit private key to redeem my muse.
i tryed with 52bit private key but doesn't work..
i need to try with 51bit.
It seems who with 51bit all work fine!
that's all!!!


Title: Re: converting 52bit private keys to Base58 format
Post by: achow101 on October 31, 2015, 09:01:34 PM
ok!
if i understand well, i can not convert compressed 52bit format to 51bit directly...
but if so...
i have my bitcoin address...
i imagine 2 command
1) extract_compressed_52bit bitcoin_address
2) extract_uncompressed_51bit bitcoin_address

command 1) is:
dumpprivkey bitcoi_address

but what about command 2)????

confused....  ??? ??? ??? ??? ???
There is no such command which distinguishes between compressed and uncompressed private keys. dumpprivkey will dump whatever type of private key is in the bitcoin core wallet, which, in new versions, happens to be the compressed type. To convert the type, you will need to get the private key in hex from the WIF format, and then reencode that back to WIF but with the compressed prefix. The instructions are in the link I posted above.


Title: Re: converting 52bit private keys to Base58 format
Post by: medUSA on October 31, 2015, 10:32:23 PM
A couple of months ago, I wanted to find ways to convert a uncompressed private key to compressed private for my address (here (https://bitcointalk.org/index.php?topic=1143112.0)). I came across this utility "Bitcoin Address Utility" by Casascius. I am not sure it can convert the keys by the click of a button. It could be of help if you want to convert it semi-manually.

https://en.bitcoin.it/wiki/Bitcoin_Address_Utility


Title: Re: converting 52bit private keys to Base58 format
Post by: italianMiner72 on November 01, 2015, 04:46:53 PM
A couple of months ago, I wanted to find ways to convert a uncompressed private key to compressed private for my address (here (https://bitcointalk.org/index.php?topic=1143112.0)). I came across this utility "Bitcoin Address Utility" by Casascius. I am not sure it can convert the keys by the click of a button. It could be of help if you want to convert it semi-manually.

https://en.bitcoin.it/wiki/Bitcoin_Address_Utility

great utility medusa!!!
i find this who do similar things
https://github.com/pointbiz/bitaddress.org
here the site
https://www.bitaddress.org/

thankyou for the help!


Title: Re: converting 52bit private keys to Base58 format
Post by: johoe on November 02, 2015, 09:47:44 AM
I'm not sure why anyone want to convert compressed into uncompressed keys, but there are several tools as others pointed out.  Even brainwallet.org had the possibility before it was shut down.

https://rawgit.com/brainwallet/brainwallet.github.io/f7679dd03f39a04edced641960a7c3df1116fea9/

Note that the public key is (slightly) different, so if your other wallet only support uncompressed keys, you can't spend money send to the compressed address.


Title: Re: converting 52bit private keys to Base58 format
Post by: fbueller on November 05, 2015, 03:41:25 PM
Note: they're not '52bit'. They're all 256-bit.

Maybe you're talking about the length of the WIF - 52 characters - but since base58 encodes more data per character, that's why it's not a 32 byte (== 256bit) binary string.

As you know, the same private key can be encoded differently to indicate that it's public key should be compressed when generating the address.

You just base58_decode(), and add or remove the \x01 byte after the private key, and re-encode to get the WIF for other address.



Title: Re: converting 52bit private keys to Base58 format
Post by: elmeijera on December 13, 2017, 11:35:06 AM
Note: they're not '52bit'. They're all 256-bit.

Maybe you're talking about the length of the WIF - 52 characters - but since base58 encodes more data per character, that's why it's not a 32 byte (== 256bit) binary string.

As you know, the same private key can be encoded differently to indicate that it's public key should be compressed when generating the address.

You just base58_decode(), and add or remove the \x01 byte after the private key, and re-encode to get the WIF for other address.