2

I have the following btc private key that I generated from another application:

5KCPzu4tEAnFqwLrXUbW3GKMDSnUYY8CMie2HMRuHouSvrFhXA9

That application gives me the following segwit address:

bc1qluk574lw9t536u72n0z2ya0ksx3s0kg0evkrme

But when I goto https://segwitaddress.org and scroll down and enter in my private key at Enter a WIF private key to generate its corresponding segwit address. I get a totally different address:

37wArHq69dxRwLkHt6MY8PpmbB6qjErrbK

So do these 2 public keys actually have the same private key? How do I verify if my private key does indeed output the same public keys? I couldn't find any program to do this verification.

2 Answers 2

2

There is no standard for specifying whether a private key should correspond to a bech32 address, P2SH nested segwit address, or P2PKH address (1... address). The WIF format has traditionally been used for P2PKH addresses. However some wallets now will decide to instead create a P2SH nested segwit address or even a bech32 address instead. But because there is no standard for private keys that correspond to segwit addresses, it is entirely up to the wallet to determine what kind of address to give you for a private key.

In your case, the wallet gave you a P2SH nested segwit address. But it could have just as easily given you the P2PKH address or the bech32 address since the private key can be used to produce all 3 types of addresses.

3
  • So any btc private key can generate 3 different types of addresses: 1xxx (legacy), 3xxxx (P2SH), and bc1 (Segwit)? My question now is how can I extract all 3 of these addresses from a single private key? My main goal is to see if the bc1 address matches my private key as I can't figure out any way of verifying if they match. Feb 3, 2018 at 22:42
  • Yes, any private key can be used to generate those 3 types of addresses. In theory, it could actually be used to generate an infinite amount of P2SH addresses as the scripts can include basically any arbitrary data in addition to the public key. The only to check the addresses is to find a software that will generate each one for you.
    – Andrew Chow
    Feb 3, 2018 at 22:46
  • Which software would do this? Feb 5, 2018 at 20:20
1

Yes. this is normal, it's simply a matter of how it is derived.

I can even import your private key with a legacy wallet (in Electrum), which gives me 1QGFb7AUSFFnXEfBMUEf79NGKXqXMf9TQ7

You can then do a base58 check to see if it is valid.

See http://lenschulwitz.com/base58 and validate for yourself.

2
  • Yeah but how do I check if the bc1xxxxx address corresponds to the same private key? Feb 2, 2018 at 22:03
  • You will need to find a wallet/service that supports the importing of a private key, and then the derivation to a bc1 adress. I'm not sure if Electrum allows you to import keys in their bc1 compatible wallets, but i guess you could try. Feb 2, 2018 at 22:47

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.