@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.