Skip to content

Commit ebc8633

Browse files
committed
Drop GetWork support, better Standard Benchmark
Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
1 parent 77c95fd commit ebc8633

File tree

8 files changed

+45
-188
lines changed

8 files changed

+45
-188
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LIBS = -pthread -ljansson -lcurl -lgmp -lgmpxx -lcrypto
44

55
all: rieMiner
66

7-
rieMiner: main.o miner.o stratumclient.o gbtclient.o gwclient.o client.o tools.o
7+
rieMiner: main.o miner.o stratumclient.o gbtclient.o client.o tools.o
88
$(CXX) $(CFLAGS) -o rieMiner $^ $(LIBS)
99

1010
main.o: main.cpp
@@ -19,9 +19,6 @@ stratumclient.o: stratumclient.cpp
1919
gbtclient.o: gbtclient.cpp
2020
$(CXX) $(CFLAGS) -c -o gbtclient.o gbtclient.cpp $(LIBS)
2121

22-
gwclient.o: gwclient.cpp
23-
$(CXX) $(CFLAGS) -c -o gwclient.o gwclient.cpp $(LIBS)
24-
2522
client.o: client.cpp
2623
$(CXX) $(CFLAGS) -c -o client.o client.cpp $(LIBS)
2724

README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
# rieMiner 0.9β1
1+
# rieMiner 0.9β1.5
22

