I have been reading the BIP32 proposal explaining how HD works but it didn't mention on any point how one wallet in one phone can recover from a simple mnemonic seed.
1. Does it just try all possible addresses related to that seed's master key by doing the entire blockchain look up for addresses at the same time ? (This seems impractical imo).
Most wallet implement what is known as the "Gap Limit" method of address generation. Essentially, they will continue to generate (and check) addresses until they have found N
consecutive addresses that are "unused". In this instance, "unused" means there are no
transactions to said address on the blockchain. It is generally NOT related to current balance... but to whether or not the address shows up in any
transactionsFor instance, imagine that our Gap Limit was 5... and we had a wallet that looked like this:
Address1 - 2 txes - Balance 0 BTC
Address2 - unused
Address3 - unused
Address4 - 1 tx - Balance 0.1 BTC
Address5 - unused
Address6 - unused
Address7 - unused
Address8 - unused
Address9 - unused
Address10 - 1 tx - Balance 0.1 BTC
With a Gap Limit of 5... during a restore... the wallet would likely stop generating addresses at Address9, and tell us we only have 0.1 BTC, as Address9 would have been the 5th address in a row with no transaction history found.
If the Gap Limit was more than 5, then during the restore, it would also find Address10 and show the full balance of 0.2 BTC.
2. Are there standards on the max nth of address to generate from the wallet side ?
Not really... it is usually up to the wallet developer what value they use... and likely related to the wallets system of generating new addresses.
I know that, by default, Electrum uses a Gap Limit of 25 for receive addresses (and only 5 for change addresses). I believe MultiBit HD used to use a Gap Limit of 50 or 100... but MultiBit HD had this weird system where every single time you displayed the "receive" tab, it would generate a new address (regardless of whether or not you wanted a new address). So you could end up with a LOT of unused addresses and large "gaps".
It's a balancing act really... gap limit too large means a long wait for the user while the wallet generates and checks addresses during restore... gap limit too small means you might miss addresses/balance during restore.