Technical notes posted by j0nn9

Archived, date-sorted posts of j0nn9 to bitcointalk Gapcoin thread

Prime Gap
145 2014-10-22, 21:34:32
Can you also please elaborate on this:
Quote
First of all, Gapcoin follows Riecoin’s way and uses enough Miller-Rabin tests with random bases to avoid composite numbers being accepted as Prove of Work, like Primecoin mistakenly could.
In Primecoin a fermat liar could be accepted as PoW.
PoW.cpp:
Code:
130   /* start has to be a prime */                                                 
131   if (!mpz_probab_prime_p(mpz_start, 25)) {                                     
132                                                                                 
133     mpz_clear(mpz_start);                                                       
134     return false;                                                               
135   }                                                                             
136                                                                                 
137   mpz_init(mpz_end);                                                           
138   mpz_nextprime(mpz_end, mpz_start);

mpz_nextprime also uses 25 miller rabin test:
mpz/nextprime.c:
Code:
107     /* Miller-Rabin test */                                                     
108     if (mpz_millerrabin (p, 25))                                               
109       goto done;
Every client uses 25 miller rabin test with random bases, to prove the primality of a prime gap. That should ensure that pseudo primes gets detected by the network.
137 2014-10-23, 22:45:51
Within the test networks the greatest merits were mostly about 9 times greater than the difficulty, so we hopefully only need to reach a difficulty of  27.
133 2014-10-24, 22:01:37
[2014-10-24 23:40:26] pps: 34837 / 34249  10g/h  /   15g/h  /
[2014-10-24 23:40:36] pps: 35186 / 34256  10g/h  /   15g/h  /
[2014-10-24 23:40:46] pps: 35285 / 34264  10g/h  /   15g/h  /
[2014-10-24 23:41:05] pps: 35083 / 34280  10g/h  /   15g/h  /
Got new target: 20.2047

how do you know what speed I Sad

pps are your primes per second. 34280 is actually pretty good, what cpu are you mining on? Maybe we can create a hardware comparison page on the website.
107 2014-11-02, 23:43:15
doesn’t proof of work verification necessary involve testing all numbers in the gap? Even using a sieve, wouldn’t it become too slow?
Hey Gatra. Yes, proof of work verification involves testing all numbers in the gap. It is a simple gmp call:
Code:
130   /* start has to be a prime */                                                 
131   if (!mpz_probab_prime_p(mpz_start, 25)) {                                     
132                                                                                 
133     mpz_clear(mpz_start);                                                       
134     return false;                                                               
135   }                                                                             
136                                                                                 
137   mpz_init(mpz_end);                                                           
138   mpz_nextprime(mpz_end, mpz_start);
The time for one verification is currently about 0.008 seconds (on a Intel i5-2500K)

If merit is about gap size/log(p), but max gap size is O(log^2(p)), then max merit is O(log(p)). So in order to get more merit, you‘ll eventually need larger primes, otherwise you‘ll have an upper bound for the merit! How do you handle this?
This is no problem, you can control the prime bit size with the shift field within the block header. The largest prime can theoretically have a bit size of 256 + 2^16 Gapcoin also has a (compile time) opt-in restriction for the max allowed shift amount. The main nodes currently only allows shifts up to 512.

Best regards, j0nn9
074 2014-11-19, 21:04:59
Being physicist and unfortunately not so into math i watched this today (and the 20min more footage) about prime gaps and kinda liked it:https://www.youtube.com/watch?v=vkMXdShDdtY
Some questions:
Is there also world records for primes that have a gap of 2 ? Can gapcoin find them or because of sieves it may pass primes (I am not sure i understand how sieves work)?
I am kinda excited with primes lately. What should i read to understand how gapcoin finds gaps? Does it need really advanced mathematics?
The algorithm:

The average length of a prime gap with the starting prime p, is log(p), which means that the average prime gap size increases with larger primes.

Instead of the pure length, Gapcoin uses the “merit” of a prime gap, which is the ratio of the gap’s size to the average gap size. Let p be the prime starting a prime gap, then m = gapsize/log(p) will be the merit of this prime gap.

Also a pseudo-random number is calculated from p to provide finer difficulty adjustment.

Let rand(p) be a pseudo-random function with 0 < rand(p) < 1 Then, for a prime gap starting at prime p with size s, the difficulty will be s/log(p) + 2/log(p) ∗ rand(p), where 2/log(p) is the average distance between a gap of size s and s + 2 (the next greater gap) in the proximity of p.

When it actually comes to mining, there are two additional fields added to the block header, named “shift” and “adder”.

We will calculate the prime p as sha256(block header) ∗ 2^shift + adder. As an additional criterion the adder has to be smaller than 2^shift to avoid that the PoW could be reused.


Mining:

For mining, PoWCore uses a basic prime sieve with some slightly improvements:

The sieving steps:

