mirror of
https://github.com/kvazar-network/keva-stratum.git
synced 2025-01-26 23:04:42 +00:00
Fix cmake and linking
This commit is contained in:
parent
e473917319
commit
61fe2a87f8
67
README.md
67
README.md
@ -8,54 +8,29 @@ High performance CryptoNote mining stratum written in Golang.
|
||||
* AES-NI enabled share validation code with fallback to slow implementation
|
||||
* Integrated NewRelic performance monitoring plugin
|
||||
|
||||
### Installation
|
||||
## Installation
|
||||
|
||||
Dependencies:
|
||||
|
||||
* go-1.6
|
||||
* Everything required to build monero
|
||||
* Monero **v0.10.0**
|
||||
* Monero >= **v0.10.0**
|
||||
|
||||
#### Mac OS X
|
||||
### Linux
|
||||
|
||||
Install required packages:
|
||||
Use Ubuntu 16.04 LTS.
|
||||
|
||||
brew update && brew install go
|
||||
export GOPATH=~/go
|
||||
go get github.com/yvasiyarov/gorelic
|
||||
Compile Monero source (with libraries option):
|
||||
|
||||
Download and compile [Monero](https://github.com/monero-project/monero) **v0.10.0**.
|
||||
cmake -DBUILD_SHARED_LIBS=1 .
|
||||
make
|
||||
|
||||
Now clone stratum repo and compile it:
|
||||
|
||||
git clone https://github.com/sammy007/go-cryptonote-pool.git
|
||||
cmake .
|
||||
make
|
||||
|
||||
Notice that for share validation stratum requires monero source tree where .a libs already compiled. By default stratum will use <code>../monero</code> directory. You can override this behavior by passing <code>MONERO_DIR</code> env variable:
|
||||
|
||||
MONERO_DIR=/path/to/monero cmake .
|
||||
make
|
||||
|
||||
Build stratum:
|
||||
|
||||
go build -o pool main.go
|
||||
|
||||
#### Linux
|
||||
|
||||
I would recommend you to use Ubuntu 16.04 LTS.
|
||||
|
||||
Install required packages:
|
||||
Install Golang and packages:
|
||||
|
||||
sudo apt-get install golang
|
||||
export GOPATH=~/go
|
||||
go get github.com/yvasiyarov/gorelic
|
||||
|
||||
In order to successfully link with monero libs, recompile monero with:
|
||||
|
||||
cmake .
|
||||
CXXFLAGS="-fPIC" CFLAGS="-fPIC" make
|
||||
|
||||
Build CGO extensions:
|
||||
|
||||
MONERO_DIR=/opt/src/monero cmake .
|
||||
@ -65,11 +40,33 @@ Build stratum:
|
||||
|
||||
go build -o pool main.go
|
||||
|
||||
#### Running Stratum
|
||||
### Mac OS X
|
||||
|
||||
Install Golang and packages packages:
|
||||
|
||||
brew update && brew install go
|
||||
export GOPATH=~/go
|
||||
go get github.com/yvasiyarov/gorelic
|
||||
|
||||
Compile Monero source:
|
||||
|
||||
cmake .
|
||||
make
|
||||
|
||||
Now clone stratum repo and compile it:
|
||||
|
||||
MONERO_DIR=/opt/src/monero cmake .
|
||||
make
|
||||
|
||||
Build stratum:
|
||||
|
||||
go build -o pool main.go
|
||||
|
||||
### Running Stratum
|
||||
|
||||
./pool config.json
|
||||
|
||||
### Configuration
|
||||
## Configuration
|
||||
|
||||
Configuration is self-describing, just copy *config.example.json* to *config.json* and run stratum with path to config file as 1st argument.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(CXXLIB "cnutilxx")
|
||||
set(CXXLIB "cnutil")
|
||||
|
||||
find_package(Boost COMPONENTS thread system program_options date_time filesystem REQUIRED)
|
||||
|
||||
@ -9,14 +9,21 @@ include_directories(${Boost_INCLUDE_DIRS})
|
||||
include_directories("${MONERO_DIR}/contrib/epee/include")
|
||||
include_directories("${MONERO_DIR}/src")
|
||||
|
||||
link_directories(
|
||||
${MONERO_DIR}/src/cryptonote_core
|
||||
${MONERO_DIR}/src/crypto
|
||||
${MONERO_DIR}/src/common
|
||||
${MONERO_DIR}/src/ringct
|
||||
)
|
||||
|
||||
# Build library
|
||||
add_library(${CXXLIB} SHARED cnutilxx/main.cpp)
|
||||
add_library(${CXXLIB} SHARED src/cnutil.cpp)
|
||||
|
||||
target_link_libraries(${CXXLIB}
|
||||
${MONERO_DIR}/src/cryptonote_core/libcryptonote_core.a
|
||||
${MONERO_DIR}/src/crypto/libcrypto.a
|
||||
${MONERO_DIR}/src/common/libcommon.a
|
||||
${MONERO_DIR}/src/ringct/libringct.a
|
||||
cryptonote_core
|
||||
crypto
|
||||
common
|
||||
ringct
|
||||
)
|
||||
|
||||
target_link_libraries(${CXXLIB}
|
||||
@ -26,12 +33,3 @@ target_link_libraries(${CXXLIB}
|
||||
${Boost_DATE_TIME_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
)
|
||||
|
||||
set(LIB "cnutil")
|
||||
|
||||
# Flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE")
|
||||
|
||||
# Build library
|
||||
add_library(${LIB} SHARED cnutil.c)
|
||||
target_link_libraries(${LIB} ${CXXLIB})
|
||||
|
@ -1,13 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include "stdbool.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "cnutilxx/main.h"
|
||||
|
||||
uint32_t convert_blob(const char *blob, size_t len, char *out) {
|
||||
return cn_convert_blob(blob, len, out);
|
||||
}
|
||||
|
||||
bool validate_address(const char *addr, size_t len) {
|
||||
return cn_validate_address(addr, len);
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package cnutil
|
||||
|
||||
// #cgo CFLAGS: -std=c11 -D_GNU_SOURCE
|
||||
// #cgo LDFLAGS: -L${SRCDIR} -lcnutil -lcnutilxx -lstdc++
|
||||
// #include "cnutil.h"
|
||||
// #cgo LDFLAGS: -L${SRCDIR} -lcnutil -Wl,-rpath ${SRCDIR} -lstdc++
|
||||
// #include <stdlib.h>
|
||||
// #include "src/cnutil.h"
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32_t cn_convert_blob(const char *blob, uint32_t len, char *out);
|
||||
bool cn_validate_address(const char *addr, uint32_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
extern "C" uint32_t cn_convert_blob(const char *blob, size_t len, char *out) {
|
||||
extern "C" uint32_t convert_blob(const char *blob, size_t len, char *out) {
|
||||
std::string input = std::string(blob, len);
|
||||
std::string output = "";
|
||||
|
||||
@ -19,7 +19,7 @@ extern "C" uint32_t cn_convert_blob(const char *blob, size_t len, char *out) {
|
||||
return output.length();
|
||||
}
|
||||
|
||||
extern "C" bool cn_validate_address(const char *addr, size_t len) {
|
||||
extern "C" bool validate_address(const char *addr, size_t len) {
|
||||
std::string input = std::string(addr, len);
|
||||
std::string output = "";
|
||||
uint64_t prefix;
|
@ -1,7 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "stdbool.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32_t convert_blob(const char *blob, uint32_t len, char *out);
|
||||
bool validate_address(const char *addr, uint32_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -5,7 +5,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE")
|
||||
include_directories("${MONERO_DIR}/contrib/epee/include")
|
||||
include_directories("${MONERO_DIR}/src")
|
||||
|
||||
link_directories(${MONERO_DIR}/src/crypto)
|
||||
|
||||
add_library(${LIB} SHARED src/hashing.c)
|
||||
target_link_libraries(${LIB}
|
||||
${MONERO_DIR}/src/crypto/libcrypto.a
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB} crypto)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package hashing
|
||||
|
||||
// #cgo CFLAGS: -std=c11 -D_GNU_SOURCE
|
||||
// #cgo LDFLAGS: -L${SRCDIR} -lhashing -lstdc++
|
||||
// #cgo LDFLAGS: -L${SRCDIR} -lhashing -Wl,-rpath ${SRCDIR} -lstdc++
|
||||
// #include <stdlib.h>
|
||||
// #include <stdint.h>
|
||||
// #include "src/hashing.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user