Skip to content

Commit 1b71d6a

Browse files
committed
Standalone miner.
1 parent 8c153ec commit 1b71d6a

10 files changed

+605
-4
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ if (TOOLS)
354354

355355
add_subdirectory(rlp)
356356
add_subdirectory(abi)
357+
add_subdirectory(ethminer)
357358
add_subdirectory(eth)
358359

359360
if("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug")

ethminer/CMakeLists.txt

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
cmake_policy(SET CMP0015 NEW)
2+
set(CMAKE_AUTOMOC OFF)
3+
4+
aux_source_directory(. SRC_LIST)
5+
6+
include_directories(BEFORE ..)
7+
include_directories(${Boost_INCLUDE_DIRS})
8+
include_directories(${JSON_RPC_CPP_INCLUDE_DIRS})
9+
10+
set(EXECUTABLE ethminer)
11+
12+
file(GLOB HEADERS "*.h")
13+
14+
add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
15+
16+
add_dependencies(${EXECUTABLE} BuildInfo.h)
17+
18+
target_link_libraries(${EXECUTABLE} ${Boost_REGEX_LIBRARIES})
19+
20+
if (READLINE_FOUND)
21+
target_link_libraries(${EXECUTABLE} ${READLINE_LIBRARIES})
22+
endif()
23+
24+
if (JSONRPC)
25+
target_link_libraries(${EXECUTABLE} web3jsonrpc)
26+
target_link_libraries(${EXECUTABLE} ${JSON_RPC_CPP_CLIENT_LIBRARIES})
27+
target_link_libraries(${EXECUTABLE} ${CURL_LIBRARIES})
28+
if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
29+
eth_copy_dlls(${EXECUTABLE} CURL_DLLS)
30+
endif()
31+
endif()
32+
33+
target_link_libraries(${EXECUTABLE} webthree)
34+
target_link_libraries(${EXECUTABLE} ethash)
35+
36+
if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
37+
eth_copy_dlls("${EXECUTABLE}" MHD_DLLS)
38+
endif()
39+
40+
install( TARGETS ${EXECUTABLE} DESTINATION bin )
41+

ethminer/Farm.h

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY!
3+
*/
4+
5+
#ifndef JSONRPC_CPP_STUB_FARM_H_
6+
#define JSONRPC_CPP_STUB_FARM_H_
7+
8+
#include <jsonrpccpp/client.h>
9+
10+
class Farm : public jsonrpc::Client
11+
{
12+
public:
13+
Farm(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {}
14+
15+
Json::Value eth_getWork() throw (jsonrpc::JsonRpcException)
16+
{
17+
Json::Value p;
18+
p = Json::nullValue;
19+
Json::Value result = this->CallMethod("eth_getWork",p);
20+
if (result.isArray())
21+
return result;
22+
else
23+
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
24+
}
25+
bool eth_submitWork(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
26+
{
27+
Json::Value p;
28+
p.append(param1);
29+
p.append(param2);
30+
p.append(param3);
31+
Json::Value result = this->CallMethod("eth_submitWork",p);
32+
if (result.isBool())
33+
return result.asBool();
34+
else
35+
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
36+
}
37+
};
38+
39+
#endif //JSONRPC_CPP_STUB_FARM_H_

ethminer/PhoneHome.h

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY!
3+
*/
4+
5+
#ifndef JSONRPC_CPP_STUB_PHONEHOME_H_
6+
#define JSONRPC_CPP_STUB_PHONEHOME_H_
7+
8+
#include <jsonrpccpp/client.h>
9+
10+
class PhoneHome : public jsonrpc::Client
11+
{
12+
public:
13+
PhoneHome(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {}
14+
15+
int report_benchmark(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
16+
{
17+
Json::Value p;
18+
p.append(param1);
19+
p.append(param2);
20+
Json::Value result = this->CallMethod("report_benchmark",p);
21+
if (result.isInt())
22+
return result.asInt();
23+
else
24+
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
25+
}
26+
};
27+
28+
#endif //JSONRPC_CPP_STUB_PHONEHOME_H_

ethminer/farm.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
{ "name": "eth_getWork", "params": [], "order": [], "returns": []},
3+
{ "name": "eth_submitWork", "params": ["", "", ""], "order": [], "returns": true}
4+
]

0 commit comments

Comments
 (0)