Calculate the first n primes. In the actual sieve we skip all even numbers, because we want to only sieve the odd multiplies of each prime. So, we create an additional set of primes and multiply each with two. Make sure the start_index of the sieve is divisible by two.

Now calculate for each prime the first odd number in the sieve, which is divisible by that prime (called pindex).

For each prime p: mark the pindex as composite, add 2 ∗ p to pindex and mark it as composite, redo till we reach the end of the sieve.

For each remaining prime candidate, check primality with the Fermat-pseudo-prime-test as it is faster than the Miller-Rabin-test (Fermat is not as accurate as the Miller-Rabin and maybe some valid sieve results will not be accepted, but this should be very rare)

Now scan the remaining (pseudo) primes for a big prime gap.


Additional notes:

start_index can be hash ∗ 2^shift + [0, 2^shift)

max sieve size depends on start_index, and is limited by (hash + 2^shift) - start_index.

shift can theoretically be in range [14, 2^16], but nodes can choose to only accept shifts till a given amount (e.g. 512 for the main nodes)


dcct’s improvements

We do not check every remaining prime candidate with the fermat test. Instead we look how large the gap has to be to fit the required difficulty (max_length). Then we determine the first prime in the sieve (called pstart). Now we scan the prime candidates in the range (pstart, pstart + max_length). We start at the position (pstart + max_length) and scan every prime candidate in reverse order till we reach pstart.

If we find a prime within the range (pstart, pstart + max_length) we can skip all other prime candidates within that range and set pstart to that prime. We redo the above process till we reach the end of the sieve.
058 2014-12-14, 20:08:56
I’m confused by what a gap and a merit is
You have two following prime numbers like pn=11 and pn+1=13. The gap is gn=13-11=2. The ratio of gn / ln(pn) is called the merit of the gap gn. Now why and if bigger merit is important i dont know.
The average size of a prime gap increases with higher primes and is about ln(pn). In fact it its very trivial to find a gap with at least length n:

Quote from: Wikipedia
For any prime number P, we write P# for P primorial, that is, the product of all prime numbers up to and including P. If Q is the prime number following P, then the sequence

P#+2, P#+3,...,P#+(Q-1)

is a sequence of Q − 2 consecutive composite integers, so here there is a prime gap of at least length Q − 1. Therefore, there exist gaps between primes which are arbitrarily large, i.e., for any prime number P, there is an integer n with gn ≥ P
The merit is the ratio of the size of a prime gap in comparison to the average size of a prime gap in the proximity of p. To find a gap with at least merit m, the average calculation amount is e^m primes.

To sum it up it is easy to find long prime gaps, but it is very difficult to find prime gaps with a high merit.
027 2015-03-13, 23:54:25
I’ll venture a hypothesis from various things I’ve read on this whole thread. The miner sets up the sieve, in your case 2^25 (the shift being 25) and the resultant value as the required sieve size - 33554432. Now the question is how many primes to use.

All the primes chosen are (from my understanding) each multiplied by 3, then the miner starts with the highest value prime*3 and works backwards scanning for the desired gap length and not bothering with sections that obviously won’t net a coin. So the largest prime value(times 3) would ideally stop just short of the end of the sieve.

So here is where a bit of math leg work comes in if you want to be precise. Absolute value of 33554432/3 is 11184810. The first prime less than that is 11184799. 11184799*3 is 33554397 which fits nicely near the top of the seive. A check of bigprimes.net shows it as the 737948th prime and thus the number of primes for shift 25.

Can someone verify if this logic is correct? I think the default primes is 500000, Maybe it could be more efficient? Also we could build a table of primes for different shift values, perhaps blocks would be found faster if everyone wasn’t trying to scan 2^25 at the same time on each round.
Since revision 4, the default values are the same as from dcct’s mod:
Code:
--shift 25 --sieve-primes 900000 --sieve-size 33554432
In the beginning, we sieve with the first n primes. For the first 2063689 primes, every prime eliminates at least one candidate in the sieve. For the primes behind that point, the possibility for eliminating a prime candidate in the sieve decreases.

After sieving, the remaining prime candidates are scanned for prime gaps. When a prime is found while scanning the gap, the whole gap is skipped and the miner scans the next possible gap in the sieve.

A more detailed description can be found here: https://github.com/gapcoin/Gapcoin-PoWCore
Compilation
168 2014-06-27, 16:39:37
Update:
  • PoW code rewritten form simple proof of concept C to object oriented readable C++.
  • Code integration started with bitcoin v0.9.2rc2, looks good so far.
153 2014-10-21, 19:11:34
Source code updated do:
Code:
git pull
if submodule PoWCore doesn’t update, try:
Code:
git submodule foreach git pull -u origin master
or:
Code:
git submodule update
138 2014-10-23, 21:43:55
RPC-Miner (Linux binaries): https://github.com/gapcoin/GapMiner/releases/download/linux-binary/gapminer-linux.zip
md5: 1e32c9c0672b5af024b26600c0784b8c
Released gapminer linux binaries, windows will follow.
Miner compiled by me on Intel for Linux, did not work for AMD. When I compiled on AMD all was adjusted.
When you compile the miner on your own it uses spectial compile flags for tuning, like:
Code:
-march=native
"Native" means that the code produced will run only on the CPU which compiled it.

