subwallet.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2026 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. help.subwallet: subwallet help notes for the MMGen Wallet suite
  12. """
  13. def help(proto, cfg):
  14. from ..subseed import SubSeedIdxRange
  15. return f"""
  16. SUBWALLETS:
  17. Subwallets (subseeds) are specified by a ‘Subseed Index’ consisting of:
  18. a) an integer in the range 1-{SubSeedIdxRange.max_idx}, plus
  19. b) an optional single letter, ‘L’ or ‘S’
  20. The letter designates the length of the subseed. If omitted, ‘L’ is assumed.
  21. Long (‘L’) subseeds are the same length as their parent wallet’s seed
  22. (typically 256 bits), while short (‘S’) subseeds are always 128-bit.
  23. The long and short subseeds for a given index are derived independently,
  24. so both may be used.
  25. MMGen Wallet has no notion of ‘depth’, and to an outside observer subwallets
  26. are identical to ordinary wallets. This is a feature rather than a bug, as
  27. it denies an attacker any way of knowing whether a given wallet has a parent.
  28. Since subwallets are just wallets, they may be used to generate other
  29. subwallets, leading to hierarchies of arbitrary depth. However, this is
  30. inadvisable in practice for two reasons: Firstly, it creates accounting
  31. complexity, requiring the user to independently keep track of a derivation
  32. tree. More importantly, however, it leads to the danger of Seed ID
  33. collisions between subseeds at different levels of the hierarchy, as
  34. MMGen checks and avoids ID collisions only among sibling subseeds.
  35. An exception to this caveat would be a multi-user setup where sibling
  36. subwallets are distributed to different users as their default wallets.
  37. Since the subseeds derived from these subwallets are private to each user,
  38. Seed ID collisions among them doesn’t present a problem.
  39. A safe rule of thumb, therefore, is for *each user* to derive all of his/her
  40. subwallets from a single parent. This leaves each user with a total of two
  41. million subwallets, which should be enough for most practical purposes.
  42. """