I'm still wondering what would happen if there is a valid transaction with an address beyond the default 20 unused. I assume the 20 or other number is determined by the original wallet, not by the one I restore. So if there was such a transaction, how would I know if there is one, how would I recover it into the newly restored wallet?
Take note that when you recover the wallet, all the addresses are generated at the same order as the original wallet and people usually don't need to increase the gap limit.
Also note that the gap limit of 20 means that electrum stops generating new addresses once it reaches 20
consecutive unused addresses.
For example, if you have used the 20th address, electrum will generate at least 40 addresses and check their transactions history, even if you haven't used the first 19 addresses and you haven't increased the gap limit.
If you go to receive tab, click on "Create request" again and again until it generates an address beyond the gap limit for you, electrum even displays a message warning you about the address being beyond the default gap limit and also highlight them in red in "Addresses" tab.
Therefore, you should know if you have funded an address beyond the gap limit and if you have done so, you can easily increase the gap limit using the following command after restoring the wallet from seed phrase.
wallet.change_gap_limit(50)
This command will increase the gap limit to 50. You can change the 50 to any number you want.
You can also generate more addresses without increasing the gap limit using the commands posted above by o_e_l_e_o.
- the derivation paths and their flavors
You wouldn't have any issues with the derivation path if the seed phrase has been generated by electrum itself.
Even if the seed phrase is BIP39, most wallets use common derivation paths and you still don't need to save the derivation path and as mentioned by o_e_l_e_o above it can be easily detected.
If you have generated a wallet using a non-standard derivation path, you must know it when restoring the wallet from the seed phrase.
- how would I know if the wallet I'm restoring from seed also need a passphrase?
You generated the wallet and it's you that should know whether a passphrase was used or not.
- how would I know if the seed is from an Electrum wallet or some other like Atomic, etc.
Again, you are the one who must know whether the seed phrase has been generated by electrum itself or not.
And even if you don't remember that, (as mentioned above by o_e_l_e_o) electrum would detect the seed phrase type if it has been generated by itself, once you enter that.