I hope you can help me with understanding how primecoin works. So far the actual knowledge I’m looking for is not on the wiki, the original white paper, or asked anywhere else, and this is pretty much my last stop before I start digging though the source code and trying to understand what is going on.
In my interest in understanding how primecoin works, I want to write my own miner. This will most likely start with a CPU affair, and be slower than the official, but hopefully it will help me understand how the whole thing works.
So, based on my understanding (and please, correct me if I am wrong), the primecoin algorithm works something like this:
- You get a range of numbers, say 1-100
- You then find out which ones in that range are prime numbers
- Then you see which ones fulfill the requirements to be classed as a Cunningham chain (sequence of primes, that follow 2p+1)
- The length of the chain is your difficulty (so e.g. if the difficulty is 5, you have to find a Cunningham chain of 5 primes).
- This chain (once it meets the difficulty) is what is submitted to the network as proof of work.
Is the above correct? If it is, then to discover such a chain, I need two inputs:
- The range of numbers within which to search for primes
- The target chain length (difficulty)
However when I connect to the primecoin server, and issue a getwork command, I get this:
Which is the same format as the original BTC network. Now, out the above, what does it mean? Is there a protocol description somewhere? What is the range I need to search in, and what it the chain length I need to find? What is midstate and target in this context?
Or have I just misunderstood the algorithm completely?
Any helps/tips/pointers are appreciated