The published binaries were not built with that type of optimation, meaning they will run on both amd and intel.
127 2014-10-25, 22:41:58
The miner simply finishes without errors/messages.
Could you make a valgrind memcheck dump or something similar, to trace back the problem.
029 2015-02-22, 02:18:03
i have problems with gapcoind. If i stop it, then everytime i start it again it looks like it is running but does nothing. I cant connect to rpc server. To fix that i have to delete blocks folder from .gapcoin and then redownload whole blockchain which actually takes too much time. Many hours...
Any ideas? Also j0nn9 maybe you could host the blockchain so that we can download most of it? Finally, are you currently working on anything?
That problem was fixed within the new version:

Windows: https://github.com/gapcoin/gapcoin/releases/download/v0.9.2-rev2/gapcoin-rev2-windows.zip
md5: f476544e2b34133d829d585e6b9d3f7a

Linux: https://github.com/gapcoin/gapcoin/releases/download/v0.9.2-rev2/gapcoin-rev2-linux.zip
md5: 50551e97df7cdfd672a66ebf059cee20

The blockchain currently is only about 50MB, the long time it takes is because it verifies every downloaded block. In the first wallet version, every block was verified like it was in Bitcoin, but this takes too much time, so in version 2, Gapcoin uses Primecoin’s way and does not verifiy every already verified block on startup. You can still enable this recheck with the -slowstart switch.
Releases
081 2014-11-13, 02:20:49
Modded CPU-Miner (by dcct, about 10x faster):

Windows: https://github.com/gapcoin/GapMiner/releases/download/dcct-mod/windows.zip
md5: d8b7f82ef2e325f7feff1b2630e21849

Linux: https://github.com/gapcoin/GapMiner/releases/download/dcct-mod/linux.zip
md5: 15999a95ed79174c83c92827884ee8b6

Source Code: https://bchain.info/gapminer_dcct_mod.zip
042 2015-01-09, 07:08:10
New Wallet Release

Windows: https://github.com/gapcoin/gapcoin/releases/download/v0.9.2-rev2/gapcoin-rev2-windows.zip
md5: f476544e2b34133d829d585e6b9d3f7a

Linux: https://github.com/gapcoin/gapcoin/releases/download/v0.9.2-rev2/gapcoin-rev2-linux.zip
md5: 50551e97df7cdfd672a66ebf059cee20

Changes:

  • Inclusion of the new Logos into the Qt-Wallet
  • Improved startup time
  • Merged dcct’s mod for the build in miner
  • Changed getmininginfo rpc-call output
  • Set max shift to 1024 to protect some attacks using a high shift
Miners & parameters
140 2014-10-23, 20:46:38
Is there any indication how long it should take to get soime coins? I.e. after mining x hours at 20000 primespersec you should find a block? Or is it just totally random? There are people in the richlist that have 100+ coins. How did they manage to do that?
Theoretically you will find a gap with merit m (~difficulty) within e^m prime gaps: e^20.45 = 760890487, so you will need to calculate about 760890487 primes to find a new block.

If your primes per second are 25000 then you will need 760890487/25000 = 30435 seconds, which are about 8:30 hours. So you will find ~2.8 blocks per day.
122 2014-10-27, 21:58:35
just wondering if someone could tell me what a few of those lines mean like "seivesize" "seiveprimes" and "pooledtx"
"blocks" : 3778,
"currentblocksize" : 1000,
"currentblocktx" : 0,
"difficulty" : 20.82454605,
"errors" : "",
"generate" : true,
"genproclimit" : -1,
"sievesize" : 1048576,
"sieveprimes" : 500000,
"shift" : 20,
"primespersec" : 15617,
"10gapsperhour" : 0.00000000,
"15gapsperhour" : 0.00000000,
"gapsperday" : 1.21937143,
"networkprimesps" : 7571792,
"pooledtx" : 0
  • sievesize is the size of the sieve used for prime search, this should be not greater than 2^shift
  • 256 + shift is the bit size of the prime you are searching for, shift have to be greater than 13.
  • sieveprimes is the number of primes you sieve. The more primes you sieve, the less prime tests you have to calculate. But to much sieve primes will also slow down mining.
  • pooledtx is the number of transactions in the memory pool
109 2014-10-30, 20:08:23
Quote
In Gapcoin,
- what happens to the reward when difficulty gets down?
- why is it easier to create a pool in Gapcoin than in Primecoin?
I’ve read http://www.gapcoin.org/, but did not get my answers
Thanks
This is from peercoin/primecoin forum.
So j0nn9 what are the answers? I know that reward also gets down but what about the second question?
When mining Primecoin, you can easily “betray” the pool by modifying your miner to search only for smaller prime chains. With Gapcoin, this is not possible.

