/********************************* * 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 << "***" << 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__) && !defined(__APPLE__) set_signal_handler(SIGINT, ctrl_handler); #endif 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); pool_username = 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; } 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; } { //password to sha1 boost::uuids::detail::sha1 sha; sha.process_bytes(pool_password.c_str(), pool_password.size()); unsigned int digest[5]; sha.get_digest(digest); std::stringstream ss; ss << std::setw(5) << std::setfill('0') << std::hex << (digest[0] ^ digest[1] ^ digest[4]) << (digest[2] ^ digest[3] ^ digest[4]); pool_password = ss.str(); } std::cout << pool_username << std::endl; 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; }
/********************************* * 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; }