1

So I'm trying to get my head around this!

  1. I've got my 24 seed for my Trezor.
  2. I got my Segwit account for LTC (Address starts with M).
  3. I also have the P2H equivalent for my address (Starts with 3).

How do I derive using the BIP39? I tried, and I ended up with addresses that start with L. (Legacy ones).

m/49'/2'/0'/0 --> this one is for M Segwit LTC
m/44'/2'/0'/0 ---> this one is for Legacy LTC

2

When you are deriving addresses, you are actually deriving private or public keys from which an address is derived. However addresses are actually an encoding of what type of script to use in the output, but private keys have no concept of what scripts are. So when you derive your keys, they don't specify what type of address to create. Each private key can actually correspond to multiple addresses.

To specify what kind of address to create, your wallet software must be able to understand what the derivation paths mean or be able to be told what kind of address to be created. Just using a derivation path for keys which were used to derive one type of address does not mean that all software will create the same addresses.

You will need to use a software that knows how to create the address type you want and then you need to be able to tell it to do that.

0

@AndrewChow♦ explained it nicely.

Another way to see the relationship between keys and addresses is directly using litecoind, if you have one handy.

$ litecoin-cli getaddressesbyaccount ""
[returns list (A) of addresses or none]
$ litecoin-cli getnewaddress ""
[returns a fresh new address ADDR1]
$ litecoin-cli getaddressesbyaccount ""
[returns list of addresses (A) + single entry for ADDR1]
$ litecoin-cli dumpprivkey <ADDR1>
[returns private key PRIV1 that ADDR1 came from]
$ litecoin-cli importprivkey <PRIV1>
[returns nothing]
$ litecoin-cli getaddressesbyaccount ""
[returns list of addresses (A) + ADDR1 + two extra representations]

That last call to getaddressesbyaccount "" shows that when importing a private key, the daemon adds all possible addresses that correspond to it.

The private key in litecoin's case corresponds to:

  • a p2pkh address (legacy, non-Segwit): starts with 'L'
  • a p2sh address (wrapped Segwit): starts with 'M'
  • a bech32 address (pure Segwit): starts with 'ltc'

Note: the ADDR1 returned by getnewaddress will either be an 'L' address or an 'M' address depending on whether the daemon's config contains addresstype=legacy or not respectively. You could optionally define on the command line the type of address you want generated:\

$ getnewaddress "" legacy/p2sh-segwit/bech32

Note 2: as you might have noticed litecoind (recent versions) avoids altogether the old p2sh addresses starting with '3' as they are trying to get people to move away from them and towards 'M' ones, to avoid further confusion with bitcoin's '3' addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.