In detail:

When you searching for prime chains, you use a sieve for filtering prime candidates. If you search for a 10 chain, you sieve 10 times and eliminate all prime chain candidates that are smaller than 10. The primecoin pool then for example credits you for submitted 10-chain candidates that are only 7,8 or 9-chains.

If you now sieve only 7 times, you will get a lot more 7-chain candidates. Not only is your calculating effort less, you will also find 7-chains that would not have been 10 chain candidates. The important point is, your chance of finding 10 chains drops while your chances of finding 7 chains rises.

Pool operators have to implement something to handle such "betrayers". With Gapcoin you don’t have this additional effort.
GPU miner
105 2014-11-04, 22:36:42
Hi there,

just wanted to inform you, that I started working on a GPU miner. At the moment i can’t say how long it will take. Just playing around with eXtremal’s (madMAx’s) code. Till now, the results are pretty promising: On a R9 280 the fermat test gives a 30x - 40x speed increase in comparison to a single cpu core and gmp.

The sieve in Gapcoin only runs about 2-3% of the time, so at the moment I will only port the primality testing to the GPU. And of course I will open source it, once it’s finished.

Thanks for all your great support so far, I will keep you informed about the process.

j0nn9
102 2014-11-07, 04:56:04
Hi there,

i’ve managed to build a experimental gpu miner. It got me about 200,000 pps with one R9 280x without any overclocking or powertune. Currently the miner is very experimental and needs to be tested, therefore I published the source code on github. The miner is a hybrid version of eXtremal’s fermat test and GapMiner’s sieve. The sieving is calculated on the cpu and the fermat tests are running on the GPU. Currently it is very (host) memory hungry about 1GB and you have to use one instance per gpu device.

You can get it with:
Code:
git clone https://github.com/gapcoin/GapMiner.git -b gpu-miner
cd GapMiner
git submodule init
git submodule update

It was built against amd app sdk v2.9 but maybe works with other versions too. You can edit the Makefile to change the sdk destination directory.

I will merge nonce-pools stratum changes, and probably fix some bugs at the weekend, and then create some binaries within the next week.
098 2014-11-08, 10:27:50
I got 3x290 and it seems work fine but than after some time the speed starts decreasing in 400 times. It’s solo mining.
The Miner currently uses the cpu for sieving, and is very memory hungry, maybe you run out of memory and parts of the program where moved onto the disk (pagefile).

The memory consumption is so high, because a very lage sieve is used, with many primes, and also a queue is used to keep the cpu busy while the gpu is processing the fermat tests. You can alter a few parameters to reduce the memory load:

Code:
  -s  --sieve-size        the prime sieve size
  -w  --work-items        gpu work items (default 2048)
  -a  --max-primes        maximum sieve primes (for use with gpu)
  -z  --queue-size        the gpu waiting queue size (memory intensive)
The Sieve dynamically adjusts the sieve primes, so that it opimaly generaets a new set of prime candidates while the gpu is testing a previous set. The queue must have a minimum size of 2.
096 2014-11-09, 15:53:26
What are the optimal parameters

  -s  --sieve-size        the prime sieve size
  -w  --work-items        gpu work items (default 2048)
  -a  --max-primes        maximum sieve primes (for use with gpu)
  -z  --queue-size        the gpu waiting queue size (memory intensive)
The current parameters should be pretty optimal. To give you a range:

Code:
-s   form 100,000 to 100,000,000 default 15,000,000
-w   from  32 to 32000 default 2048
-a   from  1,000,000 to  100,000,000 default 30,000,000
-z   from 2 to 30 default 10
095 2014-11-09, 16:30:43
Dev Is it possible to reduce the load on the processor Angry
Currently only the primality testing runs on the GPU, the sieving still runs on the CPU. Although it is possible to port the sieve to the GPU, it will probably take more time. I could reuse eXtremal’s fermat test almost without any changes, but since Primecoin and Gapcoin’s sieving differs it will need a more deeper look into the opencl code.
089 2014-11-11, 01:09:18
What could be wrong? I’m mining it with CPU and it’s all right..
Maybe too much work at once for the gpu.

You could try to change some of these parameters, I would start to try -w 256
Code:
-s   form 100,000 to 100,000,000 default 15,000,000
-w   from  32 to 32000 default 2048
-a   from  1,000,000 to  100,000,000 default 30,000,000
-z   from 2 to 30 default 10
072 2014-11-20, 22:45:36
@j0nn9, is it possible to realize improvement of dcct for the GPU-miner?
I’m not sure whether it is possible. I’ve been trying the last few days to get something running, but since dcct’s improvements are for the sieve, which currently runs on the cpu, I didn’t got a solution which was really faster than the current gpu miner.

The problem is, that Gapcoin’s sieve probably can’t be ported to the gpu without a huge speed reduction. I already tried only scanning the sieve on the gpu, splitting it in several pieces for each gpu thread, but that reduced the overall speed about 1000x it’s just so that memory is a bottleneck on the gpu.

