Key derivation follows the pattern:
Mnemonic → wallet → coin → account → change → address
cardano-wallet and subsequently Daedalus and Yoroi generate addresses from this format, usually generating 50 or so unused addresses in sequential address ix order.
My question is, how does the wallet know that a new address belongs to a wallet and how does it get the derivation path for that address? Can the derivation path (ix value) be derived from the address and matched with a public key? I thought this was a one-way street, address can only be derived from derivation path and key, not the other way around. If that is the case, do wallets just generate all of the next addresses sequentially and compare them with new transaction outputs?
And, the wallet also needs to be able to derive the signing key for a specific address in order to spend the funds in each one. Does it match the address with one of the generated addresses and use the derivation path to then get the signing key?