diff --git a/doc/build-unix.md b/doc/build-unix.md index 6181bb25..e1865bbf 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -5,6 +5,7 @@ file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the [OpenSSL Toolkit](http://www.openssl.org/). This product includes cryptographic software written by Eric Young ([eay@cryptsoft.com](mailto:eay@cryptsoft.com)), and UPnP software written by Thomas Bernard. + UNIX BUILD NOTES ==================== @@ -14,8 +15,6 @@ To Build cd src/ make -f makefile.unix # Headless bitcoin -See readme-qt.rst for instructions on building Bitcoin-Qt, the graphical user interface. - Dependencies --------------------- @@ -24,6 +23,7 @@ Dependencies libssl SSL Support Secure communications libdb4.8 Berkeley DB Blockchain & wallet storage libboost Boost C++ Library + libgmp Gnu MP Multiprecision arithmetic library developers tools miniupnpc UPnP Support Optional firewall-jumping support [miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here]( @@ -48,15 +48,16 @@ Licenses of statically linked libraries: - GCC 4.3.3 - OpenSSL 1.0.1c - Berkeley DB 4.8.30.NC -- Boost 1.37 +- Boost 1.48 +- GMP 5.0.2 - miniupnpc 1.6 + Dependency Build Instructions: Ubuntu & Debian ---------------------------------------------- Build requirements: - sudo apt-get install build-essential - sudo apt-get install libssl-dev + sudo apt-get install build-essential libssl-dev for Ubuntu 12.04: @@ -69,9 +70,12 @@ for Ubuntu 12.04: for other Ubuntu & Debian: + sudo apt-get install libgmp-dev sudo apt-get install libdb4.8-dev sudo apt-get install libdb4.8++-dev - sudo apt-get install libboost1.37-dev + sudo apt-get install libboost1.48-dev + sudo apt-get install libboost-timer1.48-dev + sudo apt-get install libboost-chrono1.48-dev (If using Boost 1.37, append -mt to the boost libraries in the makefile) Optional: diff --git a/src/main.cpp b/src/main.cpp index 9c6f7e48..98a214d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2203,7 +2203,7 @@ bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp) // Get block work value for main chain protocol CBigNum CBlockIndex::GetBlockWork() const { - // Primecoin: + // Primecoin: // Difficulty multiplier of extra prime is estimated by nWorkTransitionRatio // Difficulty multiplier of fractional is estimated by // r = 1/TransitionRatio @@ -4592,7 +4592,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int CBlock *pblock = NULL; uint256 old_hash; unsigned int old_nonce = 0; - + try { loop { while (block_provider == NULL && vNodes.empty()) MilliSleep(1000); @@ -4602,7 +4602,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int // unsigned int nTransactionsUpdatedLast = nTransactionsUpdated; CBlockIndex* pindexPrev = pindexBest; - + auto_ptr pblocktemplate; if (block_provider == NULL) { pblocktemplate = auto_ptr(CreateNewBlock(reservekey)); @@ -4711,7 +4711,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int old_nonce = pblock->nNonce + 1; break; } - + /// /// ENABLE the following code, if you need data for the perftool /// @@ -4720,23 +4720,23 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int static CCriticalSection cs; { LOCK(cs); - + std::ofstream output_file("miner_data"); std::ofstream output_file_block("miner_data.blk", std::ofstream::out | std::ofstream::binary); - + ::Serialize(output_file_block, *pblock, 0, 0); //writeblock - + output_file << mpzFixedMultiplier.get_str(10) << std::endl; output_file << fNewBlock << std::endl; output_file << nTriedMultiplier << std::endl; output_file << nPrimorialMultiplier << std::endl; output_file << mpzHash.get_str(10) << std::endl; - + output_file.close(); output_file_block.close(); } }*/ - + nRoundTests += nTests; nRoundPrimesHit += nPrimesHit; @@ -4776,7 +4776,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int { double dPrimesPerMinute = 60000.0 * nPrimeCounter / (nMillisNow - nHPSTimerStart); dPrimesPerSec = dPrimesPerMinute / 60.0; - double dTestsPerMinute = 60000.0 * nTestCounter / (nMillisNow - nHPSTimerStart); + double dTestsPerSec = 1000.0 * nTestCounter / (nMillisNow - nHPSTimerStart); dChainsPerMinute = 60000.0 * nChainCounter / (nMillisNow - nHPSTimerStart); dChainsPerDay = 86400000.0 * dChainExpected / (GetTimeMillis() - nHPSTimerStart); nHPSTimerStart = nMillisNow; @@ -4788,12 +4788,12 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int if (nMillisNow - nLogTime > 59000) { nLogTime = nMillisNow; - printf("%s primemeter %9.0f prime/h %9.0f test/h %4.0f %d-chains/h %3.6f chain/d\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", nLogTime / 1000).c_str(), dPrimesPerMinute * 60.0, dTestsPerMinute * 60.0, dChainsPerMinute * 60.0, nStatsChainLength, dChainsPerDay); + printf("[STATS] %s | %4.0f primes/s, %4.0f tests/s, %4.0f %d-chains/h, %3.3f chains/d\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", nLogTime / 1000).c_str(), dPrimesPerSec, dTestsPerSec, dChainsPerMinute * 60.0, nStatsChainLength, dChainsPerDay); } } } } - + old_nonce = pblock->nNonce; // Check for stop or if block needs to be rebuilt @@ -4810,7 +4810,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int block_provider->forceReconnect(); nStart = GetTime(); } - if (fNewBlock) //aka: sieve's done, we need a updated nonce + if (fNewBlock) //aka: sieve's done, we need a updated nonce { // Primecoin: a sieve+primality round completes // Primecoin: estimate time to block @@ -4819,7 +4819,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int // Make sure the estimated time is very high if only 0 primes were found if (nRoundPrimesHit == 0) nCalcRoundTests *= 1000; - int64 nRoundTime = (GetTimeMicros() - nPrimeTimerStart); + int64 nRoundTime = (GetTimeMicros() - nPrimeTimerStart); dTimeExpected = (double) nRoundTime / nCalcRoundTests; double dRoundChainExpected = (double) nRoundTests; for (unsigned int n = 0, nTargetLength = TargetGetLength(pblock->nBits); n < nTargetLength; n++) @@ -4839,7 +4839,7 @@ void BitcoinMiner(CWallet *pwallet, CBlockProvider *block_provider, unsigned int // Primecoin: update time and nonce //pblock->nTime = max(pblock->nTime, (unsigned int) GetAdjustedTime()); - pblock->nTime = max(pblock->nTime, (unsigned int)(((((size_t)GetAdjustedTime() + thread_num_max) / thread_num_max) * thread_num_max) + thread_id)); + pblock->nTime = max(pblock->nTime, (unsigned int)(((((size_t)GetAdjustedTime() + thread_num_max) / thread_num_max) * thread_num_max) + thread_id)); pblock->nNonce++; loop { // Fast loop diff --git a/src/main_poolminer.cpp b/src/main_poolminer.cpp index 8280fb47..95aafb5b 100644 --- a/src/main_poolminer.cpp +++ b/src/main_poolminer.cpp @@ -416,7 +416,7 @@ private: void stats_running() { if (!running) return; std::cout << std::fixed; - std::cout << std::setprecision(0); + std::cout << std::setprecision(1); boost::posix_time::ptime t_end = boost::posix_time::second_clock::universal_time(); unsigned long rejects = 0; unsigned long stale = 0; @@ -428,11 +428,12 @@ private: if (it->first == 1) blocks = it->second; if (it->first > 1) valid += it->second; } + std::cout << "[STATS] " << DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTimeMillis() / 1000).c_str() << " | "; for (std::map::iterator it = statistics.begin(); it != statistics.end(); ++it) if (it->first > 1) - std::cout << " " << it->first << "-CH: " << it->second << " (" << + std::cout << it->first << "-CH: " << it->second << " (" << ((valid+blocks > 0) ? (static_cast(it->second) / static_cast(valid+blocks)) * 100.0 : 0.0) << "% | " << - ((valid+blocks > 0) ? (static_cast(it->second) / (static_cast((t_end - t_start).total_seconds()) / 3600.0)) : 0.0) << "/hr), "; + ((valid+blocks > 0) ? (static_cast(it->second) / (static_cast((t_end - t_start).total_seconds()) / 3600.0)) : 0.0) << "/h), "; if (valid+blocks+rejects+stale > 0) { std::cout << "VL: " << valid+blocks << " (" << (static_cast(valid+blocks) / static_cast(valid+blocks+rejects+stale)) * 100.0 << "%), "; std::cout << "RJ: " << rejects << " (" << (static_cast(rejects) / static_cast(valid+blocks+rejects+stale)) * 100.0 << "%), "; @@ -467,13 +468,13 @@ void stats_on_exit() { } std::cout << std::endl; std::cout << "********************************************" << std::endl; - std::cout << "*** running time: " << static_cast((t_end - t_start).total_seconds()) / 3600.0 << "hrs" << std::endl; + std::cout << "*** running time: " << static_cast((t_end - t_start).total_seconds()) / 3600.0 << "h" << std::endl; std::cout << "***" << std::endl; for (std::map::iterator it = statistics.begin(); it != statistics.end(); ++it) if (it->first > 1) std::cout << "*** " << it->first << "-chains: " << it->second << "\t(" << ((valid+blocks > 0) ? (static_cast(it->second) / static_cast(valid+blocks)) * 100.0 : 0.0) << "% | " << - ((valid+blocks > 0) ? (static_cast(it->second) / (static_cast((t_end - t_start).total_seconds()) / 3600.0)) : 0.0) << "/hr)" << + ((valid+blocks > 0) ? (static_cast(it->second) / (static_cast((t_end - t_start).total_seconds()) / 3600.0)) : 0.0) << "/h)" << std::endl; if (valid+blocks+rejects+stale > 0) { std::cout << "***" << std::endl;