But I’m not yet out of ideas
067 2014-12-03, 01:50:02
Hi there,

just wanted to give a little status update on the GPU-Miner.

My current idea is to divide the sieve into parts of the required gap size, then apply dcct’s strategy to each of those parts, by start testing prime candidates from the end of the part and skipping those parts which have a prime in it.

One problem is, that you have to store the first found prime (if there is one) from the previous part in the current part, to efficiently scan the whole sieve. This and some other related problems lead into very difficult code.

Currently it’s produce invalid results most of the time, but I still think that it will give a reasonable speed increase to be worth the effort.

065 2014-12-05, 05:31:27
Improved GPU-Miner (experimental):

Windows: https://github.com/gapcoin/GapMiner/releases/download/gpu-miner-rev3/windows.zip
md5: 6e0fa4a4331c3758bec1fc74334aa753

Linux: https://github.com/gapcoin/GapMiner/releases/download/gpu-miner-rev3/linux.zip
md5: 85bb6f69b22de5e51388155e7b532195

Source Code: https://github.com/gapcoin/GapMiner (branch gpu-miner)

The Miner is still a bit buggy, but it produced good results for the last few hours, so I decided to release a test version.

About the speed: I managed to get around 1,200,000 pps with a single AMD R9 280, that’s a 6x speed increase to the previous GPU-Miner. I could also reduce the memory load. Only the Sieve still runs on the CPU. Also the 10 and 15 gaps per hour are replaced with tests per second, which are the number of primality tests calculated per second.

The algorithm:

The sieve is splitted into parts of the required gap size, then simultaneously, the prime candidates from each part are tested, starting from the end of the part and skipping those parts which have a prime in it.

When using the -e switch you’ll get an info about the current average number of prime candidates of those parts (candidates which are not tested yet). Also the minimum number of prime candidates to test are listed.

In one gpu run, several candidates from each part are tested, you can control these number with -n

Debugging:

For debugging there are two options added to the Makefile, one for debugging while mining, these are some tests, which shouldn’t have a great impact on the pps and one for debugging only. Activating the second option will run several time intensive tests while mining, which has a huge impact on the pps.
027 2015-03-13, 23:54:25
@j0nn9 - Any new performance improvements coming or nvidia miner?
Since i don’t have any Nvidia cards, I’m not capable of porting the miner to Nvidia.

I tried a lot to improve the cpu-miner by using the Chinese Reminder Theorem, but it seems that Gapcoin’s restriction on the prime numbers make it impossible to use the full potential of this method, so the current method is still faster.

From my point of view, the miner is probable at the performance limit, but maybe someone else does have some smart Ideas.
Chinese Remainder Theorem
056 2014-12-16, 17:20:29
Hi there,

I just want to inform you that Gapcoin just broke 544 records of first known occurrence prime gaps. The records are listed here: http://www.trnicely.net/gaps/g4k.html and http://www.trnicely.net/gaps/g6k.html

