1

I am wondering if you can explain this.

I went here: https://coinb.in/#newSegWit

Created the SegWit Address below:

3ASaGJ8h2bLn6Jha3hncBzXUKRCLyfv9bk

RedeemScript

037fa484e4b870082298d6acca0702a48714323664c647604e6461d4739feb0d9b

Public key

00147a201aa7e1cfb799dcfc2b447a0238421ae2fa60

Private key (WIF key)

KzVonapu3Cf7DaMpaqkUQ9tpsBQPBH7Yk6tXJdvMwuJSy97GK7dc

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

And I got this address instead:

1C8ju39MFSPXNqtYDhsuB3Ek45L46dBr3G

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.

3
  • are you asking how addresses are generated or do you not understand why there are different types of addresses?
    – JBaczuk
    Commented Jul 7, 2018 at 12:56
  • I want to understand how is it possible that the same WIF Private Key generates two different addresses? I knew that each address has its unique private key.
    – Robert
    Commented Jul 7, 2018 at 13:37
  • There was a longer thread here: bitcoin.stackexchange.com/questions/69315/…, which looks at the WIF keys and corresponding priv and pubkeys (though there is no P2SH involved). Commented Jul 9, 2018 at 10:17

4 Answers 4

6

The same private key can be used to derive a couple of different addresses. For example, there will be a different address generated depending on whether you use a compressed or uncompressed public key in the derivation.

More relevant to your question, you can use a private key to derive a P2SH-wrapped segwit address (3ASaGJ.. in your example), or just a plain old P2PKH address (1C8ju3.. in your example). Both addresses are spendable using the same private key, since they are both derived from the same private key.

Note that you should not design a wallet to create segwit addresses using an uncompressed public key (use the compressed key only!), due to potential backwards-compatibility issues in the future.

This image from the bitcoin wiki Address page helps to illustrate this point:

Bitcoin Address Derivation Map

1
  • Thanks for all answers, I think this one is the most detailed.
    – Robert
    Commented Jul 8, 2018 at 11:03
2

There are many types of addresses, see Bitcoin Transaction, each can be created for the same recipient (key pair). For example:

  • Pay to PubKey Hash (P2PKH) - These start with 1. This is basically just a hash of your public key. If you can prove you own the public key, you can spend it.
  • Pay to Script Hash (P2SH) - These start with 3. This is a script that you must prove you can satisfy using your private key. There are many types of scripts as well.

They are just different ways of locking Bitcoin for a recipient, but in all of them the recipient must use the private key to satisfy the lock to spend the Bitcoin.

2

An overview of the address types, check out: https://en.bitcoin.it/wiki/Address

You are looking for P2SH, https://segwitaddress.org/ just scroll down and put in your compressed WIF key at the 'Details' section.

Further check out https://iancoleman.io/bip39/

BIP44, BIP49 and BIP 85 are also implemented in the Coinomi Wallet.

https://coinomi.freshdesk.com/support/solutions/articles/29000009746-what-are-default-compatibility-and-legacy-addresses-all-about-segwit-

1
  • You meant BIP84 there. BIP85 is very different
    – HansBKK
    Commented Aug 11, 2022 at 1:30
0

First a private key is created. Then a public key is generated from it. Finally it is encoded into a format.

See https://coinb.in/?verify=037fa484e4b870082298d6acca0702a48714323664c647604e6461d4739feb0d9b#verify

Your Answer

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

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