globalvars.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #!/usr/bin/env python
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2015 Philemon <mmgen-py@yandex.com>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. """
  19. config.py: Constants and configuration options for the MMGen suite
  20. """
  21. import sys, os
  22. # Variables - these might be altered at runtime:
  23. user_entropy = ""
  24. hash_preset = '3'
  25. usr_randchars = 30
  26. use_urandchars = False
  27. # returns None if env var unset
  28. debug = os.getenv("MMGEN_DEBUG")
  29. no_license = os.getenv("MMGEN_NOLICENSE")
  30. bogus_wallet_data = os.getenv("MMGEN_BOGUS_WALLET_DATA")
  31. disable_hold_protect = os.getenv("MMGEN_DISABLE_HOLD_PROTECT")
  32. from decimal import Decimal
  33. tx_fee = Decimal("0.00005")
  34. max_tx_fee = Decimal("0.01")
  35. seed_len = 256
  36. http_timeout = 30
  37. # Constants - these don't change at runtime
  38. proj_name = "MMGen"
  39. prog_name = os.path.basename(sys.argv[0])
  40. author = "Philemon"
  41. email = "<mmgen-py@yandex.com>"
  42. Cdates = '2013-2015'
  43. version = '0.8.1'
  44. required_opts = [
  45. "quiet","verbose","debug","outdir","echo_passphrase","passwd_file",
  46. "usr_randchars","stdout","show_hash_presets","label",
  47. "keep_passphrase","keep_hash_preset"
  48. ]
  49. incompatible_opts = (
  50. ("quiet","verbose"),
  51. ("label","keep_label"),
  52. ("tx_id", "info"),
  53. ("tx_id", "terse_info"),
  54. )
  55. min_screen_width = 80
  56. wallet_ext = "mmdat"
  57. seed_ext = "mmseed"
  58. mn_ext = "mmwords"
  59. brain_ext = "mmbrain"
  60. incog_ext = "mmincog"
  61. incog_hex_ext = "mmincox"
  62. seedfile_exts = (
  63. wallet_ext, seed_ext, mn_ext, brain_ext, incog_ext, incog_hex_ext
  64. )
  65. rawtx_ext = "raw"
  66. sigtx_ext = "sig"
  67. addrfile_ext = "addrs"
  68. addrfile_chksum_ext = "chk"
  69. keyfile_ext = "keys"
  70. keyaddrfile_ext = "akeys"
  71. mmenc_ext = "mmenc"
  72. default_wordlist = "electrum"
  73. #default_wordlist = "tirosh"
  74. # Global value sets user opt
  75. dfl_vars = "seed_len","hash_preset","usr_randchars","debug"
  76. seed_lens = 128,192,256
  77. mn_lens = [i / 32 * 3 for i in seed_lens]
  78. keyconv_exec = "keyconv"
  79. mins_per_block = 9
  80. passwd_max_tries = 5
  81. max_urandchars,min_urandchars = 80,10
  82. salt_len = 16
  83. aesctr_iv_len = 16
  84. hincog_chk_len = 8
  85. hash_presets = {
  86. # Scrypt params:
  87. # ID N p r
  88. # N is a power of two
  89. '1': [12, 8, 1],
  90. '2': [13, 8, 4],
  91. '3': [14, 8, 8],
  92. '4': [15, 8, 12],
  93. '5': [16, 8, 16],
  94. '6': [17, 8, 20],
  95. '7': [18, 8, 24],
  96. }
  97. mmgen_idx_max_digits = 7
  98. printable_nonl = [chr(i+32) for i in range(95)]
  99. printable = printable_nonl + ['\n','\t']
  100. addr_label_symbols = wallet_label_symbols = printable_nonl
  101. max_addr_label_len = 32
  102. max_wallet_label_len = 48
  103. max_tx_comment_len = 72 # Comment is b58 encoded, so can permit all UTF-8