globalvars.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/usr/bin/env python
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2016 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. globalvars.py: Constants and configuration options for the MMGen suite
  20. """
  21. version = '0.8.7a'
  22. release_date = 'November 2016'
  23. import sys,os
  24. # Variables - these might be altered at runtime:
  25. user_entropy = ''
  26. hash_preset = '3'
  27. usr_randchars = 30
  28. use_urandchars = False
  29. from mmgen.obj import BTCAmt
  30. tx_fee = BTCAmt('0.0003')
  31. tx_fee_adj = 1.0
  32. tx_confs = 3
  33. seed_len = 256
  34. http_timeout = 60
  35. # Constants - these don't change at runtime
  36. # os.getenv() returns None if environmental var is unset
  37. debug = os.getenv('MMGEN_DEBUG')
  38. no_license = os.getenv('MMGEN_NOLICENSE')
  39. bogus_wallet_data = os.getenv('MMGEN_BOGUS_WALLET_DATA')
  40. disable_hold_protect = os.getenv('MMGEN_DISABLE_HOLD_PROTECT')
  41. color = (False,True)[sys.stdout.isatty() and not os.getenv('MMGEN_DISABLE_COLOR')]
  42. testnet = (False,True)[bool(os.getenv('MMGEN_TESTNET'))]
  43. testnet_name = 'testnet3'
  44. proj_name = 'MMGen'
  45. prog_name = os.path.basename(sys.argv[0])
  46. author = 'Philemon'
  47. email = '<mmgen-py@yandex.com>'
  48. Cdates = '2013-2016'
  49. required_opts = [
  50. 'quiet','verbose','debug','outdir','echo_passphrase','passwd_file','stdout',
  51. 'show_hash_presets','label','keep_passphrase','keep_hash_preset',
  52. 'brain_params','b16','usr_randchars'
  53. ]
  54. incompatible_opts = (
  55. ('quiet','verbose'),
  56. ('label','keep_label'),
  57. ('tx_id', 'info'),
  58. ('tx_id', 'terse_info'),
  59. ('batch', 'rescan'),
  60. )
  61. min_screen_width = 80
  62. minconf = 1
  63. # Global var sets user opt:
  64. dfl_vars = 'minconf','seed_len','hash_preset','usr_randchars','debug','tx_confs','tx_fee_adj','tx_fee','key_generator'
  65. # User opt sets global var:
  66. usr_sets_global = ['testnet']
  67. required_opts += usr_sets_global
  68. keyconv_exec = 'keyconv'
  69. mins_per_block = 9
  70. passwd_max_tries = 5
  71. max_urandchars = 80
  72. _x = os.getenv('MMGEN_MIN_URANDCHARS')
  73. min_urandchars = int(_x) if _x and int(_x) else 10
  74. seed_lens = 128,192,256
  75. mn_lens = [i / 32 * 3 for i in seed_lens]
  76. mmenc_ext = 'mmenc'
  77. salt_len = 16
  78. aesctr_iv_len = 16
  79. hincog_chk_len = 8
  80. key_generators = 'python-ecdsa','keyconv','secp256k1'
  81. key_generator = 3 # secp256k1 is default
  82. hash_presets = {
  83. # Scrypt params:
  84. # ID N p r
  85. # N is a power of two
  86. '1': [12, 8, 1],
  87. '2': [13, 8, 4],
  88. '3': [14, 8, 8],
  89. '4': [15, 8, 12],
  90. '5': [16, 8, 16],
  91. '6': [17, 8, 20],
  92. '7': [18, 8, 24],
  93. }
  94. for k in ('win','linux'):
  95. if sys.platform[:len(k)] == k: platform = k; break
  96. else:
  97. sys.stderr.write("'%s': platform not supported by %s\n" % (sys.platform,proj_name))
  98. sys.exit(1)