def setUp(self): self.configdir = nuxhash.settings.DEFAULT_CONFIGDIR self.settings = nuxhash.settings.DEFAULT_SETTINGS self.settings['nicehash']['wallet'] = '3Qe7nT9hBSVoXr8rM2TG6pq82AmLVKHy23' self.device = devices[0] self.excavator = Excavator(self.configdir, nuxhash.settings.DEFAULT_SETTINGS) self.equihash = next(a for a in self.excavator.algorithms if a.algorithms == ['equihash']) self.neoscrypt = next(a for a in self.excavator.algorithms if a.algorithms == ['neoscrypt']) make_miners(self.configdir) self.excavator.load()
def _DownloadMiners(self): to_download = [item for item in make_miners(CONFIG_DIR) if not item.verify()] if len(to_download) > 0: self._DlThread = DownloadThread(self, to_download) self._DlThread.start() self._DlProgress = wx.ProgressDialog('nuxhash', '', parent=self) self._DlProgress.ShowModal() self._DlProgress.Destroy()
def setUp(self): self.configdir = nuxhash.settings.DEFAULT_CONFIGDIR self.device = devices[0] self.settings = nuxhash.settings.DEFAULT_SETTINGS self.settings['nicehash']['wallet'] = '3Qe7nT9hBSVoXr8rM2TG6pq82AmLVKHy23' self.alt_settings = nuxhash.settings.DEFAULT_SETTINGS self.alt_settings['nicehash']['wallet'] = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa' self.alt_settings['nicehash']['workername'] = 'nuxhashtest' self.excavator = Excavator(self.configdir) self.excavator.settings = self.settings self.equihash = next(a for a in self.excavator.algorithms if a.algorithms == ['equihash']) self.neoscrypt = next(a for a in self.excavator.algorithms if a.algorithms == ['neoscrypt']) make_miners(self.configdir) self.excavator.load()
def setUp(self): self.configdir = nuxhash.settings.DEFAULT_CONFIGDIR self.device = devices[0] self.settings = nuxhash.settings.DEFAULT_SETTINGS self.settings['nicehash']['wallet'] = DONATE_ADDRESS self.alt_settings = nuxhash.settings.DEFAULT_SETTINGS self.alt_settings['nicehash']['wallet'] = '3Ffa4sDFimVnGRBBLdqfZkUgxaF3jR8PL9' self.alt_settings['nicehash']['workername'] = 'nuxhashtest' self.excavator = Excavator(self.configdir) self.excavator.settings = self.settings self.equihash = next(a for a in self.excavator.algorithms if a.algorithms == ['equihash']) self.neoscrypt = next(a for a in self.excavator.algorithms if a.algorithms == ['neoscrypt']) make_miners(self.configdir) self.excavator.load()
def main(): sys.excepthook = excepthook argp = argparse.ArgumentParser( description='Sell GPU hash power on the NiceHash market.') argp_benchmark = argp.add_mutually_exclusive_group() argp_benchmark.add_argument('--benchmark-all', action='store_true', help='benchmark all algorithms on all devices') argp_benchmark.add_argument( '--benchmark-missing', action='store_true', help='benchmark algorithm-device combinations not measured') argp.add_argument('--list-devices', action='store_true', help='list all devices') argp.add_argument('-v', '--verbose', action='store_true', help='print more information to the console log') argp.add_argument( '--show-mining', action='store_true', help='print output from mining processes, implies --verbose') argp.add_argument('-c', '--configdir', nargs=1, default=[settings.DEFAULT_CONFIGDIR], help=('directory for configuration and benchmark files' + ' (default: ~/.config/nuxhash/)')) argp.add_argument('--version', action='store_true', help='show nuxhash version') args = argp.parse_args() config_dir = Path(args.configdir[0]) if args.version: print(f'nuxhash daemon {__version__}') return if args.show_mining: log_level = logging.DEBUG elif args.verbose: log_level = logging.INFO else: log_level = logging.WARN logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=log_level) all_devices = nvidia_devices() nx_settings = settings.load_settings(config_dir) nx_benchmarks = settings.load_benchmarks(config_dir, all_devices) # If no wallet configured, do initial setup prompts. if nx_settings['nicehash']['wallet'] == '': wallet, workername, region = initial_setup() nx_settings['nicehash']['wallet'] = wallet nx_settings['nicehash']['workername'] = workername nx_settings['nicehash']['region'] = region # Download and initialize miners. downloadables = make_miners(config_dir) for d in downloadables: if not d.verify(): logging.info(f'Downloading {d.name}') d.download() nx_miners = [miner(config_dir) for miner in all_miners] for miner in nx_miners: miner.settings = nx_settings # Select code path(s), benchmarks and/or mining. if args.benchmark_all: nx_benchmarks = run_missing_benchmarks(nx_miners, nx_settings, all_devices, settings.EMPTY_BENCHMARKS) elif args.benchmark_missing: nx_benchmarks = run_missing_benchmarks(nx_miners, nx_settings, all_devices, nx_benchmarks) elif args.list_devices: list_devices(all_devices) else: nx_benchmarks = run_missing_benchmarks(nx_miners, nx_settings, all_devices, nx_benchmarks) session = MiningSession(nx_miners, nx_settings, nx_benchmarks, all_devices) # Attach the SIGINT signal for quitting. # NOTE: If running in a shell, Ctrl-C will get sent to our subprocesses too, # because we are the foreground process group. Miners will get killed # before we have a chance to properly shut them down. signal.signal(signal.SIGINT, lambda signum, frame: session.stop()) session.run() settings.save_settings(config_dir, nx_settings) settings.save_benchmarks(config_dir, nx_benchmarks) terminate()
def main(): argp = argparse.ArgumentParser( description='Sell GPU hash power on the NiceHash market.') argp_benchmark = argp.add_mutually_exclusive_group() argp_benchmark.add_argument( '--benchmark-all', action='store_true', help='benchmark all algorithms on all devices') argp_benchmark.add_argument( '--benchmark-missing', action='store_true', help='benchmark algorithm-device combinations not measured') argp.add_argument('--list-devices', action='store_true', help='list all devices') argp.add_argument('-v', '--verbose', action='store_true', help='print more information to the console log') argp.add_argument('--show-mining', action='store_true', help='print output from mining processes, implies --verbose') argp.add_argument( '-c', '--configdir', nargs=1, default=[settings.DEFAULT_CONFIGDIR], help=('directory for configuration and benchmark files' + ' (default: ~/.config/nuxhash/)')) argp.add_argument('--version', action='store_true', help='show nuxhash version') args = argp.parse_args() config_dir = Path(args.configdir[0]) if args.version: print('nuxhash daemon %s' % __version__) return if args.show_mining: log_level = logging.DEBUG elif args.verbose: log_level = logging.INFO else: log_level = logging.WARN logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=log_level) all_devices = nvidia_devices() nx_settings = settings.load_settings(config_dir) nx_benchmarks = settings.load_benchmarks(config_dir, all_devices) # If no wallet configured, do initial setup prompts. if nx_settings['nicehash']['wallet'] == '': wallet, workername, region = initial_setup() nx_settings['nicehash']['wallet'] = wallet nx_settings['nicehash']['workername'] = workername nx_settings['nicehash']['region'] = region # Download and initialize miners. downloadables = make_miners(config_dir) for d in downloadables: if not d.verify(): logging.info('Downloading %s' % d.name) d.download() nx_miners = [miner(config_dir) for miner in all_miners] for miner in nx_miners: miner.settings = nx_settings # Select code path(s), benchmarks and/or mining. if args.benchmark_all: nx_benchmarks = run_missing_benchmarks( nx_miners, nx_settings, all_devices, settings.EMPTY_BENCHMARKS) elif args.benchmark_missing: nx_benchmarks = run_missing_benchmarks( nx_miners, nx_settings, all_devices, nx_benchmarks) elif args.list_devices: list_devices(all_devices) else: nx_benchmarks = run_missing_benchmarks( nx_miners, nx_settings, all_devices, nx_benchmarks) session = MiningSession(nx_miners, nx_settings, nx_benchmarks, all_devices) session.run() settings.save_settings(config_dir, nx_settings) settings.save_benchmarks(config_dir, nx_benchmarks)