Skip to content

Commit d4e5791

Browse files
committed
Minor refactoring, Bêta 3, add custom configuration file support
Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
1 parent 6fc0f1b commit d4e5791

File tree

8 files changed

+191
-189
lines changed

8 files changed

+191
-189
lines changed

README.md

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
# rieMiner 0.9β2.7
1+
# rieMiner 0.9β3
22

3-
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), though there is no remaining code from rminerd anymore.
3+
rieMiner is a Riecoin miner supporting both solo and pooled mining. 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), though there is no remaining code from rminerd anymore.
44

55
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.
66

7-
Official binaries will be distributed when the stable 0.9 code is out (which will not until Riecoin Core is officially updated).
7+
It is recommended to use a recent enough CPU with at least 4 cores and 8 GB of RAM to mine efficiently enough.
8+
9+
Direct link to the latest official [Windows x64 standalone executable](https://ric.pttn.me/file.php?d=rieMinerWin64).
810

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

1113
The Riecoin community thanks you for your participation, you will be a contributor to the robustness of the Riecoin network.
1214

13-
![rieMiner just found a block](https://pttn.me/medias/bildoj/alia/rieMiner1.png)
15+
![rieMiner just found a block](https://ric.pttn.me/file.php?d=rieMiner)
1416

1517
## Compile this program
1618

17-
Only x64 systems are supported since version 0.9β2.4.
19+
Only x64 systems with SSE are supported since version 0.9β2.4.
1820

1921
### In Debian/Ubuntu x64
2022

@@ -62,11 +64,12 @@ Go to the rieMiner's directory with cd, and compile with make.
6264

6365
The produced executable will run only in the MSYS console, or if all the needed DLLs are next to the executable. To obtain a standalone executable, you need to link statically the dependencies. Normally, this is done just by adding "-static" at the LIBS line in the Makefile. Unfortunately, libcurl will give you a hard time, and you need to compile it yourself.
6466

65-
First, edit the Makefile add "-D CURL_STATICLIB" at the end of the CFLAGS line, and "-static" just after the "LIBS =" in the LIBS line. You might also want to change the march argument to support other/olders processors.
67+
First, edit the Makefile to add "-D CURL_STATICLIB" at the end of the CFLAGS line and "-static" just after the "LIBS =" in the first LIBS line. You might also want to change the march argument to support other/olders processors.
6668

6769
```
6870
CFLAGS = -Wall -Wextra -std=gnu++11 -O3 -march=native -D CURL_STATICLIB
69-
LIBS = -static -pthread -ljansson -lcurl -lgmp -lgmpxx -lcrypto
71+
[...]
72+
LIBS = -static -pthread -ljansson -lcurl -lcrypto -lgmp -lgmpxx -lws2_32
7073
```
7174

7275
Then, download the [latest official libcurl code](https://curl.haxx.se/download.html) on their website, under "Source Archives", and decompress the folder somewhere (for example, next to the rieMiner's one).
@@ -100,7 +103,7 @@ Alternatively, you can create or edit this "rieMiner.conf" file next to the exec
100103
Option type = Option value
101104
```
102105

103-
It is case sensitive, but spaces and invalid lines are ignored. **Do not put ; at the end or use other delimiters than =** for each line, and **do not confuse rieMiner.conf with riecoin.conf**! If an option or the file is missing, the default value(s) will be used. If there are duplicate lines, the last one will be used. The available options are:
106+
It is case sensitive, but spaces and invalid lines are ignored. **Do not put ; at the end or use other delimiters than =** for each line, and **do not confuse rieMiner.conf with riecoin.conf**! If an option is missing, the default value(s) will be used. If there are duplicate lines, the last one will be used. The available options are:
104107

105108
* Host : IP of the Riecoin wallet/server or pool. Default: 127.0.0.1 (your computer);
106109
* Port : port of the Riecoin wallet/server or pool. Default: 28332 (default port for Riecoin-Qt);
@@ -109,15 +112,23 @@ It is case sensitive, but spaces and invalid lines are ignored. **Do not put ; a
109112
* Protocol : protocol to use: GetBlockTemplate for solo mining, Stratum for pooled mining, Benchmark for testing. Default: Benchmark;
110113
* Address : custom payout address for solo mining (GetBlockTemplate only). Default: a donation address;
111114
* Threads : number of threads used for mining. Default: 8;
112-
* 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^31;
115+
* 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;
113116
* 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;
114-
* Refresh : refresh rate of the stats in seconds. 0 to disable them; will only notify when a k-tuple or share (k >= Tuples option value if solo mining) is found, or when the network finds a block. Default: 30;
115-
* MaxMemory : set an approximate limit on amount of memory to use in GiB. 0 for no limit. Default: 0;
117+
* Refresh : refresh rate of the stats in seconds. 0 to disable them: will only notify when a k-tuple or share (k >= Tuples option value if solo mining) is found, or when the network finds a block. Default: 30;
118+
* MaxMem : set an approximate limit on amount of memory to use in MiB. 0 for no limit. Default: 0;
116119
* TestDiff : only for Benchmark, sets the testing difficulty (must be from 265 to 32767). Default: 1600;
117120
* TestTime : only for Benchmark, sets the testing duration in s. 0 for no time limit. Default: 0;
118121
* Test3t : only for Benchmark, stops testing after finding this number of 3-tuples. 0 for no limit. Default: 1000;
119122
* TCFile : Tuples Counts filename, in which rieMiner will save for each difficulty the number of tuples found. Note that there must never be more than one rieMiner instance using the same file. Default: None (special value that disables this feature).
120123

124+
It is also possible to use custom configuration file paths, examples:
125+
126+
```bash
127+
./rieMiner config/example.txt
128+
./rieMiner "config 2.conf"
129+
./rieMiner /home/user/rieMiner/rieMiner.conf
130+
```
131+
121132
### Advanced options
122133

123134
Normally, you should never need to change them, but they can be useful for developing purposes, or maybe some further optimizations.
@@ -126,7 +137,7 @@ Normally, you should never need to change them, but they can be useful for devel
126137
* POff : Primorial Offset for the Wheel Factorization. Default: 16057;
127138
* ConsType : set your Constellation Type, i. e. the primes tuple offsets, each separated by a comma. Default: 0, 4, 2, 4, 2, 4 (values for Riecoin mining).
128139

129-
Some possible constellations types (format: (type) -> offsets to put in the config file ; 3 first constellations (n + 0) which can be used as offsets)
140+
Some possible constellations types (format: (type) -> offsets to put in the config file ; 3 first constellations (n + 0) which can be used as offsets, though some might not work)
130141

131142
* 5-tuples
132143
* (0, 2, 6, 8, 12) -> 0, 2, 4, 2, 4 ; 5, 11, 101,...
@@ -147,25 +158,25 @@ Note that you must use different tuples counts files if you use different conste
147158

148159
### Memory problems
149160

150-
If you have memory errors, try to lower the Sieve value or set MaxMemory to control memory usage.
161+
If you have memory errors, try to lower the Sieve value in the configuration file, or set MaxMem to control memory usage.
151162

152163
## Statistics
153164

154165
rieMiner will regularly print some stats, and the frequency of this can be changed with the Refresh parameter as said earlier. For solo mining, rieMiner will regularly show the 1 to 3 tuples found per second metrics, and the number of 2 to 6 tuples found since the start of the mining.
155166

156167
After finding at least a 4-tuple after a difficulty change, rieMiner will also estimate the average time to find a block by extrapolating from how many 1, 2, and 3-tuples were found, but of course, even if the average time to find a block is for example 2 days, you could find a block in the next hour as you could find nothing during a week.
157168

158-
For pooled mining, the number of valid and total shares 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 2 and 3-"tuples/s" speeds by 4.096. The performance should be a bit better than fastrie's, as rieMiner includes some more optimized code.
169+
For pooled mining, the shares per minute metric and the numbers of valid and total shares are shown instead, and there is an estimation of how much RIC/day you are earning. These metrics should not be used to compare performance.
159170

160-
rieMiner will also notify if it found a k-tuple (k >= Tuples option value) 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.
171+
rieMiner will also notify if it found a k-tuple (k >= Tuples option value) 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. Note that orphaned blocks will be shown as accepted.
161172

162173
## Solo mining specific information
163174

164175
Note that other ways for solo mining (protocol proxies,...) were never tested with rieMiner. It was written specifically for the official wallet and the existing Riecoin pools.
165176

166177
### Configure the Riecoin wallet for solo mining
167178

168-
To solo mine with the official Riecoin-Qt wallet, you have to configure it.
179+
We assume that Riecoin Core is already working and synced. To solo mine with it, you have to configure it.
169180

170181
* Find the riecoin.conf configuration file. It should be located in /home/username/.riecoin or equivalent in Windows;
171182
* **Do not confuse this file with the rieMiner.conf**!
@@ -203,8 +214,10 @@ Remember that the miner searches numbers n such that n, n + 2, n + 6, n + 10, n
203214
Also watch regularly if the wallet is correctly syncing, especially if the message "Blockheight = ..." did not appear since a very long time (except if the Diff is very high, in this case, it means that the network is now mining the superblock). In Riecoin-Qt, this can be done by hovering the green check at the lower right corner, and comparing the number with the latest block found in an Riecoin explorer. If something is wrong, try to change the nodes in riecoin.conf, the following always worked fine for me:
204215

205216
```
217+
connect=nodes.riecoin-community.com
206218
connect=5.9.39.9
207219
connect=37.59.143.10
220+
connect=78.83.27.28
208221
connect=144.217.15.39
209222
connect=149.14.200.26
210223
connect=178.251.25.240
@@ -245,6 +258,7 @@ To compare two different platforms, you must absolutely test with the same diffi
245258
* Standard Benchmark
246259
* Difficulty of 1600;
247260
* Sieve of 2^30 = 1073741824 or 2^31 = 2147483648 (always precise this information too);
261+
* No memory limit;
248262
* Stop after finding 1000 3-tuples or more;
249263
* The computer must not do anything else during testing;
250264
* Very long for slow computers, but like the real mining conditions;
@@ -257,33 +271,38 @@ The system must not swap. Else, the result would not make much sense. Ensure tha
257271

258272
Standard Benchmark with a Sieve of 2^30.
259273

260-
* AMD Ryzen 2700X @4 GHz, DDR4 2400 CL15, Debian 9, 0.9β1.5: (7.20 0.246 0.0079)
261-
* AMD Ryzen 2700X @3 GHz, DDR4 2400 CL15, Debian 9, 0.9β1.5: (5.37 0.189 0.0068)
262-
* Intel Core i7 6700K @3 GHz, DDR4 2400 CL15, Debian 9, 0.9β1.5: (2.77 0.092 0.0030)
263-
* Intel Core 2 Duo L7500 @1.6 GHz, DDR2 667 CL5, Debian 9, 0.9β1.5: (0.349 0.0118 0.00038)
274+
* AMD Ryzen 2700X @4 GHz, DDR4 2400 CL15, Debian 9, 0.9β3: (228.0 7.58 0.258) (1 to 3-tuples/s)
275+
* AMD Ryzen 2700X @4 GHz, DDR4 2400 CL15, Debian 9, 0.9β1.5: (7.20 0.246 0.0079) (outdated version, 2 to 4-tuples/s)
276+
* AMD Ryzen 2700X @3 GHz, DDR4 2400 CL15, Debian 9, 0.9β1.5: (5.37 0.189 0.0068) (outdated version, 2 to 4-tuples/s)
277+
* Intel Core i7 6700K @3 GHz, DDR4 2400 CL15, Debian 9, 0.9β1.5: (2.77 0.092 0.0030) (outdated version, 2 to 4-tuples/s)
278+
* Intel Core 2 Duo L7500 @1.6 GHz, DDR2 667 CL5, Debian 9, 0.9β1.5: (0.349 0.0118 0.00038) (outdated version, 2 to 4-tuples/s)
264279

265-
## Miscellaneous
280+
With a Sieve of 2^31.
266281

267-
It is recommended to use a recent enough CPU with at least 4 cores and 8 GB of RAM to mine efficiently enough.
282+
* AMD Ryzen 2700X @4 GHz, DDR4 2400 CL15, Debian 9, 0.9β3: (227.1 7.81 0.266)
283+
284+
## Miscellaneous
268285

269286
Unless the weather is very cold, I do not recommend to overclock a CPU for mining, unless you can do that without increasing noticeably the power consumption. My 2700X computer would draw much, much more power at 4 GHz/1.2875 V instead of 3.7 GHz/1.08125 V, which is certainly absurd for a mere 8% increase. To get maximum efficiency, you might want to find the frequency with the best performance/power consumption ratio (which could also be obtained by underclocking the processor).
270287

271288
If you can, try to undervolt the CPU to reduce power consumption, heat and noise.
272289

273-
## Author and license
290+
## Developers and license
274291

275-
* [Pttn](https://github.com/Pttn), contact: dev at Pttn dot me
292+
* [Pttn](https://github.com/Pttn), author, contact: dev at Pttn dot me
276293

277294
Parts coming from other projects and libraries are subject to their respective licenses. Else, this work is released under the MIT license. See the [LICENSE](LICENSE) or top of source files for details.
278295

279-
### Contributors
296+
### Notable contributors
280297

281-
* [Michael Bell](https://github.com/MichaelBell/): assembly optimizations and some more.
298+
* [Michael Bell](https://github.com/MichaelBell/): assembly optimizations, improvements of work management between threads, and some more.
282299

283300
## Contributing
284301

285302
Feel free to do a pull request or open an issue, and I will review it. I am open for adding new features, but I also wish to keep this project minimalist. Any useful contribution will be welcomed.
286303

304+
By contributing to rieMiner, you accept to place your code in the MIT license.
305+
287306
Donations welcome:
288307

289308
* Bitcoin: 1PttnMeD9X6imTsRojmhHa1rjudW8Bjok5

client.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct WorkData {
6363

6464
// Communicates with the server to get, parse, and submit mining work
6565
// Absctract class with protocol independent member variables and functions
66-
// Child concrete classes: GWClient, GBTClient
6766
class Client {
6867
protected:
6968
bool _inited, _connected;

gbtclient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ void GBTClient::sendWork(const std::pair<WorkData, uint8_t>& share) const {
133133
uint16_t k(share.second);
134134
_manager->printTime();
135135
std::cout << " " << k << "-tuple found";
136-
if (k < 6) std::cout << std::endl;
137-
else if (k == 6) {
136+
if (k < _gbtd.primes) std::cout << std::endl;
137+
else {
138138
std::cout << ", this is a block!" << std::endl;
139139
std::cout << "Sent: " << req;
140140
if (jsonSb == NULL) std::cerr << "Failure submiting block :|" << std::endl;

0 commit comments

Comments
 (0)