4

I have a private key for a storage bitcoin wallet (there's not much in there I'm just testing methods) but it is in private key form and to import it to my main wallet I need to convert it into WIF.

My 2 questions are, what does the process to convert it involve? (Ie. Am I expected to use the BIP38 password when converting or is that a sign it's a scam?) And secondly are there any safe offline software I can use or shall I try and use Linux commands?

EDIT: Thanks for the replies. In the end I found this website: https://iancoleman.io/bitcoin-key-compression/

I saved the webpage and used it offline in a VM with the internet disconnected completely. Before I reconnected the internet I restored the VM to a previously saved state. The key it generated offline worked perfectly when typed into my wallet.

Further question: does that method sound okay regarding the information being available to the net and the fact I inserted my password into the offline page?

1
  • 2
    What "private key format" is it in? WIF is generally the private key format.
    – Andrew Chow
    Aug 10, 2020 at 23:39

2 Answers 2

2

what does the process to convert it involve?

The process is described in the Bitcoin Wiki page on WIF:

  1. Take a private key
    0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D
  2. Add a 0x80 byte in front of it for mainnet addresses or 0xef for testnet addresses. Also add a 0x01 byte at the end if the private key will correspond to a compressed public key
  3. Perform SHA-256 hash on the extended key
  4. Perform SHA-256 hash on result of SHA-256 hash
  5. Take the first 4 bytes of the second SHA-256 hash, this is the checksum
  6. Add the 4 checksum bytes from point 5 at the end of the extended key from point 2
  7. Convert the result from a byte string into a base58 string using Base58Check encoding. This is the Wallet Import Format
    5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

So if your key starts with a 5 and has about 51 characters it is already in WIF format and you don't need to do anything.

Am I expected to use the BIP38 password when converting

No.

To extract the private-key from a password-protected wallet you need to enter the wallet password.

To convert an extracted private-key you don't need any password.

However with wallets like Bitcoin core, the private key will be already in WIF format when you use a Bitcoin core command like dumpprivkey in the debug console or in the command line interface (CLI) etc. so no conversion is necessary with Bitcoin core.

are there any safe offline software I can use

The only safe software is offline software ... compiled from carefully inspected open-source code, running on a computer running a secure operating system that has no network access (no wired, wireless, bluetooth etc), has never had any sort of network access and never will have any sort of network access.

In reality the distinction between safe and unsafe is false, there are only degrees of relative safety.

0

Firstly, you should never enter a Bitcoin Private Key on an online service (unless you're okay with never owning those Bitcoins again).

Secondly, almost all Private Keys are already in WIF format when you see them. Unless you literally generated a random large number, you probably were not given a raw PrivateKey.

Thirdly, If the data you have is really a PrivateKey, you should be able to import it to BitcoinCore with the importprivkey function. This will allow your bitcoin client to send and sign for the bitcoins you have. You do not need a BIP38 password or anything else. BIP38 Passphrases are used to generate the private key in the first place.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.