Bitcoin Forum
May 05, 2024, 10:22:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   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 273 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
1714904574
Hero Member
*
Offline Offline

Posts: 1714904574

View Profile Personal Message (Offline)

Ignore
1714904574
Reply with quote  #2

1714904574
Report to moderator
1714904574
Hero Member
*
Offline Offline

Posts: 1714904574

View Profile Personal Message (Offline)

Ignore
1714904574
Reply with quote  #2

1714904574
Report to moderator
1714904574
Hero Member
*
Offline Offline

Posts: 1714904574

View Profile Personal Message (Offline)

Ignore
1714904574
Reply with quote  #2

1714904574
Report to moderator
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714904574
Hero Member
*
Offline Offline

Posts: 1714904574

View Profile Personal Message (Offline)

Ignore
1714904574
Reply with quote  #2

1714904574
Report to moderator
1714904574
Hero Member
*
Offline Offline

Posts: 1714904574

View Profile Personal Message (Offline)

Ignore
1714904574
Reply with quote  #2

1714904574
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


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: 2610


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!