Bitcoin Forum
April 25, 2024, 11:48:37 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What happens if I send LTC to a segwit address BTC that starts with 3?  (Read 416 times)
Forsyth Jones (OP)
Hero Member
*****
Offline Offline

Activity: 1148
Merit: 612


Press F for Leo


View Profile WWW
June 12, 2019, 03:12:01 AM
Merited by arthurbonora (1)
 #1

Imagine that someone was withdrawing LTC in exchange and mistakenly copied a bitcoin address segwit-p2sh (starts with 3), has there any way to recover those funds? some way to convert the bitcoin private key to Litecoin (or any other currency that is compatible with P2SH addresses)

OBS: Relax, guys, nobody lost funds, this is just a question that arose in my head like many others, respond without haste

.
 airbet 
██
██
██
██
██
██
██
██
██
██
██
██
██
 .

▄████▄▄▄██████▄
███████████████
███████████████
███████▀▀▀▀████
██████████████
▀███▀███████▄██
██████████▄███
██████████████
███████████████
███████████████
██████████████
█████▐████████
██████▀███████▀
▄███████████████▄
████████████████
█░██████████████
████████████████
████████████████
█████████████████
█████████████████
███████░█░███████
████████████████
█████████████████
██████████████░█
████████████████
▀███████████████▀
.
.
.
.
██▄▄▄
████████▄▄
██████▀▀████▄
██████▄░░████▄
██████████████
████████░░▀███▌
░████████▄▄████
██████████████▌
███░░░█████████
█████████░░░██▀
░░░███████████▀
██████░░░██▀
░░▀▀███▀

   
|.
....
██
██
██
██
██
██
██
██
██
██
██
██
██
.
 PLAY NOW 
1714045717
Hero Member
*
Offline Offline

Posts: 1714045717

View Profile Personal Message (Offline)

Ignore
1714045717
Reply with quote  #2

1714045717
Report to moderator
1714045717
Hero Member
*
Offline Offline

Posts: 1714045717

View Profile Personal Message (Offline)

Ignore
1714045717
Reply with quote  #2

1714045717
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714045717
Hero Member
*
Offline Offline

Posts: 1714045717

View Profile Personal Message (Offline)

Ignore
1714045717
Reply with quote  #2

1714045717
Report to moderator
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10499



View Profile
June 12, 2019, 03:56:28 AM
 #2

as far as i know both bitcoin and litecoin use the same method to get the output script for a P2SH which also includes the witness nested in script hash types. so the only thing you would need to do is to import the same key in the other coin's wallet and select the same address type to be derived from its (compressed) public key.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Khaos77
Member
**
Offline Offline

Activity: 200
Merit: 73

Flag Day ☺


View Profile
June 12, 2019, 05:06:08 AM
Last edit: June 12, 2019, 06:37:16 AM by Khaos77
 #3

as far as i know both bitcoin and litecoin use the same method to get the output script for a P2SH which also includes the witness nested in script hash types. so the only thing you would need to do is to import the same key in the other coin's wallet and select the same address type to be derived from its (compressed) public key.

Not thinking that would work.
I think the generated private keys would be different.

How would the private key be the exact same, between the BTC & LTC network for the public address?

pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10499



View Profile
June 12, 2019, 05:24:18 AM
Merited by joniboini (2), ABCbits (1)
 #4

How would the private key be the exact same, between the BTC & LTC network for the public address?

private key is just a number so that is no the place you should look. what you should look into is the type of the curve and then the script types they create. since LTC is the exact copy of bitcoin, it also uses the same curve so the same number (private key) corresponds to the same public key. and since both use the same hash functions, they both come up with the same hash. and since they also use the same script structure (OP_HASH160 <20 byte> OP_EQUAL) then the scripts are also the same. the only thing different would be address format which is the base58 encoding (first byte) which doesn't matter at all.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Khaos77
Member
**
Offline Offline

Activity: 200
Merit: 73

Flag Day ☺


View Profile
June 12, 2019, 06:33:12 AM
Merited by xandry (2), joniboini (2), HCP (2), Forsyth Jones (2), odolvlobo (1), ABCbits (1)
 #5

How would the private key be the exact same, between the BTC & LTC network for the public address?

