Author

Topic: What happens if I send LTC to a segwit address BTC that starts with 3? (Read 433 times)

HCP
legendary
Activity: 2086
Merit: 4363
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
legendary
Activity: 1610
Merit: 1183
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:

hero member
Activity: 1120
Merit: 540
Duelbits - Play for Free | Win for Real
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...
HCP
legendary
Activity: 2086
Merit: 4363
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.
hero member
Activity: 1120
Merit: 540
Duelbits - Play for Free | Win for Real
@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?
member
Activity: 200
Merit: 73
Flag Day ☺
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.
legendary
Activity: 3472
Merit: 10611
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.
member
Activity: 200
Merit: 73
Flag Day ☺
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?

legendary
Activity: 3472
Merit: 10611
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.
hero member
Activity: 1120
Merit: 540
Duelbits - Play for Free | Win for Real
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
Jump to: