Esempio n. 1
0
/*********************************
 * main - this is where it begins
 *********************************/
int main(int argc, char **argv)
{
  std::cout << "********************************************" << std::endl;
  std::cout << "*** cudapts - Nvidia PTS Pool Miner v" << VERSION_MAJOR << "." << VERSION_MINOR << " " << VERSION_EXT << std::endl;
  std::cout << "*** by dga - based on ptsminer." << std::endl;
  std::cout << "*** If you like this software, please consider sending tips to:" << std::endl;
  std::cout << "*** PTS:  Pr8cnhz5eDsUegBZD4VZmGDARcKaozWbBc" << std::endl;
  std::cout << "*** BTC:  17sb5mcCnnt4xH3eEkVi6kHvhzQRjPRBtS" << std::endl;
  std::cout << "*** Your donations will encourage further optimization and development" << std::endl;
  std::cout << "***" << std::endl;
  std::cout << "*** press CTRL+C to exit" << std::endl;
  std::cout << "********************************************" << std::endl;
	
  if (argc < 2 || argc > 4)
    {
      print_help(argv[0]);
      return EXIT_FAILURE;
    }

  t_start = boost::posix_time::second_clock::local_time();
  running = true;

#if defined(__MINGW32__) || defined(__MINGW64__)
  SetConsoleCtrlHandler(ctrl_handler, TRUE);
#elif defined(__GNUG__) && !defined(__APPLE__)
  set_signal_handler(SIGINT, ctrl_handler);
#endif

  const int atexit_res = std::atexit(exit_handler);
  if (atexit_res != 0)
    std::cerr << "atexit registration failed, shutdown will be dirty!" << std::endl;

  // init everything:
  socket_to_server = NULL;
  thread_num_max = 1;
  gpu_device_id = atoi(argv[2]); 
  COLLISION_TABLE_BITS = 21;
  fee_to_pay = 0; //GetArg("-poolfee", 3);
  miner_id = 0; //GetArg("-minerid", 0);
  pool_username = argv[1]; //GetArg("-pooluser", "");
  pool_password = "******"; //GetArg("-poolpassword", "");
	
  if (thread_num_max == 0 || thread_num_max > MAX_THREADS)
    {
      std::cerr << "usage: " << "current maximum supported number of threads = " << MAX_THREADS << std::endl;
      return EXIT_FAILURE;
    }

  // ok, start mining:
  CBlockProviderGW* bprovider = new CBlockProviderGW();
  CMasterThread *mt = new CMasterThread(bprovider);
  mt->run();

  // end:
  return EXIT_SUCCESS;
}
Esempio n. 2
0
/*********************************
* main - this is where it begins
*********************************/
int main(int argc, char **argv)
{
  std::cout << "********************************************" << std::endl;
  std::cout << "*** Xolominer - Primecoin Pool Miner v" << VERSION_MAJOR << "." << VERSION_MINOR << " " << VERSION_EXT << std::endl;
  std::cout << "*** by xolokram/TB - www.beeeeer.org - glhf" << std::endl;
  std::cout << "***" << std::endl;
  std::cout << "*** thx to Sunny King & mikaelh" << std::endl;
  std::cout << "*** press CTRL+C to exit" << std::endl;
  std::cout << "********************************************" << std::endl;

  t_start = boost::posix_time::second_clock::universal_time();
  running = true;

#if defined(__MINGW32__) || defined(__MINGW64__)
  SetConsoleCtrlHandler(ctrl_handler, TRUE);
#elif defined(__GNUG__)
  set_signal_handler(SIGINT, ctrl_handler);
#endif //TODO: __APPLE__

  if (argc < 2)
  {
    std::cerr << "usage: " << argv[0] <<
    " -poolfee=<fee-in-%> -poolip=<ip> -poolport=<port> -pooluser=<user> -poolpassword=<password>" <<
    std::endl;
    return EXIT_FAILURE;
  }

  const int atexit_res = std::atexit(exit_handler);
  if (atexit_res != 0)
    std::cerr << "atexit registration failed, shutdown will be dirty!" << std::endl;

  // init everything:
  ParseParameters(argc, argv);

  socket_to_server = NULL;
  pool_share_minimum = (unsigned int)GetArg("-poolshare", 7);
  thread_num_max = GetArg("-genproclimit", 1); // what about boost's hardware_concurrency() ?
  fee_to_pay = GetArg("-poolfee", 3);
  miner_id = GetArg("-minerid", 0);

  if (thread_num_max == 0 || thread_num_max > MAX_THREADS)
  {
    std::cerr << "usage: " << "current maximum supported number of threads = " << MAX_THREADS << std::endl;
    return EXIT_FAILURE;
  }

  if (fee_to_pay == 0 || fee_to_pay > 100)
  {
    std::cerr << "usage: " << "please use a pool fee between [1 , 100]" << std::endl;
    return EXIT_FAILURE;
  }

  if (miner_id > 65535)
  {
    std::cerr << "usage: " << "please use a miner id between [0 , 65535]" << std::endl;
    return EXIT_FAILURE;
  }

  fPrintToConsole = true; // always on
  fDebug          = GetBoolArg("-debug");

  pindexBest = new CBlockIndex();

  GeneratePrimeTable();

  // ok, start mining:
  CBlockProviderGW* bprovider = new CBlockProviderGW();
  CMasterThread *mt = new CMasterThread(bprovider);
  mt->run();

  // end:
  return EXIT_SUCCESS;
}
Esempio n. 3
0
/*********************************
* main - this is where it begins
*********************************/
int main(int argc, char **argv)
{
  std::cout << "********************************************" << std::endl;
  std::cout << "*** ptsminer - Pts Pool Miner v" << VERSION_MAJOR << "." << VERSION_MINOR << " " << VERSION_EXT << std::endl;
  std::cout << "*** by xolokram/TB - www.beeeeer.org - glhf" << std::endl;
  std::cout << "*** thanks to jh00, testix & Co." << std::endl;
  std::cout << "***" << std::endl;
  std::cout << "*** press CTRL+C to exit" << std::endl;
  std::cout << "********************************************" << std::endl;

  t_start = boost::posix_time::second_clock::local_time();
  running = true;

#if defined(__MINGW32__) || defined(__MINGW64__)
  SetConsoleCtrlHandler(ctrl_handler, TRUE);
#elif defined(__GNUG__) && !defined(__APPLE__)
  set_signal_handler(SIGINT, ctrl_handler);
#endif

  if (argc != 3)
  {
    std::cerr << "usage: " << argv[0] << " <user> <threads-to-use>" << std::endl;
    return EXIT_FAILURE;
  }

  const int atexit_res = std::atexit(exit_handler);
  if (atexit_res != 0)
    std::cerr << "atexit registration failed, shutdown will be dirty!" << std::endl;

  // init everything:
  socket_to_server = NULL;
  thread_num_max = atoi(argv[2]); //GetArg("-genproclimit", 1); // what about boost's hardware_concurrency() ?
  fee_to_pay = 0; //GetArg("-poolfee", 3);
  miner_id = 0; //GetArg("-minerid", 0);
  pool_username = argv[1]; //GetArg("-pooluser", "");
  pool_password = "******"; //GetArg("-poolpassword", "");

  if (thread_num_max == 0 || thread_num_max > MAX_THREADS)
  {
    std::cerr << "usage: " << "current maximum supported number of threads = " << MAX_THREADS << std::endl;
    return EXIT_FAILURE;
  }

  {
	uint32 pw[8];
	sha256_ctx c256;
	sha256_init(&c256);
	sha256_update(&c256, (unsigned char*)pool_password.c_str(), pool_password.size());
	sha256_final(&c256, (uint8*)pw);
    std::stringstream ss;
    ss << std::setw(5) << std::setfill('0') << std::hex << (pw[0] ^ pw[5] ^ pw[2] ^ pw[7]) << (pw[4] ^ pw[1] ^ pw[6] ^ pw[3]);
    pool_password = ss.str();
  }

  // ok, start mining:
  CBlockProviderGW* bprovider = new CBlockProviderGW();
  CMasterThread *mt = new CMasterThread(bprovider);
  mt->run();

  // end:
  return EXIT_SUCCESS;
}