electrum – How can I convert my private key from bitaddress.org to WIF without putting the key into a website or a programme?

bitaddress.org already provides your private key in Wallet Import Format, which is encoded in base58check format.

In the example screenshot below, the base58check-encoded WIF private key is KzNKqwBPaVehsA2F94n9UJ5mrkM9NazBjqBBwsb2U9pAGLdc4md3

To address your “rule 1”, the most secure way to handle this data is load Electrum onto an airgapped machine, enter the private key into that secure computer, and then use it to sign a transaction you build with an “online” machine that has access to the UTXO set and your wallet address.

bitaddress.org example

Warning: Do not use the key or address in this example for any reason at all besides looking at it and learning! Pasting private keys on websites is always a terrible idea.

address – How is it possible that the same WIF Private Key generates two different addresses?

I am wondering if you can explain this.

I went here:

Created the SegWit Address below:




Public key


Private key (WIF key)


Then I opened Electrum v3.1.3 and Imported WIF Pkey above.

And I got this address instead:


So now there are two addresses, one SegWit (or I think P2SH) starting with 3… and the legacy address from Electrum starting with 1…

Appreciate an explanation of this.

Thank you.

encryption – Private key to WIF process

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?

Why is the WIF format of the bitcoin private key always started in K or L?

According to https://en.bitcoin.it/wiki/Wallet_import_format,
the bitcoin private wif format key is created by the step below.
And he says that the compressed wif key always starts with "K" or "L",
that means 80 + private key + 01 / mod 58 & # 39; the last result is always 18 or 19.
I know the large mod number 58 will give 0-57,
why the last rest of the wif 58 key mod is always 18 or 19
Could someone give me mathematical proof?

 #1 take a private key

 #2 add version
 version='80' #mainnet

 #3 perform double hash-256 of priv in step#2

 #4 get first 4 bytes for checksum

 #5 add checksum to priv in step#2

 #6 final bash58encode
 wif= b58encode(wifhash.decode('hex'))

 # compressed --> K or L
 print wif

 #compressed: L4TB9Z3dXeKW4tyF7EVqbczrEA5hjSdjG1QvBd1CeYTQHm2YincA

wallet – Convert Base64 private key to WIF

How can I get my private key from this? I found an old file on one of my hard drives with a wallet address and something that looks like this (changed for obvious reasons).

What is it and how do I get my private key?


I have tried this https://bitcoin.stackexchange.com/a/43438/105403. When I plug the WIF into bitaddress.org, it doesn't match my actual bitcoin address, so I have to do something wrong.

address – I need a few lines of python to create WIF addresses

I have code that generates WIF keys from hexadecimal keys. A few additional lines are enough to generate WIF addresses.

import binascii, hashlib, base58, sys

default conversion (z):

private_key_static = z

extended_key = "80"+private_key_static+"01"

first_sha256 = hashlib.sha256(binascii.unhexlify(extended_key)).hexdigest()

second_sha256 = hashlib.sha256(binascii.unhexlify(first_sha256)).hexdigest()

final_key = extended_key+second_sha256(:8)

WIF = base58.b58encode(binascii.unhexlify(final_key)).decode ('ascii')

print (WIF)

with open ("HEX.txt") as file:
for the line in the file:
convert (str.strip (line))

electrum – Convert EC PRIVATE KEY from .pem to WIF

How can I convert this (preferably using bash / Perl / python) to a WIF that can be imported into (preferably) Electrum?

OpenSSL .pem files contain base 64 encoding of values ​​encoded using DER. In case of private keys, they use PKCS # 8 explained in RFC5208. To extract the key itself, you must first decode the base 64 string and extract the key by reading the DER encoding (the published example is missing 1 byte because the length of the sequence is 0x74 but the remaining bytes that come after it is 0x73 bytes). If you want to use OpenSSL itself, try using this command:

openssl pkey -in priv.pem -out priv.key

This should give you the key bytes. You must now convert them to WIF (base-58 with checksum). Use your favorite bitcoin library (I don't have a python suggestion but there are many you could find on GitHub) which has byte-to-wif functions.

What does that mean? Wallet import format says nothing about input

Your a the private key gives you a public key which could be used in compressed and uncompressed form in many different output scripts which you will then see as a different type of address (P2PKH script -> address starting with 1; P2WPKH script -> address starting with bc1; …). So when the private key is imported into a wallet, the wallet should either search for all types of output scripts (like what Bitcoin-Core does) or ask the user to explicitly include the type script (what Electrum does).
In other words, when you import a private key into Electrum with p2pkh: the wallet only checks the address starting with 1 (inherited or base58) and when importing with p2wpkh: it only checks the address starting with bc1 (native SegWit or bech32) and so on.

As a note, there is the BIP-0178 which proposed to extend the WIF to solve this problem and Electrum briefly used a different way similar to this BIP but stopped due to a incompatibility with other customers.

private key – private key with 58 characters in WIF format

I have an old paper wallet with private keys of 58 characters (all starting with a 6). These can be imported for example on blockchain.com, but since I still have BSV on this key, I have to import / scan it into ElectronCash or ElectrumSV, which does not take this format.
So, does anyone know how to convert this key to WIF (without coding if possible)? Thanks in advance!

wallet – When you generate a WIF private key, base58check ("80" .decode ("hex")) is not preceded by "." 5 & ​​# 39;

I'm trying to generate a WIF private key with Python.

import base58
import hashlib

def b58(hex):
    return base58.b58encode(hex)

def sha256(hex):
    return hashlib.sha256(hex).digest()

def main():
    k = sha256('private_key')
    extend = '80' + k.encode('hex')
    sha1 = sha256(extend.decode('hex'))
    sha2 = sha256(sha1)
    print b58(extend.decode('hex') + sha2(:8))

if __name__ == '__main__':

the prefix of the result is not "5 & # 39; but & # 39; V & # 39;

i'm just trying to base58encode 0x80 and the result is 3D ???

Where is the error in this code?