private key is just a number so that is no the place you should look. what you should look into is the type of the curve and then the script types they create. since LTC is the exact copy of bitcoin, it also uses the same curve so the same number (private key) corresponds to the same public key. and since both use the same hash functions, they both come up with the same hash. and since they also use the same script structure (OP_HASH160 <20 byte> OP_EQUAL) then the scripts are also the same. the only thing different would be address format which is the base58 encoding (first byte) which doesn't matter at all.

Looks like you are right, it can be done.   Smiley

found the following.
https://www.reddit.com/r/Bitcoin/comments/byk9qc/help_needed_stupid_me_sent_litcoin_from_trezor_to/eqk63ut/

Quote
Here is how to do it:

    Take a Bitcoin private key in WIF (wallet import format).

    Convert it to hexadecimal format.

    Add "b0" in front of it and "01" at the end of it.

    Calculate a double SHA256 hash of the resulting string as a hex (use https://www.fileformat.info/tool/hash.htm and use the field Binary hash / Hex bytes).

    Add first 8 symbols from the result of step 4 to the resulting string of step 3.

    Convert the resulting hex string to WIF using https://incoherency.co.uk/base58/

    The result is a Litecoin private key in WIF (wallet import format).

Example:

    Bitcoin private key (WIF): KzNDQwKngvExhYzGhsMhHjeacwB9L1Asgo293Kf8TPMutvfr89wv

    Converting to hex format: 5de30ea8c8a415f7b8a0286a033c9ff9e94415326c405cf0ce611df1067ecec6

    Add "b0" in front of it and "01" at the end of it: b05de30ea8c8a415f7b8a0286a033c9ff9e94415326c405cf0ce611df1067ecec601

    First round of hash: 254609e251aeb830ce0e8c37f75b76a15795d550c410b8bdda32394c1d9a7e6d

    Second round of hash: 103087d15075dd2464c0b49dabce677e36d68179fbb871cd1f846be451946e37

    "b05de30ea8c8a415f7b8a0286a033c9ff9e94415326c405cf0ce611df1067ecec601" + "103087d1" = b05de30ea8c8a415f7b8a0286a033c9ff9e94415326c405cf0ce611df1067ecec601103087d1

    Converting to WIF: T6CUrgcy6JDZUPd9FWJZW6BxZnpTQ6BmVzvPu8Hg2MY5QpCvzyjN

    Result: we converted Bitcoin private key "KzNDQwKngvExhYzGhsMhHjeacwB9L1Asgo293Kf8TPMutvfr89wv" to Litecoin private key "T6CUrgcy6JDZUPd9FWJZW6BxZnpTQ6BmVzvPu8Hg2MY5QpCvzyjN".

Proof that it works:

Bitcoin private key: KzNDQwKngvExhYzGhsMhHjeacwB9L1Asgo293Kf8TPMutvfr89wv

Litecoin private key: T6CUrgcy6JDZUPd9FWJZW6BxZnpTQ6BmVzvPu8Hg2MY5QpCvzyjN

Use https://www.bitaddress.org (go to "Wallet Details" and enter the Bitcoin private key).

Use https://liteaddress.org (go to "Wallet Details" and enter the Litecoin private key).

You will see that for both Bitcoin and Litecoin the hex format private keys (and the uncompressed public keys) are identical. This means that these keys will "unlock" an identical SegWit address on both networks.
Forsyth Jones (OP)
Hero Member
*****
Offline Offline

Activity: 1148
Merit: 612


Press F for Leo


View Profile WWW
June 13, 2019, 12:43:30 AM
 #6

@Khaos77 thank you I did the tests following the article quoted and it worked! Now I'd like to know which wallet I still see UTXO non-spent from an address litecoin P2SH started with 3? Litecoin Core?

.
 airbet 
██
██
██
██
██
██
██
██
██
██
██
██
██
 .

▄████▄▄▄██████▄
███████████████
███████████████
███████▀▀▀▀████
██████████████
▀███▀███████▄██
██████████▄███
██████████████
███████████████
███████████████
██████████████
█████▐████████
██████▀███████▀
▄███████████████▄
████████████████
█░██████████████
████████████████
████████████████
█████████████████
█████████████████
███████░█░███████
████████████████
█████████████████
██████████████░█
████████████████
▀███████████████▀
.
.
.
.
██▄▄▄
████████▄▄
██████▀▀████▄
██████▄░░████▄
██████████████
████████░░▀███▌
░████████▄▄████
██████████████▌
███░░░█████████
█████████░░░██▀
░░░███████████▀
██████░░░██▀
░░▀▀███▀

   
|.
....
██
██
██
██
██
██
██
██
██
██
██
██
██
.
 PLAY NOW 
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
June 13, 2019, 07:25:51 AM
 #7

You should be able to use Litecoin Core or Electrum-LTC to import the private key

Electrum-LTC also has the advantage of not requiring that you sync the entire blockchain.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Forsyth Jones (OP)
Hero Member
*****
Offline Offline

Activity: 1148
Merit: 612


Press F for Leo


View Profile WWW
June 13, 2019, 04:56:30 PM
 #8

You should be able to use Litecoin Core or Electrum-LTC to import the private key

Electrum-LTC also has the advantage of not requiring that you sync the entire blockchain.
but how to import the private key with the prefix "3"?

in "info" I have only these instructions:

Code:
WIF keys are typed in Electrum, based on script type.

A few examples:
p2pkh:T4PsyoR5gC8B...       -> LXqi2tzER...
p2wpkh-p2sh:T4PsyoR5gC8B... -> MUuWxSpVC...
p2wpkh:T4PsyoR5gC8B...       -> ltc1q3fjf...

.
 airbet 
██
██
██
██
██
██
██
██
██
██
██
██
██
 .

▄████▄▄▄██████▄
███████████████
███████████████
███████▀▀▀▀████
██████████████
▀███▀███████▄██
██████████▄███
██████████████
███████████████
███████████████
██████████████
█████▐████████
██████▀███████▀
▄███████████████▄
████████████████
█░██████████████
████████████████
████████████████
█████████████████
█████████████████
███████░█░███████
████████████████
█████████████████
██████████████░█
████████████████
▀███████████████▀
.
.
.
.
██▄▄▄
████████▄▄
██████▀▀████▄
██████▄░░████▄
██████████████
████████░░▀███▌
░████████▄▄████
██████████████▌
███░░░█████████
█████████░░░██▀
░░░███████████▀
██████░░░██▀
░░▀▀███▀

   
|.
....
██
██
██
██
██
██
██
██
██
██
██
██
██
.
 PLAY NOW 
pereira4
Legendary
*
Offline Offline

Activity: 1610
Merit: 1183


View Profile
June 18, 2019, 01:10:31 AM
 #9

You should be able to use Litecoin Core or Electrum-LTC to import the private key

Electrum-LTC also has the advantage of not requiring that you sync the entire blockchain.
but how to import the private key with the prefix "3"?

in "info" I have only these instructions:

Code:
WIF keys are typed in Electrum, based on script type.

A few examples:
p2pkh:T4PsyoR5gC8B...       -> LXqi2tzER...
p2wpkh-p2sh:T4PsyoR5gC8B... -> MUuWxSpVC...
p2wpkh:T4PsyoR5gC8B...       -> ltc1q3fjf...


Im more familiar with Core but the way Electrum works, it basically forces you to create a brand new wallet in order to import keys.

So backup your current wallet, and simply follow the GUI... click on "Import Bitcoin addresses or private keys" and enter the addresses during the wizard:

HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
June 19, 2019, 09:33:58 PM
 #10

but how to import the private key with the prefix "3"?
in "info" I have only these instructions:
Code:
WIF keys are typed in Electrum, based on script type.

A few examples:
p2pkh:T4PsyoR5gC8B...        -> LXqi2tzER...
p2wpkh-p2sh:T4PsyoR5gC8B... -> MUuWxSpVC...
p2wpkh:T4PsyoR5gC8B...      -> ltc1q3fjf...
I assume you mean 'import the private key for the address that has "3" prefix'... the private key itself should most likely start with a "T"

Theoretically... the SegWit private key that you generated, should be able to be imported as "p2wpkh-p2sh"... it will create an address that starts with "M", but it should be the "same" as the address that starts with a "3"... You can check this by using the Litecoin P2SH address converter here: https://litecoin-project.github.io/p2sh-convert/

Litecoin switched to using "M" prefix to try and prevent people from accidentally sending Litecoin to Bitcoin addresses Wink

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
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!