Bitcoin Forum
May 08, 2024, 07:00:30 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is there any way to convert from 1 private key format to another?  (Read 1025 times)
Muhammed Zakir (OP)
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
September 24, 2014, 10:31:29 AM
 #1

Hello! Is there any way to convert from 1 private key format to another? Different wallets support different formats and some supports all format. The wallet I am using only supports compressed private key format but I have Base58 Wallet Import format. So is there any way? Thanks!

  ~~MZ~~

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715194830
Hero Member
*
Offline Offline

Posts: 1715194830

View Profile Personal Message (Offline)

Ignore
1715194830
Reply with quote  #2

1715194830
Report to moderator
1715194830
Hero Member
*
Offline Offline

Posts: 1715194830

View Profile Personal Message (Offline)

Ignore
1715194830
Reply with quote  #2

1715194830
Report to moderator
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
September 24, 2014, 01:09:36 PM
 #2

Hello! Is there any way to convert from 1 private key format to another?

Yes.  A private key is just a number.  Different "formats" are just different ways of representing the same number.

Different wallets support different formats and some supports all format. The wallet I am using only supports compressed private key format but I have Base58 Wallet Import format. So is there any way? Thanks!

  ~~MZ~~

Compressed key is a form of Base58 Wallet Import Format.  You shouldn't need to do any conversions.
Muhammed Zakir (OP)
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
September 24, 2014, 01:12:27 PM
 #3

Hello! Is there any way to convert from 1 private key format to another?

Yes.  A private key is just a number.  Different "formats" are just different ways of representing the same number.

Different wallets support different formats and some supports all format. The wallet I am using only supports compressed private key format but I have Base58 Wallet Import format. So is there any way? Thanks!

  ~~MZ~~

Compressed key is a form of Base58 Wallet Import Format.  You shouldn't need to do any conversions.


Sorry for not posting correctly. I thought Bas58 Wallet Import Format is Uncompressed key as I saw just uncompressed private key in Bitcoin wiki. So is there any way to convert compressed to uncompressed format? Huh And thanks for clarifying it! Smiley

  ~~MZ~~

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
September 24, 2014, 01:28:49 PM
 #4

Hello! Is there any way to convert from 1 private key format to another?

Yes.  A private key is just a number.  Different "formats" are just different ways of representing the same number.

Different wallets support different formats and some supports all format. The wallet I am using only supports compressed private key format but I have Base58 Wallet Import format. So is there any way? Thanks!

  ~~MZ~~

Compressed key is a form of Base58 Wallet Import Format.  You shouldn't need to do any conversions.


Sorry for not posting correctly. I thought Bas58 Wallet Import Format is Uncompressed key as I saw just uncompressed private key in Bitcoin wiki. So is there any way to convert compressed to uncompressed format? Huh And thanks for clarifying it! Smiley

  ~~MZ~~

Compressed and Uncompressed are words that describe how the public key is represented after it is calculated from the private key.

If you convert from a "Compressed Key" private key to an "Uncompressed Key" private key, you are telling the wallet that it should use the private key to calculate an uncompressed public key instead of a compressed public key. Since a bitcoin address is a hash of the public key, this means that changing from a "Compressed Key" private key to an "Uncompressed Key" private key will result in a completely different bitcoin address.

Importing an "Uncompressed Key" private key will not allow you access to any of the bitcoins that were sent to the address that was associated with the "Compressed Key" address.

If you aren't trying to access a particular bitcoin address, then I'm not sure why you'd be importing a private key at all?

If you are certain that you want to import the private key for the "Uncompressed Key" address, then here's what you need to do:

  • Convert from base 58 to bytes (base 16) using the Base58Check symbol chart
  • Truncate the trailing 5 bytes from the result of the previous step (this is the Extended Key)
  • Perform SHA-256 hash on the Extended Key
  • Perform SHA-256 hash on the result of the previous step (this is the Extended Checksum)
  • Concatenate the Extended Key and the first 4 bytes of the Extended Checksum
  • Convert the result of the previous step from a byte string into a base58 string using the Base58Check symbol chart
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!