xmr-stak-cpu 빌드(컴파일) 하기
XMR(모네로, monero)를 위한 CPU채굴 프로그램
1. 폴더 생성
mkdir c:\xmr-stak-dep
2. Visual Studion 2017 Commnunity 다운로드 및 설치, 실행후에
1) Desktop development with C++(왼쪽에서 선택)
2) Toolset for Visual Studio C++ 2015... (오른쪽에서 선택)
3. Cmake for Win64 다운로드 ( 3.9 )
4. Dependencies ( OpenSSL/Hwloc and Microhttpd ) 다운로드
unzip c:\xmr-stap-dep
개발자 기부/수수료
4.1 on_switch_pool(size_t pool_id) :
if ( pool_id = dev_pool_id )
donate.xmr-stak.net:6666 또는 donate.xmr-stak.net:3333
4.2 case EV_SWITCH_POOL:
on_switch_pool(ev.iPoolId)
5. 컴파일
xmr-stak-cpu를 github에서 다운로드후 unzip c:\xmr-stak-cpu
아래 명령어를 실행
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
set CMAKE_PREFIX_PATH=C:\xmr-stak-dep\hwloc;C:\xmr-stak-dep\libmicrohttpd;C:\xmr-stak-dep\openssl
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..
msbuild xmr-stak-cpu.sln /p:Configuration=Release
cd bin\Release
copy ..\..\..\config.txt .
또는 c:\xmr-stak-cpu 아래에
_vs1SetEnv.bat
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
pause
_vs2Build.bat
:: should run after : setVs.bat
set CMAKE_PREFIX_PATH=d:\xmr-stak-dep\hwloc;d:\xmr-stak-dep\libmicrohttpd;d:\xmr-stak-dep\openssl
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..
msbuild xmr-stak-cpu.sln /p:Configuration=Release
cd bin\Release
copy ..\..\..\config.txt .
pause
5.1 실행시 Error1 : msvcp140.dll, vcruntime140.dll not available erros
--> 다운로드 from Microsoft
5.2 원본 : https://github.com/fireice-uk/xmr-stak-cpu
5.3 첨부 : 컴파일 버젼
* 개발자 기부 수수료 부분 (자세히)
https://github.com/fireice-uk/xmr-stak-cpu/blob/master/executor.cpp
// executor.cpp
void executor::ex_clock_thd()
{
size_t iSwitchPeriod = sec_to_ticks(iDevDonatePeriod); // 6000 -> 12000
size_t iDevPortion = (size_t)floor(((double)iSwitchPeriod) * fDevDonationLevel); // 240
//No point in bothering with less than 10 sec
if(iDevPortion < sec_to_ticks(10))
iDevPortion = 0;
//Add 2 seconds to compensate for connect
if(iDevPortion != 0)
iDevPortion += sec_to_ticks(2); // 244
while (true)
{
std::this_thread::sleep_for(std::chrono::milliseconds(size_t(iTickTime)));
push_event(ex_event(EV_PERF_TICK));
// Service timed events
std::unique_lock lck(timed_event_mutex);
std::list::iterator ev = lTimedEvents.begin();
while (ev != lTimedEvents.end())
{
ev->ticks_left--;
if(ev->ticks_left == 0)
{
push_event(std::move(ev->event));
ev = lTimedEvents.erase(ev);
}
else
ev++;
}
lck.unlock();
if(iDevPortion == 0)
continue;
iSwitchPeriod--;
if(iSwitchPeriod == 0)
{
push_event(ex_event(EV_SWITCH_POOL, usr_pool_id));
iSwitchPeriod = sec_to_ticks(iDevDonatePeriod);
}
else if(iSwitchPeriod == iDevPortion) // 244
{
push_event(ex_event(EV_SWITCH_POOL, dev_pool_id));
}
}
}
// donate-level.h
// constexpr double fDevDonationLevel = 2.0 / 100.0;
// executor.h
constexpr static size_t iDevDonatePeriod = 100 * 60;
[실행]
[2017-11-14 11:53:29] : Starting single thread, affinity: 0.
[2017-11-14 11:53:29] : Starting single thread, affinity: 1.
[2017-11-14 11:53:29] : Starting single thread, affinity: 2.
[2017-11-14 11:53:29] : iDevDonatePeriod: 6000
[2017-11-14 11:53:29] : Connecting to pool xmr-eu.dwarfpool.com:8005 ...
[2017-11-14 11:53:29] : iSwitchPeriod: 12000
[2017-11-14 11:53:29] : hwloc: memory pinned
[2017-11-14 11:53:29] : fDevDonationLevel: 1202590843
[2017-11-14 11:53:29] : iDevPortion: 240
[2017-11-14 11:53:29] : iDevPortion: 244
[2017-11-14 11:53:29] : hwloc: memory pinned
[2017-11-14 11:53:29] : MEMORY ALLOC FAILED: VirtualAlloc failed.
[2017-11-14 11:53:29] : hwloc: memory pinned
[2017-11-14 11:53:29] : MEMORY ALLOC FAILED: VirtualAlloc failed.
[2017-11-14 11:53:29] : MEMORY ALLOC FAILED: VirtualAlloc failed.
[2017-11-14 11:53:29] : Connected. Logging in...
[2017-11-14 11:53:30] : Difficulty changed. Now: 20000.
[2017-11-14 11:53:30] : New block detected.