├── cryptoport-miner.xcodeproj
├── xcuserdata
│ └── uraymeiviar.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ ├── release.xcscheme
│ │ └── cryptoport-miner.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── uraymeiviar.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── xcdebugger
│ │ │ └── Expressions.xcexplist
│ └── xcshareddata
│ │ └── cryptoport-miner.xccheckout
└── project.pbxproj
├── bin
└── mining.conf
├── src
├── MinerLogger.cpp
├── MinerLogger.h
├── MinerShabal.h
├── rapidjson
│ ├── internal
│ │ ├── strfunc.h
│ │ ├── stack.h
│ │ └── pow10.h
│ ├── filestream.h
│ ├── stringbuffer.h
│ ├── prettywriter.h
│ ├── writer.h
│ ├── rapidjson.h
│ └── reader.h
├── MinerShabal.cpp
├── nxt
│ ├── nxt_address.h
│ └── nxt_address.cpp
├── MinerUtil.h
├── PlotReader.h
├── MinerConfig.h
├── MinerProtocol.h
├── main.cpp
├── Miner.h
├── MinerUtil.cpp
├── Miner.cpp
├── MinerConfig.cpp
├── MinerProtocol.cpp
├── PlotReader.cpp
└── sphlib
│ ├── sph_shabal.h
│ └── sph_shabal.cpp
├── README.md
├── Makefile
├── burst-miner.sln
├── burst-miner.vcxproj.filters
└── burst-miner.vcxproj
/cryptoport-miner.xcodeproj/xcuserdata/uraymeiviar.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/project.xcworkspace/xcuserdata/uraymeiviar.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/uraymeiviar/burst-miner/HEAD/cryptoport-miner.xcodeproj/project.xcworkspace/xcuserdata/uraymeiviar.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/bin/mining.conf:
--------------------------------------------------------------------------------
1 | {
2 | "poolUrl" : "burst-pool.cryptoport.io",
3 | "submissionMaxDelay" : 30,
4 | "submissionMaxRetry" : 3,
5 | "socketTimeout" : 60,
6 | "maxBufferSizeMB" : 128,
7 | "plots" :
8 | [
9 | "/Users/uraymeiviar/plots",
10 | "/Users/uraymeiviar/Documents/plots"
11 | ]
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/src/MinerLogger.cpp:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #include "Miner.h"
10 |
11 | void Burst::MinerLogger::write(const std::string text)
12 | {
13 | std::lock_guard lock(MinerLogger::getInstance()->consoleMutex);
14 | std::cout << text << std::endl;
15 | }
16 |
17 | Burst::MinerLogger* Burst::MinerLogger::getInstance()
18 | {
19 | static Burst::MinerLogger instance;
20 | return &instance;
21 | }
--------------------------------------------------------------------------------
/src/MinerLogger.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_MinerLogger_h
10 | #define cryptoport_MinerLogger_h
11 | #include "Miner.h"
12 |
13 | namespace Burst
14 | {
15 | class MinerLogger
16 | {
17 | public:
18 | static void write(const std::string text);
19 | static MinerLogger* getInstance();
20 | std::mutex consoleMutex;
21 | private:
22 | };
23 | }
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/xcuserdata/uraymeiviar.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | cryptoport-miner.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1495546B19C6C76100DC6D79
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/MinerShabal.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_MinerShabal_h
10 | #define cryptoport_MinerShabal_h
11 | #include "Miner.h"
12 |
13 | namespace Burst
14 | {
15 | class Shabal256
16 | {
17 | public :
18 | Shabal256();
19 | void update(const void* data, size_t length);
20 | void update(const uint64_t data);
21 | void close(void* outData);
22 | private :
23 | sph_shabal256_context context;
24 | };
25 | }
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | burst-miner
2 | ===========
3 |
4 | native burstcoin miner, its fast, its multithreaded, low memory usage, multi-account and multi-plot
5 | you can specity plot directory or files inside mining.conf file
6 |
7 | contact : uray meiviar [ uraymeiviar@gmail.com ]
8 |
9 | please donate to support developments :
10 |
11 | + [ Burst ] `BURST-8E8K-WQ2F-ZDZ5-FQWHX`
12 | + [ Bitcoin ] `1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b`
13 |
14 | ## compilation :
15 | tested on OSX and Linux using GCC 4.8.x
16 |
17 | + for linux, just do "make", binary will be in "bin" directory and then edit "mining.conf" file
18 | + for windows, compilation is tested using Visual Studio Express 2013 (Desktop)
19 | + for OSX, compilation is tested using XCode 5
20 |
--------------------------------------------------------------------------------
/src/rapidjson/internal/strfunc.h:
--------------------------------------------------------------------------------
1 | #ifndef RAPIDJSON_INTERNAL_STRFUNC_H_
2 | #define RAPIDJSON_INTERNAL_STRFUNC_H_
3 |
4 | namespace rapidjson {
5 | namespace internal {
6 |
7 | //! Custom strlen() which works on different character types.
8 | /*! \tparam Ch Character type (e.g. char, wchar_t, short)
9 | \param s Null-terminated input string.
10 | \return Number of characters in the string.
11 | \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints.
12 | */
13 | template
14 | inline SizeType StrLen(const Ch* s) {
15 | const Ch* p = s;
16 | while (*p != '\0')
17 | ++p;
18 | return SizeType(p - s);
19 | }
20 |
21 | } // namespace internal
22 | } // namespace rapidjson
23 |
24 | #endif // RAPIDJSON_INTERNAL_STRFUNC_H_
25 |
--------------------------------------------------------------------------------
/src/MinerShabal.cpp:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #include "Miner.h"
10 |
11 | Burst::Shabal256::Shabal256()
12 | {
13 | sph_shabal256_init(&this->context);
14 | }
15 |
16 | void Burst::Shabal256::update(const void* data, size_t length)
17 | {
18 | sph_shabal256(&this->context,data,length);
19 | }
20 |
21 | void Burst::Shabal256::update(const uint64_t data)
22 | {
23 | uint64_t result = __builtin_bswap64(data);
24 | this->update(&result, sizeof(uint64_t));
25 | }
26 |
27 | void Burst::Shabal256::close(void* outData)
28 | {
29 | sph_shabal256_close(&this->context,outData);
30 | }
31 |
--------------------------------------------------------------------------------
/src/nxt/nxt_address.h:
--------------------------------------------------------------------------------
1 | /*
2 | Basic NXT address (without error correction).
3 |
4 | More info: http://wiki.nxtcrypto.org/wiki/New_Address_Format
5 |
6 | Version: 1.0, license: Public Domain, coder: NxtChg (admin@nxtchg.com).
7 | */
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | class NxtAddress
16 | {
17 | public:
18 | NxtAddress(uint64_t id);
19 | static char alphabet[33];
20 | char* account_id();
21 | bool set(char *adr);
22 | char* c_str(bool prefix = false);
23 | std::string to_string();
24 | operator uint64_t();
25 | void operator=(uint64_t acc);
26 |
27 | private:
28 | char codeword[17];
29 | char syndrome[5];
30 | static int gexp[32];
31 | static int glog[32];
32 | int gmult(int a, int b);
33 | void encode();
34 | bool ok();
35 | };
36 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CFLAGS := -O3 -march=native -std=c++11 -Wall -D_REENTRANT
2 | CC := g++ $(CFLAGS)
3 | LD := g++ -pthread
4 |
5 | MODULES := rapidjson sphlib nxt
6 | SRC_DIR := $(addprefix src/,$(MODULES)) src
7 | BUILD_DIR := $(addprefix bin/,$(MODULES)) bin
8 |
9 | SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
10 | OBJ := $(patsubst src/%.cpp,bin/%.o,$(SRC))
11 | INCLUDES := $(addprefix -I,$(SRC_DIR))
12 |
13 | EXECUTABLE:= burstminer
14 |
15 | vpath %.cpp $(SRC_DIR)
16 |
17 | define make-goal
18 | $1/%.o: %.cpp
19 | $(CC) $(INCLUDES) -c $$< -o $$@
20 | endef
21 |
22 | .PHONY: all checkdirs clean
23 |
24 | all: checkdirs bin/$(EXECUTABLE)
25 |
26 | bin/$(EXECUTABLE): $(OBJ)
27 | $(LD) $^ -o $@
28 |
29 | checkdirs: $(BUILD_DIR)
30 |
31 | $(BUILD_DIR):
32 | @mkdir -p $@
33 |
34 | clean:
35 | @rm -rf $(BUILD_DIR)
36 |
37 | $(foreach bdir,$(BUILD_DIR),$(eval $(call make-goal,$(bdir))))
38 |
--------------------------------------------------------------------------------
/burst-miner.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2013 for Windows Desktop
4 | VisualStudioVersion = 12.0.30723.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "burst-miner", "burst-miner.vcxproj", "{0FBF38FD-4EE5-4E43-ADFB-C808DE6154F1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0FBF38FD-4EE5-4E43-ADFB-C808DE6154F1}.Debug|x64.ActiveCfg = Debug|x64
15 | {0FBF38FD-4EE5-4E43-ADFB-C808DE6154F1}.Debug|x64.Build.0 = Debug|x64
16 | {0FBF38FD-4EE5-4E43-ADFB-C808DE6154F1}.Release|x64.ActiveCfg = Release|x64
17 | {0FBF38FD-4EE5-4E43-ADFB-C808DE6154F1}.Release|x64.Build.0 = Release|x64
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/src/rapidjson/filestream.h:
--------------------------------------------------------------------------------
1 | #ifndef RAPIDJSON_FILESTREAM_H_
2 | #define RAPIDJSON_FILESTREAM_H_
3 |
4 | #include
5 |
6 | namespace rapidjson {
7 |
8 | //! Wrapper of C file stream for input or output.
9 | /*!
10 | This simple wrapper does not check the validity of the stream.
11 | \implements Stream
12 | */
13 | class FileStream {
14 | public:
15 | typedef char Ch; //!< Character type. Only support char.
16 |
17 | FileStream(FILE* fp) : fp_(fp), count_(0) { Read(); }
18 | char Peek() const { return current_; }
19 | char Take() { char c = current_; Read(); return c; }
20 | size_t Tell() const { return count_; }
21 | void Put(char c) { fputc(c, fp_); }
22 |
23 | // Not implemented
24 | char* PutBegin() { return 0; }
25 | size_t PutEnd(char*) { return 0; }
26 |
27 | private:
28 | void Read() {
29 | RAPIDJSON_ASSERT(fp_ != 0);
30 | int c = fgetc(fp_);
31 | if (c != EOF) {
32 | current_ = (char)c;
33 | count_++;
34 | }
35 | else
36 | current_ = '\0';
37 | }
38 |
39 | FILE* fp_;
40 | char current_;
41 | size_t count_;
42 | };
43 |
44 | } // namespace rapidjson
45 |
46 | #endif // RAPIDJSON_FILESTREAM_H_
47 |
--------------------------------------------------------------------------------
/src/MinerUtil.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_MinerUtil_h
10 | #define cryptoport_MinerUtil_h
11 | #include "Miner.h"
12 |
13 | namespace Burst
14 | {
15 | template
16 | std::string byteArrayToStr(const std::array& arr)
17 | {
18 | std::stringstream stream;
19 | for(size_t i=0 ; i &splitStr(const std::string &s, char delim, std::vector &elems);
29 | std::vector splitStr(const std::string &s, char delim);
30 | bool isValidPlotFile(const std::string filePath);
31 | std::string getAccountIdFromPlotFile(const std::string path);
32 | std::string getStartNonceFromPlotFile(const std::string path);
33 | std::string getNonceCountFromPlotFile(const std::string path);
34 | std::string getStaggerSizeFromPlotFile(const std::string path);
35 | std::string deadlineFormat(uint64_t seconds);
36 | }
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/src/PlotReader.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_PlotReader_h
10 | #define cryptoport_PlotReader_h
11 | #include "Miner.h"
12 |
13 | namespace Burst
14 | {
15 | class PlotReader
16 | {
17 | public:
18 | PlotReader(Miner* miner);
19 | ~PlotReader();
20 |
21 | void read(const std::string path);
22 | void stop();
23 | bool isDone() const;
24 |
25 | private:
26 | void readerThread();
27 | void verifierThread();
28 |
29 | size_t nonceStart;
30 | size_t scoopNum;
31 | size_t nonceCount;
32 | size_t nonceOffset;
33 | size_t nonceRead;
34 | size_t staggerSize;
35 | uint64_t accountId;
36 | GensigData gensig;
37 |
38 | bool done;
39 | bool runVerify;
40 | std::string inputPath;
41 |
42 | Miner* miner;
43 | std::thread readerThreadObj;
44 |
45 | std::vector buffer[2];
46 |
47 | Shabal256 hash;
48 | bool verifySignaled;
49 | std::mutex verifyMutex;
50 | std::condition_variable verifySignal;
51 | std::vector* readBuffer;
52 | std::vector* writeBuffer;
53 | };
54 | }
55 | #endif
56 |
--------------------------------------------------------------------------------
/src/rapidjson/stringbuffer.h:
--------------------------------------------------------------------------------
1 | #ifndef RAPIDJSON_STRINGBUFFER_H_
2 | #define RAPIDJSON_STRINGBUFFER_H_
3 |
4 | #include "rapidjson.h"
5 | #include "internal/stack.h"
6 |
7 | namespace rapidjson {
8 |
9 | //! Represents an in-memory output stream.
10 | /*!
11 | \tparam Encoding Encoding of the stream.
12 | \tparam Allocator type for allocating memory buffer.
13 | \implements Stream
14 | */
15 | template
16 | struct GenericStringBuffer {
17 | typedef typename Encoding::Ch Ch;
18 |
19 | GenericStringBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {}
20 |
21 | void Put(Ch c) { *stack_.template Push() = c; }
22 |
23 | void Clear() { stack_.Clear(); }
24 |
25 | const char* GetString() const {
26 | // Push and pop a null terminator. This is safe.
27 | *stack_.template Push() = '\0';
28 | stack_.template Pop(1);
29 |
30 | return stack_.template Bottom();
31 | }
32 |
33 | size_t Size() const { return stack_.GetSize(); }
34 |
35 | static const size_t kDefaultCapacity = 256;
36 | mutable internal::Stack stack_;
37 | };
38 |
39 | typedef GenericStringBuffer > StringBuffer;
40 |
41 | //! Implement specialized version of PutN() with memset() for better performance.
42 | template<>
43 | inline void PutN(GenericStringBuffer >& stream, char c, size_t n) {
44 | memset(stream.stack_.Push(n), c, n * sizeof(c));
45 | }
46 |
47 | } // namespace rapidjson
48 |
49 | #endif // RAPIDJSON_STRINGBUFFER_H_
50 |
--------------------------------------------------------------------------------
/src/MinerConfig.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_MinerConfig_h
10 | #define cryptoport_MinerConfig_h
11 | #include "Miner.h"
12 |
13 | /*
14 | {
15 | poolUrl : "burst-pool.cryptoport.io:80",
16 | submissionMaxDelay : 60000,
17 | submissionMaxRetry : 3,
18 | plots : [
19 | "/mnt/sda/plots/",
20 | "/mnt/sdb/plots/"
21 | ]
22 | }
23 | */
24 |
25 | namespace Burst
26 | {
27 | class MinerConfig
28 | {
29 | public:
30 | bool readConfigFile(const std::string configPath);
31 | void rescan();
32 |
33 | size_t submissionMaxDelay = 60;
34 | size_t submissionMaxRetry = 5;
35 | std::string poolHost = "burst-pool.cryptoport.io";
36 | size_t poolPort = 80;
37 | size_t socketTimeout = 30;
38 | size_t maxBufferSizeMB = 64;
39 | std::string configPath;
40 | std::vector plotList;
41 |
42 | static const size_t hashSize = 32;
43 | static const size_t scoopPerPlot = 4096;
44 | static const size_t hashPerScoop = 2;
45 | static const size_t scoopSize = hashPerScoop * hashSize; // 64 Bytes
46 | static const size_t plotSize = scoopPerPlot * scoopSize; // 256KB = 262144 Bytes
47 | static const size_t plotScoopSize = scoopSize + hashSize; // 64 + 32 bytes
48 | private :
49 | bool addPlotLocation(const std::string fileOrPath);
50 | bool addPlotFile( std::string file);
51 | };
52 | }
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/project.xcworkspace/xcshareddata/cryptoport-miner.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 54E49234-074E-4CB2-9E27-7CF69CC8134C
9 | IDESourceControlProjectName
10 | cryptoport-miner
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 56C38A96-19B0-4BDF-89AE-8429140D9C14
14 | https://github.com/uraymeiviar/burst-miner.git
15 |
16 | IDESourceControlProjectPath
17 | cryptoport-miner.xcodeproj/project.xcworkspace
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 56C38A96-19B0-4BDF-89AE-8429140D9C14
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/uraymeiviar/burst-miner.git
25 | IDESourceControlProjectVersion
26 | 110
27 | IDESourceControlProjectWCCIdentifier
28 | 56C38A96-19B0-4BDF-89AE-8429140D9C14
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 56C38A96-19B0-4BDF-89AE-8429140D9C14
36 | IDESourceControlWCCName
37 | burst-miner
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/MinerProtocol.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_MinerProtocol_h
10 | #define cryptoport_MinerProtocol_h
11 | #include "Miner.h"
12 |
13 | namespace Burst
14 | {
15 | class MinerSocket
16 | {
17 | public:
18 | void setRemote(const std::string ip, size_t port,size_t defaultTimeout = 60);
19 | std::string httpPost(const std::string url, const std::string body);
20 | std::string httpGet(const std::string url);
21 | void httpPostAsync(const std::string url, const std::string body,std::function< void ( std::string ) > responseCallback);
22 | void httpGetAsync(const std::string url,std::function< void ( std::string ) > responseCallback);
23 | private:
24 | std::string httpRequest(const std::string method, const std::string url,
25 | const std::string body, const std::string header);
26 | void httpRequestAsync(const std::string method, const std::string url,
27 | const std::string body, const std::string header,
28 | std::function< void ( std::string ) > responseCallback );
29 | static const size_t readBufferSize = 2048;
30 | char readBuffer[readBufferSize];
31 | struct sockaddr_in remoteAddr;
32 | struct timeval socketTimeout;
33 | };
34 |
35 | class MinerProtocol
36 | {
37 | public:
38 | MinerProtocol();
39 | ~MinerProtocol();
40 |
41 | bool run(Miner* miner);
42 | void stop();
43 | uint64_t submitNonce(uint64_t nonce, uint64_t accountId);
44 | static std::string resolveHostname(const std::string host);
45 | private:
46 | Miner* miner;
47 | bool running;
48 | void getMiningInfo();
49 | uint64_t currentBlockHeight;
50 | uint64_t currentBaseTarget;
51 | std::string gensig;
52 |
53 | MinerSocket miningInfoSocket;
54 | MinerSocket nonceSubmitterSocket;
55 | };
56 | }
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/project.xcworkspace/xcuserdata/uraymeiviar.xcuserdatad/xcdebugger/Expressions.xcexplist:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
12 |
13 |
15 |
16 |
18 |
19 |
21 |
22 |
23 |
24 |
26 |
27 |
29 |
30 |
31 |
32 |
34 |
35 |
37 |
38 |
39 |
40 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #include "Miner.h"
10 |
11 | int main(int argc, const char* argv[])
12 | {
13 | Burst::MinerLogger::write("Burst cryptoport Miners");
14 | Burst::MinerLogger::write("-----------------------");
15 | Burst::MinerLogger::write("http://github.com/uraymeiviar/burst-miner");
16 | Burst::MinerLogger::write("author : uray meiviar [ uraymeiviar@gmail.com ]");
17 | Burst::MinerLogger::write("please donate to support developments :");
18 | Burst::MinerLogger::write(" [ Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX");
19 | Burst::MinerLogger::write(" [ Bitcoin ] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b");
20 | Burst::MinerLogger::write(" ");
21 |
22 | #ifdef WIN32
23 | WSADATA wsadata;
24 | if (WSAStartup(MAKEWORD(2, 2), &wsadata) != 0)
25 | {
26 | Burst::MinerLogger::write("failed to initalize networking system");
27 | }
28 | #endif
29 |
30 | std::string configFile = "mining.conf";
31 | if(argc > 1)
32 | {
33 | if(argv[1][0] == '-')
34 | {
35 | Burst::MinerLogger::write("usage : burstminer ");
36 | Burst::MinerLogger::write("if no config-file specified, program will look for mining.conf file inside current directory");
37 | }
38 | configFile = std::string(argv[1]);
39 | }
40 | Burst::MinerLogger::write("using config file : "+configFile);
41 |
42 | Burst::MinerConfig config;
43 | if( config.readConfigFile(configFile) )
44 | {
45 | Burst::MinerLogger::write("Submission Max Delay : "+ std::to_string(config.submissionMaxDelay));
46 | Burst::MinerLogger::write("Submission Max Retry : "+ std::to_string(config.submissionMaxRetry));
47 | Burst::MinerLogger::write("Buffer Size : "+ std::to_string(config.maxBufferSizeMB)+"MB");
48 | Burst::MinerLogger::write("Pool Host : "+config.poolHost+" port "+ std::to_string(config.poolPort));
49 |
50 | Burst::Miner miner(config);
51 | miner.run();
52 | }
53 | else
54 | {
55 | Burst::MinerLogger::write("Aborting program due to invalid configuration");
56 | }
57 |
58 | #ifdef WIN32
59 | WSACleanup();
60 | #endif
61 | return 0;
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/src/rapidjson/internal/stack.h:
--------------------------------------------------------------------------------
1 | #ifndef RAPIDJSON_INTERNAL_STACK_H_
2 | #define RAPIDJSON_INTERNAL_STACK_H_
3 |
4 | namespace rapidjson {
5 | namespace internal {
6 |
7 | ///////////////////////////////////////////////////////////////////////////////
8 | // Stack
9 |
10 | //! A type-unsafe stack for storing different types of data.
11 | /*! \tparam Allocator Allocator for allocating stack memory.
12 | */
13 | template
14 | class Stack {
15 | public:
16 | Stack(Allocator* allocator, size_t stack_capacity) : allocator_(allocator), own_allocator_(0), stack_(0), stack_top_(0), stack_end_(0), stack_capacity_(stack_capacity) {
17 | RAPIDJSON_ASSERT(stack_capacity_ > 0);
18 | if (!allocator_)
19 | own_allocator_ = allocator_ = new Allocator();
20 | stack_top_ = stack_ = (char*)allocator_->Malloc(stack_capacity_);
21 | stack_end_ = stack_ + stack_capacity_;
22 | }
23 |
24 | ~Stack() {
25 | Allocator::Free(stack_);
26 | delete own_allocator_; // Only delete if it is owned by the stack
27 | }
28 |
29 | void Clear() { /*stack_top_ = 0;*/ stack_top_ = stack_; }
30 |
31 | template
32 | T* Push(size_t count = 1) {
33 | // Expand the stack if needed
34 | if (stack_top_ + sizeof(T) * count >= stack_end_) {
35 | size_t new_capacity = stack_capacity_ * 2;
36 | size_t size = GetSize();
37 | size_t new_size = GetSize() + sizeof(T) * count;
38 | if (new_capacity < new_size)
39 | new_capacity = new_size;
40 | stack_ = (char*)allocator_->Realloc(stack_, stack_capacity_, new_capacity);
41 | stack_capacity_ = new_capacity;
42 | stack_top_ = stack_ + size;
43 | stack_end_ = stack_ + stack_capacity_;
44 | }
45 | T* ret = (T*)stack_top_;
46 | stack_top_ += sizeof(T) * count;
47 | return ret;
48 | }
49 |
50 | template
51 | T* Pop(size_t count) {
52 | RAPIDJSON_ASSERT(GetSize() >= count * sizeof(T));
53 | stack_top_ -= count * sizeof(T);
54 | return (T*)stack_top_;
55 | }
56 |
57 | template
58 | T* Top() {
59 | RAPIDJSON_ASSERT(GetSize() >= sizeof(T));
60 | return (T*)(stack_top_ - sizeof(T));
61 | }
62 |
63 | template
64 | T* Bottom() { return (T*)stack_; }
65 |
66 | Allocator& GetAllocator() { return *allocator_; }
67 | size_t GetSize() const { return stack_top_ - stack_; }
68 | size_t GetCapacity() const { return stack_capacity_; }
69 |
70 | private:
71 | Allocator* allocator_;
72 | Allocator* own_allocator_;
73 | char *stack_;
74 | char *stack_top_;
75 | char *stack_end_;
76 | size_t stack_capacity_;
77 | };
78 |
79 | } // namespace internal
80 | } // namespace rapidjson
81 |
82 | #endif // RAPIDJSON_STACK_H_
83 |
--------------------------------------------------------------------------------
/burst-miner.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | nxt
14 |
15 |
16 | sphlib
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | rapidjson
29 |
30 |
31 | rapidjson
32 |
33 |
34 | rapidjson
35 |
36 |
37 | rapidjson
38 |
39 |
40 | rapidjson
41 |
42 |
43 | rapidjson
44 |
45 |
46 | rapidjson
47 |
48 |
49 | nxt
50 |
51 |
52 | sphlib
53 |
54 |
55 | sphlib
56 |
57 |
58 |
59 |
60 | {531922ef-2cd8-4350-b951-76cbc096b866}
61 |
62 |
63 | {42eb2a1b-d1fb-4180-8563-9545d4df189e}
64 |
65 |
66 | {242f4f66-14f5-4d5c-8fad-1da976a482d7}
67 |
68 |
69 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/xcuserdata/uraymeiviar.xcuserdatad/xcschemes/release.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/cryptoport-miner.xcodeproj/xcuserdata/uraymeiviar.xcuserdatad/xcschemes/cryptoport-miner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/Miner.h:
--------------------------------------------------------------------------------
1 | // cryptoport.io Burst Pool Miner
2 | //
3 | // Created by Uray Meiviar < uraymeiviar@gmail.com > 2014
4 | // donation :
5 | //
6 | // [Burst ] BURST-8E8K-WQ2F-ZDZ5-FQWHX
7 | // [Bitcoin] 1UrayjqRjSJjuouhJnkczy5AuMqJGRK4b
8 |
9 | #ifndef cryptoport_Miner_h
10 | #define cryptoport_Miner_h
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include