Primecoin High Performance

This is Primecoin High Performance, a Primecoin wallet with high-performance miner built-in. Only solo mining is supported. For pooled mining, seebeeeeer.org. The main Primecoin thread is here.
Features:
* Extended sieve algorithm
* Cache-friendly segmented sieve
* Adjustable sieve parameters
* Mining threads use GMP for faster bignum arithmetic
Changelog:
Changes in -hp2:
* Restored sieve size to 1,000,000. Quick runs on the testnet show significantly increased probable prime chain rate. Thanks to the numerous people who pointed this out.
Changes in -hp3:
* Added a new tuning parameter "sievesize". Default value is 1M, minimum is 100k, maximum is 10M.
* Some other minor performance improvements
* Merged two pull requests from geeknik that eliminate references to "Bitcoin"
Changes in -hp4:
* Added more L1 and L2 cache optimizations
* Some other minor performance improvements (including a change originally by luke-jr)
* New experimental performance metric 5-chains/h in debug.log
Changes in -hp5:
* Added a faster 32-bit routine for inverting numbers
* Other minor performance improvements to the sieve
Changes in -hp6:
* Added fast divisibility tests before doing the expensive Fermat's test
* Lots of other small optimizations
* Introduced a new experimental tuning parameter "sievepercentage". Default value is 10, minimum is 1, maximum is 100.
* Added new RPC command "getchainspermin"
* Added the following information to "getmininginfo": chainspermin, difficulty, sievepercentage, and sievesize
* Attempt to fix the random crash while mining
Changes in -hp7:
* IMPORTANT: Sunny King's fix for mining large block sizes
* Small performance improvement to the sieve
Changes in -hp8:
* IMPORTANT: Fixed loss of potential blocks caused by fractional length calculation being skipped if fast divisibility test succeeds. (Thanks to mtrlt for spotting this.)
* Skip fractional length calculation for the first number in a chain (as suggested by gatra).
* Added a new configurable round primorial adjustment system.
* Round primorial can be adjusted through the -roundsievepercentage parameter (default value is 30, minimum is 1, maximum is 100). The parameter depends how much time is spent running the sieve. By default 30% of time is spent in the sieve and 70% is spent on checking the candidates produced by the sieve.
* Lots of other performance improvements.
* Bigger sieve sizes should no longer crash on Windows.
* Added new RPC commands setsievepercentage and setroundsievepercentage for changing parameters on the fly.
* GMP is now included as a separate library in the binary releases.
Changes in -hp9:
* Sunny's mining optimizations from 0.1.2.
* Minor mining optimizations from mtrlt and gatra.
* Small sieve optimizations for 32-bit processors.
* Sunny's new chains/day estimate.
* Sunny's new 'listprimerecords' RPC command.
* New default value for roundsievepercentage is 70 on mainnet (better chains/day, equal 5-chains/h).
Changes in -hp10: (ann)
* Major rewrite of the sieve to support extending the sieve (originally implemented by jh000).
* Added a new parameter 'sieveextensions' which controls how many times the sieve is extended.
* Removed the problematic and unnecessary fast-division test.
* Changed the value of nL1CacheElements to 224000 which is slightly faster (thanks to nushor on IRC).
* The 'roundsievepercentage' parameter is gone. The round primorial is now automatically adjusted.
* New RPC command 'listtopprimes' by Sunny.
Changes in -hp11: (ann)
* Fixed a bug in the BiTwin filter that was inflating the chains/day estimate and reducing the chances of finding a block (thanks to rdebourbon).
* Slightly improved the accuracy of the prime probability estimate with regards to the 'sieveextensions' parameter.
* Changed the default value of 'sieveextensions' to 9.
* Other small fixes and improvements from cabin.
Windows x64 binaries
http://sourceforge.net/projects/primecoin-hp/files/0.1.2-hp11/primecoin-0.1.2-hp11-winx64.zip/download
https://mega.co.nz/#!F511ERZD!LmHvfyjFayOIG7cgoRdcogd10GogsoKj4Lz0TPCyt8Q
SHA1SUM: 319d93b07ab71a6ec049bbe9fac10f97120ac2ef
Windows x86 binaries
http://sourceforge.net/projects/primecoin-hp/files/0.1.2-hp11/primecoin-0.1.2-hp11-winx86.zip/download
https://mega.co.nz/#!F4ETFBrB!cHVgBT4r-bJOgAWZf8TorUyPnQpTt9HRNYTMGkIwfSI
SHA1SUM: 9056ef50bb33af1639e2b0c271073639cbc825d8
Linux x64 and x86 binaries
http://sourceforge.net/projects/primecoin-hp/files/0.1.2-hp11/primecoin-0.1.2-hp11-linux.tar.bz2/download
https://mega.co.nz/#!I0MHUAZC!bflKLko0qnO7nM2ZTV9V6lfX_HoxrSpLtBykd2wmykI
SHA1SUM: 7cdf4870fc532a5357f8588ac66ab191f0592b78
Warning to Linux users: My binaries are linked against Berkeley DB 4.8.30. If you have compiled from source before, the database format may be incompatible if you linked against a different version of Berkeley DB. Sunny King's original binaries are linked against Berkeley DB 4.8.24, which should be compatible with my version. Always make sure to backup the database and your wallet before switching builds.
Source code (.tar.bz2)
http://sourceforge.net/projects/primecoin-hp/files/0.1.2-hp11/primecoin-0.1.2-hp11.tar.bz2/download
https://mega.co.nz/#!l4EkiZbI!GSnmJEyL0N4JktHlKnY0Nzl6JL4YP8UzYvRabgM1Axg
SHA1SUM: 3fec6fc6fc4c3673b462df8fcced927ce92590d8
Source code (Git)
https://bitbucket.org/mikaelh/primecoin-hp
https://github.com/mikaelh2/primecoin
Please use the SourceForge link for downloading the source code to ease the load on the repository.
Older releases are stored on SourceForge:
https://sourceforge.net/projects/primecoin-hp/files/
Tutorials
[Tutorial] Primecoin Getting Started and Basic Commands
**Quick Guide!** - How to mine Primecoin
[XPM] Primecoin High Performance Linux Compilation Guide
Configuration
Sample config file for automatic mining:

# Enable JSON-RPC commands to be received
server=1
# Username and password for JSON-RPC
rpcuser=primecoinrpc
rpcpassword=PASSWORD
# IP restriction for JSON-RPC
rpcallowip=127.0.0.1
# Start mining automatically
gen=1
# An extra seednode to help getting connected to the network
seednode=primeseed.muuttuja.org
# Tuning parameters
#sievesize=1000000
#sievepercentage=10
#sieveextensions=9

Save the file as primecoin.conf in %APPDATA%\Primecoin (for Windows users) or $HOME/.primecoin (for Linux users).

 

FAQ
Q: How many blocks should I expect to find?
A: My current formula for turning chains/day into blocks/day is as follows:
blocks/day = chains/day * (0.97 * (1 - fracDiff) + 0.03)
Here fracDiff is the fractional part of the mining difficulty (i.e. fracDiff = diff - floor(diff)). The 'getmininginfo' command will show both the chains/day value and the difficulty.
Q: Is this compatible with the original client? Can I replace primecoin-qt/primecoind with this release?
A: Yes, the Windows builds should be compatible with the original client. It uses Berkeley DB version 4.8 so the database format should be the same.
Q: Why is the client crashing with the following message?
Assertion failed!
File: src/checkqueue.h, line 171
Expression: pqueue->nTotal == pqueue-> nIdle
A: This is a known bug which is present both in this version and the original Primecoin wallet. A workaround is to use a script or a cron job to automatically restart the wallet.
Q: How can I fix the client crashing on every startup?
A: Try deleting all database files except wallet.dat.
Q: Where is the config file located?
A: Windows users: The configuration file should be located in the %APPDATA%\Primecoin folder.
Linux users: Configuration file is located inside the ~/.primecoin directory.
The configuration file is not created by default. If it does not exist, simply create a new text file and save it as primecoin.conf.
Q: What are the optimal sieve parameters?
A: The default values should be good for most people. If you want to further optimize them, adjust them one-by-one and compare chains/day.
Q: Why is my performance worse on Linux?
A: This version relies on libgmp to do most of the complex calculations. Make sure your libgmp is up-to-date. Old versions do not support newer CPUs. I suggest compiling your own libgmp from latest source code for maximum performance.
Q: Why has my prime rate dropped after updating?
A: There are two common cases why primes/s can drop:
1. You downloaded the 32-bit version which is slower. Use the 64-bit version if possible.
2. Network difficulty has changed. Prime rate goes down when the integer part of the difficulty changes (i.e. going from 8.xx to 9.xx). It's a feature of the mining algorithm and nothing can be done about it.
Otherwise please make a post wiith system information (especially CPU model), operating system version and miner version.
Q: What is the chains/day estimate?
A: Short version: https://bitcointalk.org/index.php?topic=255782.msg2847844#msg2847844
Longer version: https://bitcointalk.org/index.php?topic=255782.msg2848092#msg2848092
Q: How do I solve a problem with the client not being able to synchronize or connect to any nodes?
A: Try adding this line to your primecoin.conf file:

Code:

seednode=primeseed.muuttuja.org

Also check that your firewall allows outgoing connections to other nodes. You may also allow incoming connections if you want. The default port used by Primecoin is 9911 (TCP).