Primecoin mining explain

I am stuck with understanding the C++ code of the miner (official and alternative ones too).
I’ve searched for a good explanation of what is miner doing but the only I’ve found is that paper on primecoin, which is comprehensive at all and just puts on a general idea.

I know that miner is searching for Cunningham/Bi-twin chains. But what are restrictions to that chains? should primes start with given prefix (hash)? or is there just some range given to search in? what chain length is accepted? why is there two prime tests in code (Fermat and EulerLagrangeLifchitz)? why not miller-rabin test? what primorial is needed for?

I think it’s not very good there’s no quite full explanation of mining XPM, because it slows down development of alternative miners and overall spreading of the primecoin.

For example bitcoin has great python miner implementation ( ). It’s surely slow but it allows to understand mining bitcoins.

Hope someone will explain the main ideas about that.


The paper clearly states that the prime chain origin must be divisible by the block header hash (see “Non-Reusability of Proof-of-Work”).
The chain length needed to solve a block is determined by the difficulty, which is slightly adjusted every block. Current difficulty is about 9.9327, which means that the shortest chain length that might solve a block is 9. See “Difficulty Adjustability of Proof-of-Work” for a full explanation of the difficulty calculation.
Note that through pooled mining you don’t need to met the block difficulty, instead the pool decides what’s the lowest chain difficulty they want to reward.

Excuse me, please. I am a newbie in cryptocurrency and so one. Im not free in C/C++ code. But I wrote well-working generator of Cunningham chains. Now I wont to create fully working XPM miner.But I have no information about next: -structure of blocks; -what is share; -what data I must to send to -and so one. If somebody can explain it "for dummies", this thread will be really "How-To"&FAQ together. But now I cant find any information and start to think Google is banned for me. Please, help me!

Send a DM to either mikaelh, mhps, or xolokram, or even Sunny King.
I hope they will respond.