Even if we are currently a few of steps away from the world record of the highest merit primegap, I’m pretty sure Gapcoin can break some more records on those lists. All gaps found by the Gapcoin network can be download either as plaintext or zip from the website (http://gapcoin.org/downloads.php). The files are updated every hour.

I’m currently working on a method (involving Chinese remainder theorem) to improve the mining algorithm. (I’m not really sure if it can be applied to Gapcoin’s mining algorithm, but I’ll keep trying). I’ll also working on a tool for parsing and processing Gapcoins prime gaps. (both will be released here, when finished)
027 2015-03-13, 23:54:25
@j0nn9 - Any new performance improvements coming or nvidia miner?

Since i don’t have any Nvidia cards, I’m not capable of porting the miner to Nvidia.

I tried a lot to improve the cpu-miner by using the Chinese Reminder Theorem, but it seems that Gapcoin’s restriction on the prime numbers make it impossible to use the full potential of this method, so the current method is still faster.

From my point of view, the miner is probable at the performance limit, but maybe someone else does have some smart Ideas.
026 2015-04-21, 22:50:01
Hi there,

It’s nice to see that some of you using higher shifts to find new records.

Im currently working on new version of the Miner wich should speed up mining with higher shift by using the Chinese Reminder Theorem (CRT).

I tried long to improve mining by using the CRT, but couldn’t find a solution with gives a real speed improve. The thing is, to improve the mining speed with the CRT you have to use an higher shift, as higher the shift as bigger the improvement you make by using the CRT. But with higher shift the mining speed also decreases, so that you make no big improvement at all.

But if you targeting higher shifts anyway, than the CRT could make a difference!
I’m currently testing my implementation within testnet, but It will still probably take some time till it’s ready. Just wanted to let you know, that I’m working on something.

I also want to thank you all for the great support from all of you!
023 2015-05-05, 22:59:01
New experimental GapMiner release (CPU only)

Revision 5: capable of using the Chinese Remainder Theorem to speed up mining with large shift.

windows: https://github.com/gapcoin/GapMiner/releases/download/crt-rev5/gapminer-windows-rev5.zip
md5: dbae859b1e8825f4f9b3f693004833c4

linux: https://github.com/gapcoin/GapMiner/releases/download/crt-rev5/gapminer-linux-rev5.zip
md5: 909f7fcb141a23d60b04ba8c0df1f391

source code: https://github.com/gapcoin/GapMiner/archive/crt-rev5.zip
source code PoWCore: https://github.com/gapcoin/Gapcoin-PoWCore/archive/master.zip

The usage should be pretty self explaining from the start-gapminer file. There are different CRT files containing values optimized for a specific shift.

There are 3 new verbose outputs:
  • gaps/s: The amount of gaps scanned per second
  • gaplist: The number of sieved gaps ready for scanning
  • block: The percent of the calculation amount of an average block
The primes per second and the block percent values are estimated using the theoretical speed improve from the CRT, so they don’t have to be correct.

Mining with the CRT is optimized for solo mining. You can mine at the pool, but you will probably mine less shares, and the pps and block values are probably incorrect, but your chance of finding a block is almost the same as when mining solo.

Mining with the CRT is splitted in sieve and primality testing using separate threads for each:
Code:
--threads 4 --fermat-threads 1
means: 3 sieve and 1 gap scan thread. So you have to use at least 2 threads.

The scan threads always pick the most promising gap from the gaplist, therefore the gaplist value should always be at least over 100, but a too high gaplist value can slow down mining, (for example over 9000). You can alter --sieve-primes, --threads or --fermat-threads to achieve this. (--sieve-size is not used for CRT mining) FYI: The gaplist is implemented as an heap

The is also an logging version, which produces additional output in a gapminer.log file. If something goes wrong, you can switch versions, and look whats wrong, or at least give feedback.
009 2015-06-26, 18:30:28
CTR GapMiner Update

New Feature: Creating custom “ctr” files

The CTR algorithm is divided into 2 parts. The first part is a simple greedy algorithm which tries to find offsets for each involved prime, so that the desired number range has at least prime candidates as possible.

The second part is an evolutionary algorithm, which tries to improve the results from the greedy algorithm. Therefore the greedy algorithm will be executed several times with slightly different parameters to produce ctrs which differs in quality, which than can be used by the evolutionary algorithm.

The output is a text file which can be used by gapminer as an input for ctr sieving.

Parameter description:

Code:
--calc-ctr          Indicates that we want to calculate a ctr file.

--ctr-strength      This is used to variate the computing time spend
                    within the greedy algorithm. Higher strength
                    can yield better results.

--ctr-primes        The number of primes to use in the ctr file. The more
                    primes the better the ctr result, but the shift
                    also increases. Minimum shift can be calculated as
                    the binary logarithm of the product of all primes:
                    log2(p1 * p2 * ... *pn).

--ctr-evolution     Whether to use the evolutionary algorithm or not.

--ctr-fixed         This number indicates the number of starting primes
                    which wound get touched by the evolutionary algorithm
                    the offsets for the primes 2,3,5,7,11... are mostly
                    perfect computed by the greedy algorithm, and changing
                    them only declines the result.

--ctr-ivs           The number of individuals used in the evolutionary algorithm.
                    More increases computing time but mostly also the
                    result quality.

--ctr-range         Percent deviation from the number of primes.
                    Useful if you don’t want to look for a specific number
                    of primes.

--ctr-bits          The shift value you later use for sieving has to be greater
                    than log2(p1*p2*..*pn). With this flag you can fine tune a specific
                    shift by setting this to shift - log2(p1*p2*..*pn).

--ctr-merit         The target merit (while testing the ctr it seamed that
                    sieving for target-merit - 1 yields the best results)

--ctr-file          The target ctr output file. You can open this with a
                    text editor. Look for the n_candidates value, the smaller
                    it is the better the ctr file.


windows: https://github.com/gapcoin/GapMiner/releases/download/crt-rev5.1/windows.zip
md5: 50b506c6fdacbe36dd2d87e6f2c296d9

linux: https://github.com/gapcoin/GapMiner/releases/download/crt-rev5.1/linux.zip
md5: 88f0a3975df728566d3500b69475a78a

source code: https://github.com/gapcoin/GapMiner/
008 2015-06-27, 15:36:27
Trying the new miner and generating a new crt file.  Can you post an example command to mine after the ctr file is generated? Do we still use --sieve-primes? Is ctr-evolution used in the ctr generation and the mining command?
ctr-evolution and ctr-primes are only necessary for generating the ctr file. --sieve-primes will still be used for mining.

Mining still works the same way as in the previous ctr-miner version:

Code:
./gapminer-cpu localhost -p 31397 -u <rpc-user> -x <rpc-password> --shift 1024 --crt my-ctr-file.txt --threads 4 --fermat-threads 1
003 2015-07-07, 21:51:04
I’m not sure the table for --ctr-bits is fixed.

Example:
If you want to generate a file for shift 384
ctr-primes = 58
ctr-bits = shift - log2(p1*p2*..*pn) - 256
...
ctr-bits = 384 - log2(58#) - 256
...
ctr-bits = 384 -64 - 256 = 64
Yet the table shows the ctr-bits set to 16 for primes=58.
It’s:
ctr-bits = shift - log2(p1*p2*..*pn)
...
ctr-bits = 384 - log2(58#)
...
ctr-bits = 384 - 368 = 16

The ctr-bits in the original file were erronously set 256 bits too high.
RPC
144 2014-10-22, 21:41:49
Hey guys,
Question,
Is there any way to tweak the sievesize and sieveprimes  from the command line or the config file?
And if there is, what would be some good values to test ?
thanks

You can use the setgenerate rpc call:

Code:
setgenerate generate ( genproclimit ) ( sievesize ) ( sieveprimes ) ( shift )

Set ’generate’ true or false to turn generation on or off.
Generation is limited to ’genproclimit’ processors, -1 is unlimited.
See the getgenerate call for the current setting.

Arguments:
1. generate         (boolean, required) Set to true to turn on generation, off to turn off.
2. genproclimit     (numeric, optional) Set the processor limit for when generation is on. Can be -1 for unlimited.
                    Note: in -regtest mode, genproclimit controls how many blocks are generated immediately.
3. sievesize        (numeric, optional) Sets the size of the prime sieve.
4. sieveprimes      (numeric, optional) Sets the amount of primes used in the sieve.
5. shift            (numeric, optional) Sets the header shift.
                    Note: sieve size can only have 2^shift size.

Note: shift also should be in range [14, 512]. Shift, should be the most sensitive parameter because it controls the bit size of the primes. Second would be sieve primes.
142 2014-10-22, 23:38:27
Almost forgot to mention, Gapcoin has two new RPC calls:

Code:
listbestprimes amount (min merit)

Returns a sorted list of the best prime gap merits.

Arguments:
1. amount        (numeric). number of prime gaps to display
2. merit         (numeric, default = 16). minimum merit to display
Code:
listprimerecords merit

Returns a list of all prime gaps with the given integer merit.

Arguments:
1. merit        (numeric 1,2,3..) the prime gap merit.

Note: The above rpc-calls can take a long time to respond.
140 2014-10-23, 20:46:38
Is there any indication how long it should take to get soime coins? I.e. after mining x hours at 20000 primespersec you should find a block?
Or is it just totally random? There are people in the richlist that have 100+ coins. How did they manage to do that?

If your primes per second are 25000 then you will need 760890487/25000 = 30435 seconds, which are about 8:30 hours.
So you will finde ~ 2.8 blocks per day.

The rpc-call getmininginfo has a new value called gapsperday, which is calculated using the above formula.
137 2014-10-23, 22:45:51

One question about the algo and the records. So we have to reach  35.4245 difficulty.
Does that means that if hashrate never gets bigger we wont find record prime gaps?Even if we mine for much more time?
What  hashrate should the network have  so that we can reach that difficulty? I want to realize how fast we can actually reach that. Will it take some months or a year or 10 years?

Of course i understand that better miners will come out and pools will help but i want to have a comparison.

It’s not neccesary that the difficulty reaches 35.4245, we already have two ~28 merit gaps:

Code:
[
    {
        "time" : "2014-10-21 19:41:01 UTC",
        "epoch" : 1413920461,
        "height" : 240,
        "ismine" : false,
        "mineraddress" : "GXk8PfPwuDXQN5iQAypQFmS1LxArXtfY2L",
        "gapstart" : "67692237123843296659418251254586218470394655850041287301830823121119920971930198957",
        "gapend" : "67692237123843296659418251254586218470394655850041287301830823121119920971930204303",
        "gaplen" : 5346,
        "merit" : 28.02997943
    },
    {
        "time" : "2014-10-22 06:07:49 UTC",
        "epoch" : 1413958069,
        "height" : 737,
        "ismine" : false,
        "mineraddress" : "Gcagtj5wCDHai4tJqJqTLTFwLBDaJnAA5u",
        "gapstart" : "94715185144650972004538857957041135176651988819124169310707053830636479917687941569",
        "gapend" : "94715185144650972004538857957041135176651988819124169310707053830636479917687947043",
        "gaplen" : 5474,
        "merit" : 28.65064563
    }
]

You can use the "listbestprimes" rpc-call to list the gaps with the currently greatest merit.

Within the test networks the greatest merits were mostly about 9 times greater than the difficulty, so we hopefully only need to reach a difficulty of 27.
2015 hardware performance comparison

archive.org’s December 08 2015 capture of gapcoin.org web site’s “Hardware comparison” page

Gapcoin - Mining hardware comparison.

ModelppsWattsClockCoresMinerOperating SystemNotes
Intel 2600K743215200 W (from the wall outlet)44004GapMiner (modded by dcct)Windows 7 x64
Phenom II x6 1055t3500001253.2Ghz6dcct modded cpu minerWindows 8.1 Pro 64-bitStock clocks
Intel Core i5-2500K3460003.3 GHz4GapMiner (dcct's mod)Arch Linux 64 bit
Gigabyte HD 7970 GHz Edition330000n/a1150/15001experimental gpu minerWindows 7 (64 bit)CPU AMD FX 8120
Gigabyte R9 280X300000n/a1150/15001experimental gpu minerWindows 7 (64 bit)CPU AMD FX 8120
Radeon HD7970275000N/A1150/15001experimental gpu minerWindows 8.1 Pro 64-bitOverclock from stock clocks of 1050/1375
R9 270x (Asus)180000n/a1150/14001experimental gpu minerWindows 7 (64 bit)CPU AMD FX 8120
IMB Power8 2 XL1210005 GHZ176 THGapcoindLinux
A10-4655M108000252.2Ghz4GapMiner (modded by dcct)Windows 8.1 64bit
i7-3930K550003.20GHz6 (12HT)GapMiner (w/ 20%patch)Linux
Xeon E5650 x 25350095x23.06 GHz12/24HTGapMinerLinux x 64 (32GB RAM)stock
Intel Xeon E5 1650 V247900130 TDP3.5 GHz (boost 3.9 GHz)6 (12 HT)GapMinerLinux Ubuntu 64 bit
AMD FX-9590 Black Edition450004.7 GHz8Gapcoin CoreLinux Ubuntu 64 bit
Intel Core i7 3930K450003.2 GHz6 (8 HT of 12)Gapcoin CoreWindows 7 64 bitBIOS Overclocked CPU to 4.1 GHz - 12 HT = 52500+ pps
amd fx8350 black edition410004 GHz8GapMinerWindows 7 64 bitasrock 990extreme3 mainboard
Core i7-47703820084 TDP3.9 GHz4 (8 HT)Gapcoin CoreWindows7 64bit3.9 GHZ all cores; 33200PPS @ 3.4Ghz; 35400PPS @ 3.6Ghz
Xeon E5-2665380002.4 GHz8 (16 HT)GapMiner (noncepool)Windows 8.1 x64-t 7
E3 1230 V23523469 TDP3.5GHz48windows7 64bitTurbo 3.7G
Core i7-3770K3500077 TDP3.5@4.2 GHz4 (8 HT)Gapcoin CoreWindows 8.1setgenerate true 6
i5-4670k34500N/A34004gspminerWindows 7 Sp1Stock
AMD fx8320 black edition341003.5 GHz8Gapcoin CoreWindows 7M5A99X EVO R2.0 - ASUS
AMD fx8320 black edition341003.5 GHz8Gapcoin CoreWindows 7M5A99X EVO R2.0 - ASUS
AMD fx8320 341001253.5 GHz8GapMinerwindows7 64bitasrock 990extreme3
Intel i5-45703300084 TDP3.2 GHz4GapMinerWindows 8.1 x64
i7-4820k320003.7 GHz8Gapcoin CoreLinux Mint
Intel Core i7 3820QM2900045 TDP3.192 GHz4 (8 HT)Gapcoin CoreWindwos
FX 6350275001253.96GapMinerWin 7Stock
8120270002.88GapCoin CoreWin 7 x64
FX 630026000953.5GHz6GapMinerWin 7Stock
Core i5-2500K260004.2 GHz3GapMinerWin 7Overclocked to 4.2GHz (Stock clock speed is 3.3GHz)
Intel Core i5-2500K250003.3 GHz4Gapcoin CoreArch Linux 64 bit
A8-760018500353.1 Ghz4gapminerubuntu
A10-7850K180001003.8 GHZ4GapMinerWin 8.1on FM2+
A10-6800K175974.4 GHz4Gapcoin CoreWindows 7 x64
Phenom II x4 Black Edition175003.6 GHz4GapMinerWindows 8.1 x64Overclocked to 3.6GHz via bios (Stock clock speed is 3.4GHz)
core i3 3240159693.4 GHz2Gapcoin CoreWindows 7
G3220130003.0 GHz2Gapcoin CoreLinux Mint
G16109600552.7 GHZ2GapMinerWin 7
Intel Core i3-210059003.1 GHz2 (4 HT)GapMinerLinux Ubuntu
E5-2630L (1 virtual core)53002.4 Ghz1GapMinerLinuxDigital Ocean 5$ droplet
Sempron 1454500452.81GapMinerWindows 7 64bit
Intel Core i3 350M360025 TDP2.27 GHz2 (4 HT)GapMinerWindows
Pentium(R) G62035002.6 GHZ2Gapcoin CoreWindows 7
Celeron(R) CPU 1000M23501.80GHZ2Gapcoin CoreWindows 7