Author

Topic: any way of deriving legacy private key from a segwit address for forked coins? (Read 301 times)

member
Activity: 187
Merit: 25
Do you know any programming, or do you need a tool for this?

I am not a programmer and would very much appreciate a tool for this job, preferably one that runs on Windows or through a browser. I can use Linux if required however.
Very much appreciate your help here too.
Thanks.
copper member
Activity: 630
Merit: 2614
If you don’t do PGP, you don’t do crypto!
Segwit addresses are not derived from legacy addresses. However a legacy address can be derived from a private key for a segwit address, and vice versa. Private keys are just numbers and are not locked to a specific type of address that they should be used to create.

Note that Electrum uses a special format for private keys in order to indicate what type of address they should be used for. You will need to export those private keys and convert them into a format that your forked coin's wallet can understand.
Thank you appreciate your insight.
So the question is, do you know how to convert the exported Electrum key?

Base58check-decode the WIF private key, change the version byte from 0x81 (for Bech32 P2WPKH) or 0x82 (for P2WPKH nested in P2SH) to 0x80 (or whatever your fork coin uses), then base58check-encode the result.  Note that I am only describing the conversion of the WIF.  I make no statement whatsoever about what may or may not work for attempts to claim forked coins.

Here is the full set of values Electrum uses, copied from the source of some unreleased software of mine:

Code:
/*
 * From Electrum 3.0 Release Notes
 * https://github.com/spesmilo/electrum/blob/2774126db6c258807d95921936eb13af07047d97/RELEASE-NOTES
 */

#define WIF_P2PKH 0x80
#define WIF_P2WPKH 0x81
#define WIF_P2WPKH_P2SH 0x82
#define WIF_P2SH 0x85
#define WIF_P2WSH 0x86
#define WIF_P2WSH_P2SH 0x87

Do you know any programming, or do you need a tool for this?
member
Activity: 187
Merit: 25
Segwit addresses are not derived from legacy addresses. However a legacy address can be derived from a private key for a segwit address, and vice versa. Private keys are just numbers and are not locked to a specific type of address that they should be used to create.

Note that Electrum uses a special format for private keys in order to indicate what type of address they should be used for. You will need to export those private keys and convert them into a format that your forked coin's wallet can understand.
Thank you appreciate your insight.
So the question is, do you know how to convert the exported Electrum key?
staff
Activity: 3458
Merit: 6793
Just writing some code
Segwit addresses are not derived from legacy addresses. However a legacy address can be derived from a private key for a segwit address, and vice versa. Private keys are just numbers and are not locked to a specific type of address that they should be used to create.

Note that Electrum uses a special format for private keys in order to indicate what type of address they should be used for. You will need to export those private keys and convert them into a format that your forked coin's wallet can understand.
member
Activity: 187
Merit: 25
Hi Guys,
I have recently (a couple of months ago) moved my BTC stash to a segwit address using Electrum wallet.
As you may be aware many of the forked coins do not support segwit addresses.
Its my understanding that the segwit addresses are derived from legacy addresses? Or have I got that completely wrong?
If they are derived from legacy addresses can I find out which legacy address and its corresponding private key from my segwit address?
Obviously the aim is to be able to import the derived legacy address into the forked coin wallet and receive my forked coins.
Or have I got this completely wrong and there is no way to get any legacy private key from a segwit address?
Thanks.
Jump to: