Bitcoin Forum
November 18, 2024, 08:36:57 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: any way of deriving legacy private key from a segwit address for forked coins?  (Read 296 times)
RealMachasm (OP)
Member
**
Offline Offline

Activity: 187
Merit: 25


View Profile
February 07, 2018, 05:17:29 PM
Merited by ABCbits (1)
 #1

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.

3LrRBnTe6CDtMXkvpsXj5fVZyfjFVJf2ZW
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
February 07, 2018, 07:08:27 PM
Merited by HeRetiK (1), ABCbits (1)
 #2

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.

RealMachasm (OP)
Member
**
Offline Offline

Activity: 187
Merit: 25


View Profile
February 07, 2018, 09:24:20 PM
 #3

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?

3LrRBnTe6CDtMXkvpsXj5fVZyfjFVJf2ZW
nullius
Copper Member
Hero Member
*****
Offline Offline

Activity: 630
Merit: 2614


If you don’t do PGP, you don’t do crypto!


View Profile WWW
February 08, 2018, 03:48:30 AM
Merited by ABCbits (2), HeRetiK (1)
 #4

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?

RealMachasm (OP)
Member
**
Offline Offline

Activity: 187
Merit: 25


View Profile
February 08, 2018, 07:27:15 AM
 #5

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.

3LrRBnTe6CDtMXkvpsXj5fVZyfjFVJf2ZW
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!