33
rieMiner is a Riecoin miner supporting both solo and pooled mining, and using the latest known mining algorithm. It was originally adapted and refactored from gatra's cpuminer-rminerd (https://github.com/gatra/cpuminer-rminerd) and dave-andersen's fastrie (https://github.com/dave-andersen/fastrie).
44

5-
Solo mining is done using the GetWork or the GetBlockTemplate protocol, while pooled mining is via the Stratum protocol.
6-
7-
A benchmark mode is also proposed to compare more easily the performance between different computers.
5+
Solo mining is done using the GetBlockTemplate protocol, while pooled mining is via the Stratum protocol. A benchmark mode is also proposed to compare more easily the performance between different computers.
86

97
Official binaries will be distributed when the stable 0.9 code is out (which will not until Riecoin Core is officially updated).
108

119
This README also serves as manual for rieMiner. I hope that this program will be useful for you! Happy mining!
1210

13-
**Warning**: rieMiner 0.9β1 is the last version officially supporting the 0.10.2 wallet. It might work in future versions, but only the upcoming new Riecoin wallet will be tested for solo mining. GetWork support will also be removed.
14-
1511
![rieMiner just found a block](https://pttn.me/medias/bildoj/alia/rieMiner1.png)
1612

1713
## Compile this program
@@ -114,14 +110,15 @@ It is case sensitive, but spaces and invalid lines are ignored. If an option or
114110
* Port : port of the Riecoin wallet/server or pool. Default: 28332 (default port for Riecoin-Qt);
115111
* User : username used to connect in the server (rpcuser for solo mining). Includes the worker name (user.worker) if using Stratum. Default: nothing;
116112
* Pass : password used to connect in the server (rpcpassword for solo mining). Default: nothing;
117-
* Protocol : protocol to use: GetBlockTemplate or GetWork for solo mining, Stratum for pooled mining, Benchmark for testing. Default: Benchmark;
113+
* Protocol : protocol to use: GetBlockTemplate for solo mining, Stratum for pooled mining, Benchmark for testing. Default: Benchmark;
118114
* Address : custom payout address for solo mining (GetBlockTemplate only). Default: a donation address;
119115
* Threads : number of threads used for mining. Default: 8;
120116
* Sieve : size of the sieve table used for mining. Use a bigger number if you have more RAM, as you will obtain better results: this will usually reduce the ratio between the n-tuple and n+1-tuples counts. It can go up to 2^64 - 1, but setting this at more than a few billions will be too much and decrease performance. Default: 2^30;
121117
* Tuples : for solo mining, submit not only blocks (6-tuples) but also k-tuples of at least the given length. Its use will be explained later. Default: 6;
122118
* Refresh : refresh rate of the stats in seconds. 0 to disable them; will only notify when a k-tuple or share (k > 4) is found, or when the network finds a block. Default: 30;
123119
* TestDiff : only for Benchmark, sets the testing difficulty (must be from 265 to 32767). Default: 1600;
124-
* TestTime : only for Benchmark, sets the testing duration in s. Default: 21600 (6 hours).
120+
* TestTime : only for Benchmark, sets the testing duration in s. 0 for no time limit. Default: 0;
121+
* Test3t : only for Benchmark, stops testing after finding this number of 3-tuples. 0 for no limit. Default: 1000.
125122

126123
You can finally run the newly created rieMiner executable using
127124

@@ -151,7 +148,7 @@ These results were obtained with a Ryzen R7 2700X at 3.7 GHz, and you can use th
151148

152149
For pooled mining, the number of primes "non consecutive tuples" are shown instead, and there is an estimation of how much RIC/day you are earning. If you want to compare the performance with fastrie, multiply the speeds by 4.096. The performance should be the same as fastrie's, as rieMiner uses the same algorithm.
153150

154-
rieMiner will also notify if it found a k-tuple (k > 3) in solo mining or a share in pooled mining, and if the network found a new block. If it finds a block or a share, it will show the full submission and tell if it was accepted (solo mining only) or not. For solo mining, if the block was accepted, the reward will be generated and sent to a new random address which is included in your wallet (when using GetWork), or the one specified (for GetBlockTemplate). You can then spend it after 100 confirmations.
151+
rieMiner will also notify if it found a k-tuple (k > 3) in solo mining or a share in pooled mining, and if the network found a new block. If it finds a block or a share, it will tell if the submission was accepted (solo mining only) or not. For solo mining, if the block was accepted, the reward will be generated for the address specified in the options. You can then spend it after 100 confirmations.
155152

156153
## Solo mining specific information
157154

@@ -238,24 +235,24 @@ To compare two different platforms, you must absolutely test with the same diffi
238235
* Standard Benchmark
239236
* Difficulty of 1600;
240237
* Sieve of 2^30 = 1073741824;
241-
* Test during 6 hours;
238+
* Stop after finding 1000 3-tuples or more;
242239
* The computer must not do anything else during testing;
243-
* Imprecise for slow computers but more like the real mining conditions;
244-
* The precision will be about 3 digits for the 2 and 3-tuples/s metrics, and 2 for the 4-tuples/s one, for computers finding at least 0.1 3-tuple/s;
245-
* 5 and 6-tuples find rates should be discarded as they are too rare;
246-
* 6 hours are needed to get a reproductible enough result, but you could also do execute the Standard Benchmark for a few minutes if you only want an order of magnitude of your computer speed.
240+
* Very long for slow computers, but like the real mining conditions;
241+
* The precision will be 2 solid digits for the 2-tuples/s metric, and almost 2 digits for the 3-tuples/s one (the 2nd will still vary a bit). That said, you can share your result with 3 significant digits for each;
242+
* It would not be enough to even obtain just one solid digit for the 4-tuples/s metric, so 4, 5 and 6-tuples find rates should be discarded.
247243

248-
If you do not want to test during 6 hours, or have a slow computer, other testing parameters are suggested:
244+
Testing a few times longer will not really improve the precision. You would need to find tens if not hundreds times more tuples to gain another significant digit for each metric, which would be really unpractical. In the other direction, if you have a slow computer or want a very fast test, you can reduce the difficulty to find tuples much faster with these parameters:
249245

250-
* Simplified Benchmark
246+
* Easy Benchmark
251247
* Difficulty of 800;
252248
* Sieve of 2^27 = 134217728;
253-
* Test during 30 minutes;
254-
* The computer should not do anything else during testing, and must not do any other heavy tasks;
249+
* Stop after finding 1000 3-tuples or more;
250+
* The computer must not do anything else during testing;
255251
* Not adapted for powerful computers;
256-
* The precision will be about 3 digits for the 2 and 3-tuples/s metrics, and 2 for the 4-tuples/s one, for computers finding at least 1 3-tuple/s;
257-
* 5 and 6-tuples find rates should be discarded;
258-
* Note that the results will be completely different to the ones provided by the standard benchmark.
252+
* The precision will be similar to Standard Benchmark, but note that the results will be completely different to the ones provided by the standard benchmark;
253+
* 4, 5 and 6-tuples find rates should also be discarded.
254+
255+
In all cases, the system must not swap. Else, the result would not make much sense. Ensure that you have enough memory when trying to benchmark.
259256

260257
## Miscellaneous
261258

@@ -285,6 +282,5 @@ Donations welcome:
285282
* [Get the Riecoin wallet](http://riecoin.org/download.html)
286283
* [Fast prime cluster search - or building a fast Riecoin miner (part 1)](https://da-data.blogspot.ch/2014/03/fast-prime-cluster-search-or-building.html), nice article by dave-andersen explaining how Riecoin works and how to build an efficient miner and the algorithms. Unfortunately, he never published part 2...
287284
* [Riecoin FAQ](http://riecoin.org/faq.html) and [technical aspects](http://riecoin.org/about.html#tech)
288-
* [Bitcoin Wiki - Getwork](https://en.bitcoin.it/wiki/Getwork)
289285
* [Bitcoin Wiki - Getblocktemplate](https://en.bitcoin.it/wiki/Getblocktemplate)
290286
* [Bitcoin Wiki - Stratum](https://en.bitcoin.it/wiki/Stratum_mining_protocol)

gwclient.cpp

Lines changed: 0 additions & 118 deletions
This file was deleted.

gwclient.h

Lines changed: 0 additions & 27 deletions
This file was deleted.

main.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "main.h"
44
#include "client.h"
55
#include "miner.h"
6-
#include "gwclient.h"
76
#include "gbtclient.h"
87
#include "stratumclient.h"
98
#include "tools.h"
@@ -30,12 +29,10 @@ WorkManager::WorkManager() {
3029
void WorkManager::init() {
3130
_options.loadConf();
3231
std::cout << "-----------------------------------------------------------" << std::endl;
33-
if (_options.protocol() == "GetWork")
34-
_client = std::unique_ptr<Client>(new GWClient(shared_from_this()));
32+
if (_options.protocol() == "GetBlockTemplate")
33+
_client = std::unique_ptr<Client>(new GBTClient(shared_from_this()));
3534
else if (_options.protocol() == "Stratum")
3635
_client = std::unique_ptr<Client>(new StratumClient(shared_from_this()));
37-
else if (_options.protocol() == "GetBlockTemplate")
38-
_client = std::unique_ptr<Client>(new GBTClient(shared_from_this()));
3936
else _client = std::unique_ptr<Client>(new BMClient(shared_from_this()));
4037

4138
_miner = std::unique_ptr<Miner>(new Miner(shared_from_this()));
@@ -76,8 +73,13 @@ void WorkManager::manage() {
7673
std::chrono::time_point<std::chrono::system_clock> timer;
7774
while (true) {
7875
if (_options.protocol() == "Benchmark" && _miningStarted) {
79-
if (timeSince(_stats.miningStartTp()) > _options.testTime()) {
80-
std::cout << _options.testTime() << " s elapsed, test finished. Version: " << minerVersionString << std::endl;
76+
if (timeSince(_stats.miningStartTp()) > _options.testTime() && _options.testTime() != 0) {
77+
std::cout << _options.testTime() << " s elapsed, test finished. " << minerVersionString << ", diff " << _options.testDiff() << ", sieve " << _options.sieve() << std::endl;
78+
_stats.printTuplesStats();
79+
_exit(0);
80+
}
81+
if (_stats.tuplesCount()[3] >= _options.test3t() && _options.test3t() != 0) {
82+
std::cout << _options.test3t() << " 3-tuples found, test finished. Version: " << minerVersionString << ", difficulty " << _options.testDiff() << ", sieve " << _options.sieve() << std::endl;
8183
_stats.printTuplesStats();
8284
_exit(0);
8385
}
@@ -190,7 +192,7 @@ void Options::loadConf() {
190192
catch (...) {_refresh = 10;}
191193
}
192194
else if (key == "Protocol") {
193-
if (value == "GetWork" || value == "GetBlockTemplate" || value == "Stratum" || value == "Benchmark") {
195+
if (value == "GetBlockTemplate" || value == "Stratum" || value == "Benchmark") {
194196
_protocol = value;
195197
}
196198
else std::cout << "Invalid Protocol" << std::endl;
@@ -206,7 +208,11 @@ void Options::loadConf() {
206208
}
207209
else if (key == "TestTime") {
208210
try {_testTime = std::stoll(value);}
209-
catch (...) {_testTime = 60;}
211+
catch (...) {_testTime = 0;}
212+
}
213+
else if (key == "Test3t") {
214+
try {_test3t = std::stoll(value);}
215+
catch (...) {_test3t = 1000;}
210216
}
211217
else if (key == "Error")
212218
std::cout << "Ignoring invalid line" << std::endl;
@@ -230,7 +236,8 @@ void Options::loadConf() {
230236
std::cout << "Payout address = " << _address << std::endl;
231237
else if (_protocol == "Benchmark") {
232238
std::cout << "Test difficulty = " << _testDiff << std::endl;
233-
std::cout << "Test duration = " << _testTime << std::endl;
239+
if (_testTime != 0) std::cout << "Will stop after " << _testTime << " s" << std::endl;
240+
if (_test3t != 0) std::cout << "Will stop after finding " << _test3t << " 3-tuples" << std::endl;
234241
}
235242
std::cout << "Threads = " << _threads << std::endl;
236243
std::cout << "Sieve max = " << _sieve << std::endl;

main.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#ifndef HEADER_GLOBAL_H
44
#define HEADER_GLOBAL_H
55

6-
#define minerVersionString "rieMiner 0.9-beta1"
6+
#define minerVersionString "rieMiner 0.9-beta1.5"
77
#define BITS 64
88

99
#include <unistd.h>
@@ -82,6 +82,7 @@ class Stats {
8282
uint32_t heightAtDiffChange() const {return _heightAtDiffChange;}
8383

8484
std::chrono::time_point<std::chrono::system_clock> miningStartTp() const {return _miningStartTp;}
85+
std::array<uint32_t, 7> tuplesCount() const {return _tuples;}
8586

8687
void printTime() const {
8788
double elapsedSecs(timeSince(_miningStartTp));
@@ -140,14 +141,13 @@ class Options {
140141
std::string _host, _user, _pass, _protocol, _address;
141142
uint8_t _tuples;
142143
uint16_t _port, _threads;
143-
uint32_t _refresh, _testDiff;
144+
uint32_t _refresh, _testDiff, _testTime, _test3t;
144145
uint64_t _sieve;
145-
double _testTime;
146146

147147
void parseLine(std::string, std::string&, std::string&) const;
148148

149149
public:
150-
Options() { // Default options: standard benchmark
150+
Options() { // Default options: Standard Benchmark with 8 threads
151151
_user = "";
152152
_pass = "";
153153
_host = "127.0.0.1";
@@ -159,7 +159,8 @@ class Options {
159159
_tuples = 6;
160160
_refresh = 30;
161161
_testDiff = 1600;
162-
_testTime = 21600;
162+
_testTime = 0;
163+
_test3t = 1000;
163164
}
164165

165166
void loadConf();
@@ -176,6 +177,7 @@ class Options {
176177
uint32_t refresh() const {return _refresh;}
177178
uint32_t testDiff() const {return _testDiff;}
178179
uint32_t testTime() const {return _testTime;}
180+
uint32_t test3t() const {return _test3t;}
179181
};
180182

181183
class WorkManager : public std::enable_shared_from_this<WorkManager> {

miner.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <math.h>
88
#include "main.h"
99
#include "client.h"
10-
#include "gwclient.h"
1110
#include "tools.h"
1211
#include "tsqueue.hpp"
1312

rieMiner.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ User =
44
Pass =
55
Protocol = Benchmark
66
TestDiff = 1600
7-
TestTime = 21600
7+
TestTime = 0
8+
Test3t = 1000
89
Threads = 8
910
Sieve = 1073741824
1011
Tuples = 6

0 commit comments

Comments
 (0)