CGMiner Help Manual

Table of Contents

  1. Introduction
  2. Dependencies
  3. Build Options
  4. Usage Instructions
  5. The Display
  6. Multi Pool
  7. Logging
  8. Overclocking
  9. GPU Device Issues and Mapping
  10. FAQ (Frequently Asked Questions)
  11. Mining Scrypt (Litecoins)
  12. Appendices


This is a multi-threaded multi-pool GPU, FPGA and CPU miner with ATI GPU monitoring, (over)clocking and fanspeed support for bitcoin and derivative coins. Do not use on multiple block chains at the same time!

This code is provided entirely free of charge by the programmer in his spare time so donations would be greatly appreciated. Please consider donating to the address below.

Con Kolivas <>




curl dev library

curses dev library
(libncurses5-dev or libpdcurses on WIN32)


(jansson is included in-tree and not necessary)

yasm 1.0.1+
(yasm is optional, gives assembly routines for CPU mining)

(This sdk is mandatory for GPU mining)

(This sdk is mandatory for ATI GPU monitoring & clocking)

libudev headers
(This is only required for FPGA auto-detection and is linux only)

libusb headers
(This is only required for ZTEX support)

Build Options

CGMiner specific configuration options:
	--enable-cpumining      Build with cpu mining support(default disabled)
	--disable-opencl        Override detection and disable building with opencl
	--disable-adl           Override detection and disable building with adl
	--enable-bitforce       Compile support for BitForce FPGAs(default disabled)
	--enable-icarus         Compile support for Icarus Board(default disabled)
	--enable-modminer       Compile support for ModMiner FPGAs(default disabled)
	--enable-ztex           Compile support for Ztex Board(default disabled)
	--enable-scrypt         Compile support for scrypt litecoin mining (default disabled)
	--without-curses        Compile support for curses TUI (default enabled)
	--without-libudev       Autodetect FPGAs using libudev (default enabled)

Basic *nix build instructions:
	To build with GPU mining support:
	Install AMD APP sdk, ideal version (see FAQ!) - no official place to
	install it so just keep track of where it is if you're not installing
	the include files and library files into the system directory.
	(Do NOT install the ati amd sdk if you are on nvidia.)
	To build with GPU monitoring & clocking support:
	Extract the AMD ADL SDK, latest version - there is also no official
	place for these files. Copy all the *.h files in the "include"
	directory into cgminer's ADL_SDK directory.

The easiest way to install the ATI AMD SPP sdk on linux is to actually put it
into a system location. Then building will be simpler. Download the correct
version for either 32 bit or 64 bit from here:

This will give you a file with a name like AMD-APP-SDK-v2.4-lnx64.tgz


sudo su
cd /opt
tar xf /path/to/AMD-APP-SDK-v2.4-lnx64.tgz
cd /
tar xf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz
ln -s /opt/AMD-APP-SDK-v2.4-lnx64/include/CL /usr/include
ln -s /opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/* /usr/lib/

If you are on 32 bit, x86_64 in the 2nd last line should be x86

	To actually build:

	./	# only needed if building from git repo
	CFLAGS="-O2 -Wall -march=native" ./configure
	or if you haven't installed the ati files in system locations:
	CFLAGS="-O2 -Wall -march=native -I<path to AMD APP include>" LDFLAGS="-L<path to AMD APP lib/x86_64> ./configure
	If it finds the opencl files it will inform you with
	"OpenCL: FOUND. GPU mining support enabled."

Basic WIN32 build instructions (LIKELY OUTDATED INFO. requires mingw32):
	./	# only needed if building from git repo
	rm -f mingw32-config.cache
	MINGW32_CFLAGS="-O2 -Wall -msse2" mingw32-configure

For Native WIN32 build instructions: Click Here



Run "cgminer --help" to see these options:

Usage: . [-atDdGCgIKklmpPQqrRsTouvwOchnV]

Options for both config file and command line:

  -single dash is used for a single letter command (case is sensative)
- -double dash for commands with more than one letter, or phrases

Allow API access (if enabled) only to the given list of [W:]IP[/Prefix] address[/subnets]
This overrides --api-network and you must specify if it is required
W: in front of the IP address gives that address privileged access to all api commands
Description placed in the API status header (default: cgminer version)
API one letter groups G:cmd:cmd[,P:cmd:*...]
See API-README for usage
Listen for API requests (default: disabled)
By default any command that does not just display data returns access denied
See --api-allow to overcome this
Allow API (if enabled) to listen on/for any address (default: only
Port number of miner API (default: 4028)
Automatically adjust all GPU fan speeds to maintain a target temperature
Automatically adjust all GPU engine clock speeds to maintain a target temperature
Change multipool strategy from failover to even share balance
Run cgminer in benchmark mode - produces no shares
Use compact display without per device statistics
Enable debug output
--expiry|-E <arg>
Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
Don't leak work to backup pools when primary pool is lagging
Do not redirect to a different getwork protocol (eg. stratum)
--kernel-path|-K <arg>
Specify a path to where bitstream and kernel files are (default: "/usr/local/bin")
Change multipool strategy from failover to efficiency based balance
--log|-l <arg>
Interval in seconds between log output (default: 5)
--monitor|-m <arg>
Use custom pipe cmd for output messages
Impose small delays in networking to not overload slow routers
Do not automatically disable pools that continually reject shares
Do not attempt to restart GPUs that hang or cgminer if it crashes
Don't submit shares if they are detected as stale
--pass|-p <arg>
Password for bitcoin JSON-RPC server
Force verbose mode and output per-device statistics
Verbose dump of protocol-level activities
--queue|-Q <arg>
Minimum number of work items to have queued (0 - 10) (default: 1)
Disable logging output, display status and errors
Disable all output
Remove disabled devices entirely, as if they didn't exist
--rotate <arg>
Change multipool strategy from failover to regularly rotate at N minutes (default: 0)
Change multipool strategy from failover to round robin on failure
--scan-time|-s <arg>
Upper bound on time spent scanning current work, in seconds (default: 60)
--sched-start <arg>
Set a time of day in HH:MM to start mining (a once off without a stop time)
--sched-stop <arg>
Set a time of day in HH:MM to stop mining (will quit without a start time)
Use the scrypt algorithm for mining (litecoin only)
--sharelog <arg>
Append share log to file
--shares <arg>
Quit after mining N shares (default: unlimited)
--socks-proxy <arg>
Set socks4 proxy (host:port) for all pools without a proxy specified
Use system log for output messages (default: standard error)
--temp-cutoff <arg>
Temperature where a device will be automatically disabled, one value or comma separated list (default: 95)
Disable ncurses formatted screen output
--url|-o <arg>
URL for bitcoin JSON-RPC server
--user|-u <arg>
Username for bitcoin JSON-RPC server
Log verbose output to stderr as well as status output
--userpass|-O <arg>
Username:Password pair for bitcoin JSON-RPC server

Options for command line only:

--config|-c <arg>
Load a JSON-format configuration file
See example.conf for an example configuration.
Print this message
Display version and exit

GPU only options:

Automatically adjust all GPU fan speeds to maintain a target temperature
Automatically adjust all GPU engine clock speeds to maintain a target temperature
--device|-d <arg>
Select device to use, (Use repeat -d for multiple devices, default: all)
Disable GPU mining even if suitable devices exist
--gpu-threads|-g <arg>
Number of threads per GPU (1 - 10) (default: 2)
--gpu-dyninterval <arg>
Set the refresh interval in ms for GPUs using dynamic intensity (default: 7)
--gpu-engine <arg>
GPU engine (over)clock range in Mhz - one value, range and/or comma separated list (e.g. 850-900,900,750-850)
--gpu-fan <arg>
GPU fan percentage range - one value, range and/or comma separated list (e.g. 25-85,85,65)
--gpu-map <arg>
Map OpenCL to ADL device order manually, paired CSV (e.g. 1:0,2:1 maps OpenCL 1 to ADL 0, 2 to 1)
--gpu-memclock <arg>
Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card.
--gpu-memdiff <arg>
Set a fixed difference in clock speed between the GPU and memory in auto-gpu mode
--gpu-powertune <arg>
Set the GPU powertune percentage - one value for all or separate by commas for per card.
Attempt to reorder GPU devices according to PCI Bus ID
--gpu-vddc <arg>
Set the GPU voltage in Volts - one value for all or separate by commas for per card.
--intensity|-I <arg>
Intensity of GPU scanning (d or -10 -> 10, default: d to maintain desktop interactivity)
--kernel|-k <arg>
Override kernel to use (diablo, poclbm, phatk or diakgcn) - one value or comma separated
Enumerate number of detected GPUs and exit
--temp-hysteresis <arg>
Set how much the temperature can fluctuate outside limits when automanaging speeds (default: 3)
--temp-overheat <arg>
Overheat temperature when automatically managing fan and GPU speeds (default: 85)
--temp-target <arg>
Target temperature when automatically managing fan and GPU speeds (default: 75)
--vectors|-v <arg>
Override detected optimal vector (1, 2 or 4) - one value or comma separated list
--worksize|-w <arg>
Override detected optimal worksize - one value or comma separated list

SCRYPT only options:

--lookup-gap <arg>
Set GPU lookup gap for scrypt mining, comma separated
--thread-concurrency <arg>
Set GPU thread concurrency for scrypt mining, comma separated

Click Here for more information regarding litecoin mining (scrypt mining)

FPGA mining boards(BitForce, Icarus, ModMiner, Ztex) only options:

--scan-serial|-S <arg>
Serial port to probe for FPGA mining device
This option is only for BitForce, Icarus, and/or ModMiner FPGAs

By default, cgminer will scan for autodetected FPGAs unless at least one -S is specified for that driver. If you specify -S and still want cgminer to scan, you must also use "-S auto". If you want to prevent cgminer from scanning without specifying a device, you can use "-S noauto". Note that presently, autodetection only works on Linux, and might only detect one device depending on the version of udev being used.

On linux <arg> is usually of the format /dev/ttyUSBn
On windows <arg> is usually of the format \\.\COMn
(where n = the correct device number for the FPGA device)

The official supplied binaries are compiled with support for all FPGAs. To force the code to only attempt detection with a specific driver, prepend the argument with the driver name followed by a colon. For example, "icarus:/dev/ttyUSB0" or "bitforce:\\.\COM5" or using the short name: "ica:/dev/ttyUSB0" or "bfl:\\.\COM5"

For other FPGA details Click Here

CPU only options (deprecated, not included in binaries!):

--algo|-a <arg>     Specify sha256 implementation for CPU mining:
        auto            Benchmark at startup and pick fastest algorithm
        c               Linux kernel sha256, implemented in C
        4way            tcatm's 4-way SSE2 implementation
        via             VIA padlock implementation
        cryptopp        Crypto++ C/C++ implementation
        sse2_64         SSE2 64 bit implementation for x86_64 machines
        sse4_64         SSE4.1 64 bit implementation for x86_64 machines (default: sse2_64)
--cpu-threads|-t <arg> Number of miner CPU threads (default: 4)
--enable-cpu|-C     Enable CPU mining with other mining (default: no CPU mining if other devices exist)



After saving configuration from the menu, you do not need to give cgminer any arguments and it will load your configuration.

Any configuration file may also contain a single "include" : "filename" to recursively include another configuration file. Writing the configuration will save all settings from all files in the output.

If you compile cgminer with a version of CURL before 7.19.4 then some of the above will not be available. All are available since CURL version 7.19.4

If you specify the --socks-proxy option to cgminer, it will only be applied to all pools that don't specify their own proxy setting like above


On Linux you virtually always need to export your display settings before starting to get all the cards recognised and/or temperature+clocking working:

export DISPLAY=:0


The Display

This is what the display looks like while running:

 cgminer version 2.8.7 - Started: [2012-11-10 13:39:31]
 (5s):765.2M (avg):740.1Mh/s | Q:37  A:2995  R:3  HW:0  E:8095%  U:163.3/m
 TQ: 0  ST: 4  SS: 49  DW: 18  NB: 7  LW: 160  GF: 2  RF: 0  WU: 166.5
 Connected to localhost with LP as user USER
 Block: 37ba8546fbbfb95497af0cf9...  Started: [13:57:04]  Best share: 13.1M
 [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
 GPU 0:  74.0C 3768RPM | 305.5M/305.7Mh/s | A:1239 R:2 HW:0 U: 67.57/m I:18
 GPU 1:  65.0C 2022RPM | 141.7M/141.1Mh/s | A: 574 R:0 HW:0 U: 31.31/m I:12
 GPU 2:  74.5C 3169RPM | 293.3M/293.3Mh/s | A:1187 R:1 HW:0 U: 64.74/m I:18

 [2012-11-10 13:57:47] Accepted 000000be Diff 344/3 GPU 0 pool 0
 [2012-11-10 13:57:49] Accepted 00001acc Diff 9/3 GPU 0 pool 0
 [2012-11-10 13:57:49] Accepted 00001515 Diff 12/3 GPU 0 pool 0
 [2012-11-10 13:57:49] Accepted 00001915 Diff 10/3 GPU 0 pool 0
 [2012-11-10 13:57:50] Accepted 00002e32 Diff 5/3 GPU 2 pool 0
 [2012-11-10 13:57:50] Accepted 0000327d Diff 5/3 GPU 2 pool 0
 [2012-11-10 13:57:51] Accepted 00001313 Diff 13/3 GPU 1 pool 0
 [2012-11-10 13:57:52] Accepted 00003fd4 Diff 4/3 GPU 1 pool 0
 [2012-11-10 13:57:53] Accepted 00001f3b Diff 8/3 GPU 2 pool 0
 [2012-11-10 13:57:53] Accepted 0000328f Diff 5/3 GPU 2 pool 0
 [2012-11-10 13:57:53] Accepted 0000246a Diff 7/3 GPU 1 pool 0

The following options are available while running with a single keypress:

[P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit

P gives you:

Current pool management strategy: Failover
[F]ailover only disabled
[A]dd pool [R]emove pool [D]isable pool [E]nable pool
[C]hange management strategy [S]witch pool [I]nformation

G gives you something like:

GPU 0: [124.2 / 191.3 Mh/s] [Q:212  A:77  R:33  HW:0  E:36%  U:1.73/m]
Temp: 67.0 C
Fan Speed: 35% (2500 RPM)
Engine Clock: 960 MHz
Memory Clock: 480 Mhz
Vddc: 1.200 V
Activity: 93%
Powertune: 0%
Last initialised: [2011-09-06 12:03:56]
Thread 0: 62.4 Mh/s Enabled ALIVE
Thread 1: 60.2 Mh/s Enabled ALIVE

[E]nable [D]isable [R]estart GPU [C]hange settings
Or press any other key to continue

S gives you:

[Q]ueue: 1
[S]cantime: 60
[E]xpiry: 120
[W]rite config file
[C]gminer restart

D gives you:

[N]ormal [C]lear [S]ilent mode (disable all output)
[R]PC debug:off
[W]orkTime details:off
co[M]pact: off
[L]og interval:5

Q quits the application.

The running log shows output like this:

 [2012-10-12 18:02:20] Accepted f0c05469 Diff 1/1 GPU 0 pool 1
 [2012-10-12 18:02:22] Accepted 218ac982 Diff 7/1 GPU 1 pool 1
 [2012-10-12 18:02:23] Accepted d8300795 Diff 1/1 GPU 3 pool 1
 [2012-10-12 18:02:24] Accepted 122c1ff1 Diff 14/1 GPU 1 pool 1

The 8 byte hex values are the 2nd 8 bytes of the share being submitted to the pool. The 2 diff values are the actual difficulty target that share reached followed by the difficulty target the pool is currently asking for.

Also many issues and FAQs are covered in the forum thread dedicated to this program,


The Output - What each section means

The first output line shows the following:

(5s):1713.6 (avg):1707.8 Mh/s | Q:301  A:729  R:8  HW:0  E:242%  U:22.53/m

And this is what they mean / stand-for

A 5 second exponentially decaying average hash rate
An all time average hash rate
The number of requested (Queued) work items from the pools
The number of Accepted shares
The number of Rejected shares
The number of HardWare errors
The Efficiency defined as number of shares returned / work item
The Utility defined as the number of shares / minute

The second output line (aka status lines) shows the following:

TQ: 1  ST: 1  SS: 0  DW: 0  NB: 1  LW: 8  GF: 1  RF: 1  WU:4.4/m
Total Queued work items.
STaged work items (ready to use).
Stale Shares discarded (detected and not submitted so don't count as rejects)
Discarded Work items (work from block no longer valid to work on)
New Blocks detected on the network
Locally generated Work items
Getwork Fail Occasions (server slow to provide work)
Remote Fail occasions (server slow to accept work)
Work Utility (Rate of difficulty 1 shares solved per minute)

The 4th output line (aka Block display) shows the following:

Block: 0074c5e482e34a506d2a051a...  Started: [17:17:22]  Best share: 65.5K
a short stretch of the current block
when the new block started
Best share
the all-time best difficulty share you've submitted since starting cgminer this session

The 5th output line shows the following:

GPU 3: 73.5C 2551RPM | 427.3/443.0Mh/s | A:8 R:0 HW:0 U:4.39/m
Device Type & number
Temperature in Celcius(if supported)
Fanspeed in revolutions per minute(if supported)
A 5 second exponentially decaying average hash rate
An all time average hash rate
The number of accepted shares
The number of rejected shares
The number of hardware erorrs
The utility defines as the number of shares / minute

NOTE: Running intensities above 9 with current hardware is likely to only diminish return performance even if the hash rate might appear better. A good starting baseline intensity to try on dedicated miners is 9. Higher values are there to cope with future improvements in hardware.


MultiPool Strategies

Failover strategies with multipool

A number of different strategies for dealing with multipool setups are available. Each has their advantages and disadvantages so multiple strategies are available by user choice, as per the following list:

The default strategy is failover. This means that if you input a number of pools, it will try to use them as a priority list, moving away from the 1st to the 2nd, 2nd to 3rd and so on. If any of the earlier pools recover, it will move back to the higher priority ones.
This strategy only moves from one pool to the next when the current one falls idle and makes no attempt to move otherwise.
This strategy moves at user-defined intervals from one active pool to the next, skipping pools that are idle.
This strategy sends work to all the pools to maintain optimum load. The most efficient pools will tend to get a lot more shares. If any pool falls idle, the rest will tend to take up the slack keeping the miner busy.
This strategy monitors the amount of difficulty 1 shares solved for each pool and uses it to try to end up doing the same amount of work for all pools.


cgminer will log to stderr if it detects stderr is being redirected to a file. To enable logging simply add 2>logfile.txt to your command line and logfile.txt will contain the logged output at the log level you specify (normal, verbose, debug etc.)

In other words if you would normally use:
./cgminer -o xxx -u yyy -p zzz

if you use
./cgminer -o xxx -u yyy -p zzz 2>logfile.txt

it will log to a file called logfile.txt and otherwise work the same.

There is also the -m option on linux which will spawn a command of your choice and pipe the output directly to that command.

The WorkTime details 'debug' option adds details on the end of each line displayed for Accepted or Rejected work done. An example would be:

<-00000059.ed4834a3 M:X D:1.0 G:17:02:38:0.405 C:1.855 (2.995) W:3.440 (0.000) S:0.461 R:17:02:47

The first 2 hex codes are the previous block hash, the rest are reported in
seconds unless stated otherwise:

The previous hash is followed by the getwork mode used M:X where X is one of
P:Pool, T:Test Pool, L:LP or B:Benchmark,

then D:d.ddd is the difficulty required to get a share from the work,
then G:hh:mm:ss:n.nnn, which is when the getwork or LP was sent to the pool and
the n.nnn is how long it took to reply,
followed by 'O' on it's own if it is an original getwork, or 'C:n.nnn' if it was
a clone with n.nnn stating how long after the work was recieved that it was cloned,
(m.mmm) is how long from when the original work was received until work started,
W:n.nnn is how long the work took to process until it was ready to submit,
(m.mmm) is how long from ready to submit to actually doing the submit, this is
usually 0.000 unless there was a problem with submitting the work,
S:n.nnn is how long it took to submit the completed work and await the reply,
R:hh:mm:ss is the actual time the work submit reply was received

If you start cgminer with the --sharelog option, you can get detailed
information for each share found. The argument to the option may be "-" for
standard output (not advisable with the ncurses UI), any valid positive number
for that file descriptor, or a filename.

To log share data to a file named "share.log", you can use either:
./cgminer --sharelog 50 -o xxx -u yyy -p zzz 50>share.log
./cgminer --sharelog share.log -o xxx -u yyy -p zzz

For every share found, data will be logged in a CSV (Comma Separated Value)

For example (this is wrapped, but it's all on one line for real):

Overclocking - Warning & Information


The GPU monitoring, clocking and fanspeed control incorporated into cgminer comes through use of the ATI Display Library. As such, it only supports ATI GPUs. Even if ADL support is successfully built into cgminer, unless the card and driver supports it, no GPU monitoring/settings will be available.

Cgminer supports initial setting of GPU engine clock speed, memory clock speed, voltage, fanspeed, and the undocumented powertune feature of 69x0+ GPUs. The setting passed to cgminer is used by all GPUs unless separate values are specified. All settings can all be changed within the menu on the fly on a per-GPU basis.

For example:
--gpu-engine 950 --gpu-memclock 825

will try to set all GPU engine clocks to 950 and all memory clocks to 825,

--gpu-engine 950,945,930,960 --gpu-memclock 300

will try to set the engine clock of card 0 to 950, 1 to 945, 2 to 930, 3 to 960 and all memory clocks to 300.


There are two "auto" modes in cgminer, --auto-fan and --auto-gpu. These can be used independently of each other and are complementary. Both auto modes are designed to safely change settings while trying to maintain a target temperature. By default this is set to 75 degrees Celcius but can be changed with:

--temp-target 80
Sets all cards' target temperature to 80 degrees.

--temp-target 75,85
Sets card 0 target temperature to 75, and card 1 to 85 degrees.

--auto-fan (implies 85% upper limit)
--gpu-fan 25-85,65 --auto-fan

Fan control in auto fan works off the theory that the minimum possible fan required to maintain an optimal temperature will use less power, make less noise, and prolong the life of the fan. In auto-fan mode, the fan speed is limited to 85% if the temperature is below "overheat" intentionally, as higher fanspeeds on GPUs do not produce signficantly more cooling, yet significanly shorten the lifespan of the fans. If temperature reaches the overheat value, fanspeed will still be increased to 100%. The overheat value is set to 85 degrees by default and can be changed with:

--temp-overheat 75,85
Sets card 0 overheat threshold to 75 degrees and card 1 to 85.

--auto-gpu --gpu-engine 750-950
--auto-gpu --gpu-engine 750-950,945,700-930,960

GPU control in auto gpu tries to maintain as high a clock speed as possible while not reaching overheat temperatures. As a lower clock speed limit, the auto-gpu mode checks the GPU card's "normal" clock speed and will not go below this unless you have manually set a lower speed in the range. Also, unless a higher clock speed was specified at startup, it will not raise the clockspeed. If the temperature climbs, fanspeed is adjusted and optimised before GPU engine clockspeed is adjusted. If fan speed control is not available or already optimal, then GPU clock speed is only decreased if it goes over the target temperature by the hysteresis amount, which is set to 3 by default and can be changed with:

If the temperature drops below the target temperature, and engine clock speed is not at the highest level set at startup, cgminer will raise the clock speed. If at any time you manually set an even higher clock speed successfully in cgminer, it will record this value and use it as its new upper limit (and the same for low clock speeds and lower limits). If the temperature goes over the cutoff limit (95 degrees by default), cgminer will completely disable the GPU from mining and it will not be re-enabled unless manually done so. The cutoff temperature can be changed with:

--temp-cutoff 95,105
Sets card 0 cutoff temperature to 95 and card 1 to 105.

--gpu-memdiff -125
This setting will modify the memory speed whenever the GPU clock speed is modified by --auto-gpu. In this example, it will set the memory speed to be 125 Mhz lower than the GPU speed. This is useful for some cards like the 6970 which normally don't allow a bigger clock speed difference.


When setting values, it is important to realise that even though the driver may report the value was changed successfully, and the new card power profile information contains the values you set it to, that the card itself may refuse to use those settings. As the performance profile changes dynamically, querying the "current" value on the card can be wrong as well. So when changing values in cgminer, after a pause of 1 second, it will report to you the current values where you should check that your change has taken. An example is that 6970 reference cards will accept low memory values but refuse to actually run those lower memory values unless they're within 125 of the engine clock speed. In that scenario, they usually set their real speed back to their default.

Cgminer reports the so-called "safe" range of whatever it is you are modifying when you ask to modify it on the fly. However, you can change settings to values outside this range. Despite this, the card can easily refuse to accept your changes, or worse, to accept your changes and then silently ignore them. So there is absolutely to know how far to/from where/to it can set things safely or otherwise, and there is nothing stopping you from at least trying to set them outside this range. Being very conscious of these possible failures is why cgminer will report back the current values for you to examine how exactly the card has responded. Even within the reported range of accepted values by the card, it is very easy to crash just about any card, so it cannot use those values to determine what range to set. You have to provide something meaningful manually for cgminer to work with through experimentation.


When cgminer starts up, it tries to read off the current profile information for clock and fan speeds and stores these values. When quitting cgminer, it will then try to restore the original values. Changing settings outside of cgminer while it's running may be reset to the startup cgminer values when cgminer shuts down because of this.


GPU Device Issues & Mapping

GPU DEVICE ISSUES and use of --gpu-map

GPUs mine with OpenCL software via the GPU device driver. This means you need to have both an OpenCL SDK installed, and the GPU device driver RUNNING (i.e. Xorg up and running configured for all devices that will mine on linux etc.) Meanwhile, the hardware monitoring that cgminer offers for AMD devices relies on the ATI Display Library (ADL) software to work. OpenCL DOES NOT TALK TO THE ADL. There is no 100% reliable way to know that OpenCL devices are identical to the ADL devices, as neither give off the same information. cgminer does its best to correlate these devices based on the order that OpenCL and ADL numbers them. It is possible that this will fail for the following reasons:

  1. The device order is listed differently by OpenCL and ADL (rare), even if the number of devices is the same.
  2. There are more OpenCL devices than ADL. OpenCL stupidly sees one GPU as two devices if you have two monitors connected to the one GPU.
  3. There are more ADL devices than OpenCL. ADL devices include any ATI GPUs, including ones that can't mine, like some older R4xxx cards.

To cope with this, the ADVANCED option for --gpu-map is provided with cgminer. DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. The default will work the vast majority of the time unless you know you have a problem already.

To get useful information, start cgminer with just the -n option. You will get output that looks like this:

[2012-04-25 13:17:34] CL Platform 0 vendor: Advanced Micro Devices, Inc.
[2012-04-25 13:17:34] CL Platform 0 name: AMD Accelerated Parallel Processing
[2012-04-25 13:17:34] CL Platform 0 version: OpenCL 1.1 AMD-APP (844.4)
[2012-04-25 13:17:34] Platform 0 devices: 3
[2012-04-25 13:17:34]   0       Tahiti
[2012-04-25 13:17:34]   1       Tahiti
[2012-04-25 13:17:34]   2       Cayman
[2012-04-25 13:17:34] GPU 0 AMD Radeon HD 7900 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 2 AMD Radeon HD 6900 Series hardware monitoring enabled
[2012-04-25 13:17:34] 3 GPU devices max detected

Note the number of devices here match, and the order is the same. If devices 1 and 2 were different between Tahiti and Cayman, you could run cgminer with: --gpu-map 2:1,1:2 And it would swap the monitoring it received from ADL device 1 and put it to opencl device 2 and vice versa.

If you have 2 monitors connected to the first device it would look like this:

[2012-04-25 13:17:34] Platform 0 devices: 4
[2012-04-25 13:17:34]   0       Tahiti
[2012-04-25 13:17:34]   1       Tahiti
[2012-04-25 13:17:34]   2       Tahiti
[2012-04-25 13:17:34]   3       Cayman
[2012-04-25 13:17:34] GPU 0 AMD Radeon HD 7900 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 2 AMD Radeon HD 6900 Series hardware monitoring enabled

To work around this, you would use: -d 0 -d 2 -d 3 --gpu-map 2:1,3:2

If you have an older card as well as the rest it would look like this:

[2012-04-25 13:17:34] Platform 0 devices: 3
[2012-04-25 13:17:34]   0       Tahiti
[2012-04-25 13:17:34]   1       Tahiti
[2012-04-25 13:17:34]   2       Cayman
[2012-04-25 13:17:34] GPU 0 AMD Radeon HD 4500 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 2 AMD Radeon HD 7900 Series  hardware monitoring enabled
[2012-04-25 13:17:34] GPU 3 AMD Radeon HD 6900 Series hardware monitoring enabled

To work around this you would use: --gpu-map 0:1,1:2,2:3

For RPC API details see the API-README file



Q: cgminer segfaults when I change my shell window size.
A: Older versions of libncurses have a bug to do with refreshing a window
after a size change. Upgrading to a new version of curses will fix it.

Q: Can I mine on servers from different networks (eg smartcoin and bitcoin) at
the same time?
A: No, cgminer keeps a database of the block it's working on to ensure it does
not work on stale blocks, and having different blocks from two networks would
make it invalidate the work from each other.

Q: Can I change the intensity settings individually for each GPU?
A: Yes, pass a list separated by commas such as -I d,4,9,9

Q: Can I put multiple pools in the config file?
A: Yes, check the example.conf file. Alternatively, set up everything either on
the command line or via the menu after startup and choose settings->write
config file and the file will be loaded one each startup.

Q: The build fails with gcc is unable to build a binary.
A: Remove the "-march=native" component of your CFLAGS as your version of gcc
does not support it.

Q: The CPU usage is high.
A: The ATI drivers after 11.6 have a bug that makes them consume 100% of one
CPU core unnecessarily so downgrade to 11.6. Binding cgminer to one CPU core on
windows can minimise it to 100% (instead of more than one core). Driver version
11.11 on linux and 11.12 on windows appear to have fixed this issue. Note that
later drivers may have an apparent return of high CPU usage. Try
'export GPU_USE_SYNC_OBJECTS=1' on Linux before starting cgminer.

Q: Can you implement feature X?
A: I can, but time is limited, and people who donate are more likely to get
their feature requests implemented.

Q: My GPU hangs and I have to reboot it to get it going again?
A: The more aggressively the mining software uses your GPU, the less overclock
you will be able to run. You are more likely to hit your limits with cgminer
and you will find you may need to overclock your GPU less aggressively. The
software cannot be responsible and make your GPU hang directly. If you simply
cannot get it to ever stop hanging, try decreasing the intensity, and if even
that fails, try changing to the poclbm kernel with -k poclbm, though you will
sacrifice performance. cgminer is designed to try and safely restart GPUs as
much as possible, but NOT if that restart might actually crash the rest of the
GPUs mining, or even the machine. It tries to restart them with a separate
thread and if that separate thread dies, it gives up trying to restart any more

Q: Work keeps going to my backup pool even though my primary pool hasn't
A: Cgminer checks for conditions where the primary pool is lagging and will
pass some work to the backup servers under those conditions. The reason for
doing this is to try its absolute best to keep the GPUs working on something
useful and not risk idle periods. You can disable this behaviour with the
option --failover-only.

Q: Is this a virus?
A: Cgminer is being packaged with other trojan scripts and some antivirus
software is falsely accusing cgminer.exe as being the actual virus, rather
than whatever it is being packaged with. If you installed cgminer yourself,
then you do not have a virus on your computer. Complain to your antivirus
software company. They seem to be flagging even source code now from cgminer
as viruses, even though text source files can't do anything by themself.

Q: Can you modify the display to include more of one thing in the output and
less of another, or can you change the quiet mode or can you add yet another
output mode?
A: Everyone will always have their own view of what's important to monitor.
The defaults are very sane and I have very little interest in changing this
any further.

Q: Can you change the autofan/autogpu to change speeds in a different manner?
A: The defaults are sane and safe. I'm not interested in changing them
further. The starting fan speed is set to 50% in auto-fan mode as a safety

Q: Why is my efficiency above/below 100%?
A: Efficiency simply means how many shares you return for the amount of work
you request. It does not correlate with efficient use of your hardware, and is
a measure of a combination of hardware speed, block luck, pool design and other

Q: What are the best parameters to pass for X pool/hardware/device.
A: Virtually always, the DEFAULT parameters give the best results. Most user
defined settings lead to worse performance. The ONLY thing most users should
need to set is the Intensity.

Q: What happened to CPU mining?
A: Being increasingly irrelevant for most users, and a maintenance issue, it is
no longer under active development and will not be supported unless someone
steps up to help maintain it. No binary builds supporting CPU mining will be
released but CPU mining can be built into cgminer when it is compiled.

Q: I upgraded cgminer version and my hashrate suddenly dropped!
A: No, you upgraded your SDK version unwittingly between upgrades of cgminer
and that caused  your hashrate to drop. See the next question.

Q: I upgraded my ATI driver/SDK/cgminer and my hashrate suddenly dropped!
A: The hashrate performance in cgminer is tied to the version of the ATI SDK
that is installed only for the very first time cgminer is run. This generates
binaries that are used by the GPU every time after that. Any upgrades to the
SDK after that time will have no effect on the binaries. However, if you
install a fresh version of cgminer, and have since upgraded your SDK, new
binaries will be built. It is known that the 2.6 ATI SDK has a huge hashrate
penalty on generating new binaries. It is recommended to not use this SDK at
this time unless you are using an ATI 7xxx card that needs it.

Q: Which ATI SDK is the best for cgminer?
A: At the moment, versions 2.4 and 2.5 work the best. If you are forced to use
the 2.6 SDK, the phatk kernel will perform poorly, while the diablo or my
custom modified poclbm kernel are optimised for it.

Q: I have multiple SDKs installed, can I choose which one it uses?
A: Run cgminer with the -n option and it will list all the platforms currently
installed. Then you can tell cgminer which platform to use with --gpu-platform.

Q: GUI version?
A: No. The RPC interface makes it possible for someone else to write one

Q: I'm having an issue. What debugging information should I provide?
A: Start cgminer with your regular commands and add -D -T --verbose and provide
the full startup output and a summary of your hardware, operating system, ATI
driver version and ATI stream version.

Q: cgminer reports no devices or only one device on startup on Linux although
I have multiple devices and drivers+SDK installed properly?
A: Try "export DISPLAY=:0" before running cgminer.

Q: My network gets slower and slower and then dies for a minute?
A; Try the --net-delay option.

Q: How do I tune for p2pool?
A: p2pool has very rapid expiration of work and new blocks, it is suggested you
decrease intensity by 1 from your optimal value, and decrease GPU threads to 1
with -g 1. It is also recommended to use --failover-only since the work is
effectively like a different block chain. If mining with a minirig, it is worth
adding the --bfl-range option.

Q: Are kernels from other mining software useable in cgminer?
A: No, the APIs are slightly different between the different software and they
will not work.

Q: I run PHP on windows to access the API with the example miner.php. Why does
it fail when php is installed properly but I only get errors about Sockets not
working in the logs?

Q: What is a PGA?
A: At the moment, cgminer supports 4 FPGAs: BitForce, Icarus, ModMiner, and Ztex.
They are Field-Programmable Gate Arrays that have been programmed to do Bitcoin
mining. Since the acronym needs to be only 3 characters, the "Field-" part has
been skipped.

Q: How do I get my BFL/Icarus/Lancelot/Cairnsmore device to auto-recognise?
A: On linux, if the /dev/ttyUSB* devices don't automatically appear, the only
thing that needs to be done is to load the driver for them:
BFL: sudo modprobe ftdi_sio vendor=0x0403 product=0x6014
Icarus: sudo modprobe pl2303 vendor=0x067b product=0x230
Lancelot: sudo modprobe ftdi_sio vendor=0x0403 product=0x6001
Cairnsmore: sudo modprobe ftdi_sio product=0x8350 vendor=0x0403
On windows you must install the pl2303 or ftdi driver required for the device

Q: On linux I can see the /dev/ttyUSB* devices for my ICA/BFL/MMQ FPGA, but
cgminer can't mine on them
A: Make sure you have the required priviledges to access the /dev/ttyUSB* devices:
 sudo ls -las /dev/ttyUSB*
will give output like:
 0 crw-rw---- 1 root dialout 188, 0 2012-09-11 13:49 /dev/ttyUSB0
This means your account must have the group 'dialout' or root priviledges
To permanently give your account the 'dialout' group:
 sudo usermod -G dialout -a `whoami`
Then logout and back in again

Q: What is stratum and how do I use it?
A: Stratum is a protocol designed for pooled mining in such a way as to
minimise the amount of network communications, yet scale to hardware of any
speed. With versions of cgminer 2.8.0+, if a pool has stratum support, cgminer
will automatically detect it and switch to the support as advertised if it can.
Stratum uses direct TCP connections to the pool and thus it will NOT currently
work through a http proxy but will work via a socks proxy if you need to use
one. If you input the stratum port directly into your configuration, or use the
special prefix "stratum+tcp://" instead of "http://", cgminer will ONLY try to
use stratum protocol mining. The advantages of stratum to the miner are no
delays in getting more work for the miner, less rejects across block changes,
and far less network communications for the same amount of mining hashrate. If
you do NOT wish cgminer to automatically switch to stratum protocol even if it
is detected, add the --fix-protocol option.

This code is provided entirely free of charge by the programmer in his spare time so donations would be greatly appreciated. Please consider donating to the address below.

Con Kolivas <>
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ BTC (preferred)


Scrypt Mining

Scrypt mining, AKA litecoin mining, for GPU is completely different to sha256 used for bitcoin mining. The algorithm was originally developed in a manner that it was anticipated would make it suitable for mining on CPU but NOT GPU. Thanks to some innovative work by Artforz and mtrlt, this was proven to be wrong. However, it has very different requirements to bitcoin mining and is a lot more complicated to get working well. Note that it is a ram dependent workload, and requires you to have enough system ram as well as fast enough GPU ram. If you have less system ram than your GPU has, it may not be possible to mine at any reasonable rate.

There are 5 main parameters to tuning scrypt, 2 of which you MUST set, and the others are optional for further fine tuning. When you start scrypt mining with the --scrypt option, cgminer will fail IN RANDOM WAYS. They are all due to parameters being outside what the GPU can cope with. Not giving cgminer a hint as to your GPU type, it will hardly ever perform well.

NOTE that if it does not fail at startup, the presence of hardware errors (HW) are a sure sign that you have set the parameters too high.

Step 1 on linux:
If you do not do this, you may find it impossible to scrypt mine. You may find a value of 40 is enough and increasing this further has little effect.

may help CPU usage a little as well.

--shaders XXX
is a new option where you tell cgminer how many shaders your GPU has. This helps cgminer try to choose some meaningful baseline parameters. Use this table below to determine how many shaders your GPU has, and note that there are some variants of these cards, and nvidia shaders are much much lower and virtually pointless trying to mine on.

GPU Shaders
5670 400
5750 720
5770 800
5830 1120
5850 1440
5870 1600
5970 1600 x2
GPU Shaders
6450 160
6570 480
6670 480
6790 800
6850 960
6870 1120
6950 1408
6970 1536
6990 1536 x2
GPU Shaders
7750 512
7770 640
7850 1024
7870 1280
7950 1792
7970 2048

These are only used as a rough guide for cgminer, and it is rare that this is all you will need to set.

--intensity XX
Just like in bitcoin mining, scrypt mining takes an intensity, however the scale goes from 0 to 20 to mimic the "Aggression" used in mtrlt's reaper. The reason this is crucial is that too high an intensity can actually be disastrous with scrypt because it CAN run out of ram. Intensities over 13 start writing over the same ram and it is highly dependent on the GPU, but they can start actually DECREASING your hashrate, or even worse, start producing garbage with HW errors skyrocketing. The low level detail is that intensity is only guaranteed up to the power of 2 that most closely matches the thread concurrency. i.e. a thread concurrency of 6144 has 8192 as the nearest power of two above it, thus as 2^13=8192, that is an intensity of 13.

Optional parameters to tune:
-g, --thread-concurrency, --lookup-gap

Once you have found the optimal shaders and intensity, you can start increasing the -g value till cgminer fails to start. Rarely will you be able to go over about -g 4 and each increase in -g only increases hashrate slightly.

This tunes the optimal size of work that scrypt can do. It is internally tuned by cgminer to be the highest reasonable multiple of shaders that it can allocate on your GPU. Ideally it should be a multiple of your shader count. vliw5 architecture (R5XXX) would be best at 5x shaders, while VLIW4 (R6xxx and R7xxx) are best at 4x. Setting thread concurrency overrides anything you put into --shaders.

This tunes a compromise between ram usage and performance. Performance peaks at a gap of 2, but increasing the gap can save you some GPU ram, but almost always at the cost of significant loss of hashrate. Setting lookup gap overrides the default of 2, but cgminer will use the --shaders value to choose a thread-concurrency if you haven't chosen one.

Overclocking for scrypt mining:

First of all, do not underclock your memory initially. Scrypt mining requires memory speed and on most, but not all, GPUs, lowering memory speed lowers mining performance.

Second, absolute engine clock speeds do NOT correlate with hashrate. The ratio of engine clock speed to memory matters, so if you set your memory to the default value, and then start overclocking as you are running it, you should find a sweet spot where the hashrate peaks and then it might actually drop if you increase the engine clock speed further. Unless you wish to run with a dynamic intensity, do not go over 13 without testing it while it's running to see that it increases hashrate AND utility WITHOUT increasing your HW errors.

Suggested values for 7970 for example:
--thread-concurrency 8192 -g 4 --gpu-engine 1135 --gpu-memclock 1375


Appendix A

Windows Build


#                                                                                    #

#          Native WIN32 setup and build instructions (on mingw32/Windows):           #

#                                                                                    #



* Introduction                                                                       *


The following instructions have been tested on both Windows 7 and Windows XP.

Most of what is described below (copying files, downloading files, etc.) can be done

directly in the MinGW MSYS shell; these instructions do not do so because package

versions and links change over time. The best way is to use your browser, go to the

links directly, and see for yourself which versions you want to install.

Winrar was used to do the extracting of archive files in the making of this guide.

If you think that this documentation was helpful and you wish to donate, you can

do so at the following address. 12KaKtrK52iQjPdtsJq7fJ7smC32tXWbWr


* A tip that might help you along the way                                             *


Enable "QuickEdit Mode" in your Command Prompt Window or MinGW Command Prompt

Window (No need to go into the context menu to choose edit-mark/copy/paste):

Right-click on the title bar and click Properties. Under the Options tab, check

the box for "QuickEdit Mode". Alternately, if you want this change to be

permanent on all of your Command Prompt Windows; you can click Defaults instead

of Properties as described above. Now you can drag and select text you want to

copy, right-click to copy the text to the clipboard and right-click once again to

paste it at the desired location. You could for example, copy some text from this

document to the clipboard and right click in your Command Prompt Window to paste

what you copied.


* Install mingw32                                                                    *


Go to this url ==>

Click the link that says "Download and run the latest mingw-get-inst version."

Download and run the latest file. Install MinGW in the default directory.

(I downloaded the one labeled "mingw-get-inst-20120426" - note that this could

be a different version later.)

Make sure to check the option for "Download latest repository catalogs".

I just selected all the check boxes (excluding "Fortran Compiler") so that everything

was installed.


* Create mstcpip.h                                                                   *


Open notepad and copy the following into it. Save it as "\MinGW\include\mstcpip.h".

Make sure it does not have the ".txt" extension (If it does then rename it).

struct tcp_keepalive


    u_long onoff;

    u_long keepalivetime;

    u_long keepaliveinterval;








* Run the MSYS shell for the first time to create your user directory                *


(Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell).

This will create your user directory for you.


* Install libpdcurses                                                                *


Type the lines below to install libpdcurses.

mingw-get install mingw32-libpdcurses

mingw-get install mingw32-pdcurses

Ctrl-D or typing "logout" and pressing the enter key should get you out of the



* Copy CGMiner source to your MSYS working directory                                 *


Copy CGMiner source code directory into:

\MinGW\msys\1.0\home\(folder with your user name)


* Install AMD APP SDK, latest version (only if you want GPU mining)                  *


Note: You do not need to install the AMD APP SDK if you are only using Nvidia GPU's

Go to this url for the latest AMD APP SDK:

Go to this url for legacy AMD APP SDK's:

Download and install whichever version you like best.

Copy the folders in \Program Files (x86)\AMD APP\include to \MinGW\include

Copy \Program Files (x86)\AMD APP\lib\x86\libOpenCL.a to \MinGW\lib

Note: If you are on a 32 bit version of windows "Program Files (x86)" will be

"Program Files".

Note2: If you update your APP SDK later you might want to recopy the above files


* Install AMD ADL SDK, latest version (only if you want GPU monitoring)              *


Note: You do not need to install the AMD ADL SDK if you are only using Nvidia GPU's

Go to this url ==>

Download and unzip the file you downloaded.

Pull adl_defines.h, adl_sdk.h, and adl_structures.h out of the include folder

Put those files into the ADL_SDK folder in your source tree as shown below.

\MinGW\msys\1.0\home\(folder with your user name)\cgminer-x.x.x\ADL_SDK


* Install GTK-WIN, required for Pkg-config in the next step                          *


Go to this url ==>

Download the file.

After you have downloaded the file Double click/run it and this will install GTK+

I chose all the selection boxes when I installed.

Copy libglib-2.0-0.dll and intl.dll from \Program Files (x86)\gtk2-runtime\bin to


Note: If you are on a 32 bit version of windows "Program Files (x86)" will be

"Program Files".


* Install pkg-config                                                                 *


Go to this url ==>

Scroll down to where it shows pkg-cfg.

Download the file from the tool link. Extract "pkg-config.exe" from bin and place in

your  \MinGW\bin directory.

Download the file from the "Dev" link. Extract "pkg.m4" from share\aclocal and place

in your \MingW\share\aclocal directory.


* Install libcurl                                                                    *


Go to this url ==>

At the section where it says "Win32 - Generic", Click on the link that indicates

Win32 2000.XP 7.27.0 libcurl SSL and download it.

The one I downloaded may not be current for you. Choose the latest.

Extract the files that are in the zip (bin, include, and lib) to their respective

locations in MinGW (\MinGW\bin, \MinGW\include, and \MinGW\lib).

Edit the file \MinGW\lib\pkgconfig\libcurl.pc and change "-lcurl" to

"-lcurl -lcurldll".



* Build cgminer.exe                                                                  *


Run the MinGW MSYS shell

(Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell).

Change the working directory to your CGMiner project folder.

Example: cd cgminer-2.1.2 [Enter Key] if you are unsure then type "ls -la"

Another way is to type "cd cg" and then press the tab key; It will auto fill.

Type the lines below one at a time. Look for problems after each one before going on

to the next. (optional - see below)

      autoreconf -fvi

      CFLAGS="-O2 -msse2" ./configure (additional config options, see below)



* Copy files to a build directory/folder                                             *


Make a directory and copy the following files into it. This will be your CGMiner

Folder that you use for mining. Remember the .cl filenames could change on later

releases. If you installed a different version of libcurl then some of those dll's

may be different as well.

  cgminer.exe     from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x

  *.cl            from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x

  README          from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x

  libcurl.dll     from \MinGW\bin

  libidn-11.dll   from \MinGW\bin

  libeay32.dll    from \MinGW\bin

  ssleay32.dll    from \MinGW\bin

  libpdcurses.dll from \MinGW\bin

  pthreadGC2.dll  from \MinGW\bin


* Optional - Install Git into MinGW/MSYS                                             *


Go to this url ==>

Click on the Downloads tab.

Download the latest "Portable" git archive.

Extract the git*.exe files from the bin folder and put them into \MinGW\bin.

Extract the share\git-core folder and place it into \MinGW\share.

After the previous step you should have a folder called \MinGW\share\git-core.

To test if it is working, open a MinGW shell and type the following:

  git config -?lobal core.autocrlf false (note: one time run only)

  git clone git://

If you simply just want to update the source after you have already cloned, type:

  git pull

Now you can get the latest source directly from github.


* Optional - Make a .sh file to automate copying over ADL files                      *


Make a folder/directory in your home folder and name it ADL_SDK.

 (ref:  \MinGW\msys\1.0\home\(folder with your user name)\ADL_SDK)

Copy the ADL .h files into that folder/directory.

Open your favorite text editor and type the following into it.

 cp -av ../ADL_SDK/*.h ADL_SDK

Save the file as "" and then place the file into "\MinGW\msys\1.0\bin".

From now on when your current working directory is the cgminer source directory

You can simply type "" and it will place the ADL header files into place

For you. Make sure you never remove the ADL_SDK folder from your home folder.


* Optional - Install libusb if you need auto USB device detection; required for Ztex *


Go to this url ==>

Click on the "Downloads" tab.

Click on "releases".

Click on the latest version. I downloaded 1.0.12; yours may be newer.

Do not download from the link that says "Looking for the latest version?".

Click on "Windows"

Click on the file and download it. I downloaded libusbx-1.0.12-win.7z.

Extract the the following from the file and place in where directed.

Copy libusb.h from include\libusbx-1.0 to \MinGW\include\libusb-1.0\libusb.h

Copy contents of MinGW32\static \MinGW\lib

Copy contents of MinGW32\dll to \MinGW\lib

You will have to copy "libusb-1.0.dll" to your working cgminer binary directory.


* Some ./configure options                                                           *


--enable-cpumining      Build with cpu mining support(default disabled)

--disable-opencl        Override detection and disable building with opencl

--disable-adl           Override detection and disable building with adl

--enable-bitforce       Compile support for BitForce FPGAs(default disabled)

--enable-icarus         Compile support for Icarus Board(default disabled)

--enable-modminer       Compile support for ModMiner FPGAs(default disabled)

--enable-ztex           Compile support for Ztex Board(default disabled)

--enable-scrypt         Compile support for scrypt litecoin mining (default disabled)

--without-curses        Compile support for curses TUI (default enabled)

--without-libudev       Autodetect FPGAs using libudev (default enabled)


#                                                                                    #

#       Native WIN32 setup and build instructions (on mingw32/Windows) complete      #

#                                                                                    #

Top | Appendix A

xUbuntu 11.04 Live on USB

How to setup a cgminer using xubuntu 11.04 live on a USB

The master version of this document is here:

The actual file is:

The copy in cgminer (check to make sure it isn't older) is:

The original old verion on bitcointalk is:


I have said to select English for the install process for 2 reasons:
1) I don't know any other spoken language very well
2) I'm not sure what problems installing under a different language
might cause (it will probably cause no problems but I don't know)

Short hardware comment:
Your mining computer doesn't need any HDD or CD/DVD/BD as long as it has at
least 2GB of RAM, can boot USB, has some network connection to the internet
and of course a reasonable mining ATI graphics card
... Or you can boot a windows PC with the USB to only do mining ... and ignore
the system HDD ... wasting energy running the HDD (roughly 10 Watts per HDD) :)

If you wish to install to an HDD instead of a USB,
 see the changes to the instructions at the end

To create the USB, you need of course a 4GB USB and temporarily need a PC
with a CD (or DVD/BD) writer, a USB port and of course an internet
connection to the PC

1) Download the xubuntu 11.04 desktop live CD iso for amd64
   ( look here for mirrors: )

2) Burn it to CD then boot that temporarily on any PC with a CD/DVD/BD and
   a USB port (this and the next 2 step won't effect that PC)
   Select "English" then select "Try Xubuntu without installing"
   and wait for the desktop to appear
   (this happens by default if you wait for the timeouts)

3) Plug in your 4GB USB device and it should appear on the desktop - you can
   leave it's contents as long as there is at least 2.8GB free

4) Now run "Startup Disk Creator" in "Applications->System"
   (the system menu is the little rat in the top left corner)

(if you have no mouse you can get the menu with <ctr><esc> and navigate
the menu with the arrow keys and <return> key)

From here select the boot CD as the "Source" and the USB as the "Disk to use"
lastly move the slider to 2GB for reserved extra space

The 2GB should be enough for modifications

Click: "Make Install Disk"
After about 10-15 minutes you have a base xubuntu 11.04 boot USB
(you can shut down this computer now)

5) Boot your cgminer PC with this USB stick, select "English"
   then select "Try Xubuntu without installing" and wait for the desktop to
   appear (this happens by default if you wait for the timeouts)

6) Start a terminal
   "Applications->Accessories->Terminal Emulator"

7) sudo apt-get install openssh-server screen

   if you have a problem here then it's probably coz the internet isn't
   available ... sort that out by reading elsewhere about routers etc

8) sudo apt-get install fglrx fglrx-amdcccle fglrx-dev
   sudo sync
   sudo shutdown -r now

N.B. always do a "sudo sync" and wait for it to finish every time before
shutting down the PC to ensure all data is written to the USB

9) sudo aticonfig --lsa
   this lists your ATI cards so you can see them
 sudo aticonfig --adapter=all --odgt
   this checks it can access all the cards ...

10) sudo aticonfig --adapter=all --initial
   this gets an error - no idea why but the xorg.conf is OK
 sudo sync
 sudo shutdown -r now

11) sudo aticonfig --adapter=all --odgt
   this checks it can access all the cards ...

12) get AMD-APP-SDK-v2.4-lnx64.tgz from
  ( )

 sudo su
 cd /opt
  (replace /home/ubuntu/ with wherever you put the file: )
 tar -xvzf /home/ubuntu/AMD-APP-SDK-v2.4-lnx64.tgz

 cd AMD-APP-SDK-v2.4-lnx64/
 cp -pv lib/x86_64/* /usr/lib/
 rsync -avl include/CL/ /usr/include/CL/
 tar -xvzf icd-registration.tgz
 rsync -avl etc/OpenCL/ /etc/OpenCL/
 shutdown -r now

 You now have an OpenCL enabled xubuntu

13) cgminer:
 sudo apt-get install curl

 get the binary linux cgminer
 (see the bitcoin forum cgminer thread for where to get it)

 ./cgminer -n
   this shows you the GPU's it found on your PC
   See further below if you get an error regarding

14) An OC option:
 This is no longer needed since cgminer 2.* includes OC, however:

 sudo apt-get install libwxbase2.8-0 libwxgtk2.8-0
  for an Over/underclocking application and get the file listed below then:
 sudo dpkg -i amdoverdrivectrl_1.2.1_amd64.deb

15) set the screen saver to ONLY blank ...

 Move the mouse to the bottom of the screen and you see a set of icons like
 on an Apple PC
 Click on Settings, then in the Settings window "Screensaver"
 Set "Mode:" to "Blank Screen Only"

16) apt-get install ntpd
 An accurate clock is always a good idea :)

17) if you wish to ssh into the box you must set a password
    to do this you simply have to be logged into it at the screen and type

  sudo passwd ubuntu

    it will prompt you (twice) to enter a password for the ubuntu account

Initial setup complete.


If you want to SSH into the machine and run cgminer:
 From a terminal on the miner display each time after you boot:
  xhost +

 'xhost +' isn't needed if you ssh into the machine with the same
 username that the GUI boots into (which is 'ubuntu' in this case)

Then after you ssh into the machine:
 export DISPLAY=:0
before running cgminer

Also note, that you should force the screen to blank when mining if
the ATI card is displaying the screen (using the screen saver
application menu)
In my case it takes away 50Mh/s when the screen isn't blanked
It will auto blank - but make sure the blank is of course just blank
as mentioned above at 15)

This is of course just the basics ... but it should get you a computer
up and running and able to run cgminer


You should keep an eye on USB disk space
The system logger writes log files in the /var/log/ directory
The two main ones that grow large are 'kern.log' and 'syslog'
If you want to keep them, save them away to some other computer
When space is low, just delete them e.g.

   sudo rm -i /var/log/syslog
   sudo rm -i /var/log/kern.log

The 'df' command will show you the current space e.g.:

   sudo df

Filesystem           1K-blocks      Used Available Use% Mounted on
aufs                   2099420    892024   1100748  45% /
none                   1015720       628   1015092   1% /dev
/dev/sda1              3909348   2837248   1072100  73% /cdrom
/dev/loop0              670848    670848         0 100% /rofs
none                   1023772       136   1023636   1% /dev/shm
tmpfs                  1023772        16   1023756   1% /tmp
none                   1023772       124   1023648   1% /var/run
none                   1023772         0   1023772   0% /var/lock

This shows the 2GB space allocated when you setup the USB as '/' (aufs)
In this example, it's currently 45% full with almost 1.1GB of free space


The latest version (2.0.8) of cgminer is built with 11.10 (not 11.04)
If you get the following error when running the prebuilt version in 11.04:

   ./cgminer: error while loading shared libraries: cannot open shared object file: No such file or directory

The fix is to simply link the old curses library to the new name e.g.:

   cd /lib64/
   sudo ln -s


If you wish to install to an HDD instead of a USB:

As per before:

1) Download the xubuntu 11.04 desktop live CD iso for amd64
   ( look here for mirrors: )


2) Burn it to CD then boot that on your new mining PC
   Select "English" then select "Install Xubuntu"
   (you have 30 seconds to do this)

3) When the Install window comes up - again select "English" and click "Forward"

4) The next page will show you if you meet certain install requirements
   (make sure you do meet them all)
   Don't select the download option
   The 3rd party option isn't needed for mining so ignore that also

   Click "Forward"

5) With "Allocate drive space" it's probably easiest to say to use the
   "Erase" option.

   This is just for mining right? :)

   However, if you have anything on the HDD that you want to keep - the
   "Erase" install process will delete it - so back it up (quit the install)
   Also make sure there are no OTHER HDD attached that it may erase also
   i.e. only have attached the one HDD that you want to install onto unless
   you know exactly what you are doing

   If you see the "Install Xubuntu 11.04 alongside 'something'" then that
   just means that the HDD wasn't blank.
   If you want to try this option - do that yourself and then skip to step
   7) below when you get to that.

   There are plenty of other options available if you select "Something else"
   but I'm not going to go into all the details here other than to say that
   my preferred partioning is: /boot = 1GB = ext2, swap = twice memory size,
   / = 100GB = ext3 and the rest: /extra = ext3

   Click "Forward"

6) If you selected "Erase" then it allows you to choose the drive to install to
   Then click "Install Now"

7) "Where are you?" sort that out then click "Forward"

8) "Keyboard layout" sort that out (use the default) then click "Forward"

9) "Who are you?" The important one here is "Pick a username:" coz that's
   the name you will need to ssh into, to access it remotely (and of course
   the "Choose a Password" you set)

   If you set the "username" to anything but "ubuntu" then: wherever in this
   document I have mentioned the username "ubuntu" you must of course use the
   username you chose here instead of "ubuntu"

   Important: set it to "log in automatically" if you ever want to be able
   to start cgminer without being in front of the computer since 'X' must
   be running to use cgminer properly
   That does of course mean that the computer isn't secure from anyone who
   has access to it - but then again no computer that can automatically
   reboot is secure from anyone who has access to the actual computer itself

   Then click "Forward"

10) Of course when it completes click on "Restart Now"
    ... and remove the Xubuntu CD when it asks you

11) Wait for it to finish rebooting ... and it will auto login
    (unless you didn't do step 9) "Important:")

12) After it logs in, an upgrade popup for 11.10 (or later) will appear
    Select "Don't Upgrade"

13) Now go to step 6) of the USB script above for what to do next and that
    covers everything else needed

Top | Appendix A


This README contains extended details about FPGA mining with cgminer

ModMinerQuad (MMQ)

The mining bitstream does not survive a power cycle, so cgminer will upload
it, if it needs to, before it starts mining


You must make sure you have an approriate firmware in your MMQ
Read here for official details of changing the firmware:

The basics of changing the firmware are:
 You need two short pieces of conductive wire if your MMQ doesn't have
 buttons on the "RESET" and "ISP" pads on the backplane board
 Cutting a small (metal) paper-clip in half works well for this

 Join the 2 left pads of the "RESET" pad with wire and the led will dim
 Without disconnecting the "RESET", join the 2 left pads of the "ISP" pad
 with a wire and it will stay dim
 Release "RESET" then release "ISP" and is should still be dim
 Unplug the USB and when you plug it back in it will show up as a mass
 storage device
  Linux: (as one single line):
   mcopy -i /dev/disk/by-id/usb-NXP_LPC134X_IFLASH_ISP000000000-0:0
      modminer091012.bin ::/firmware.bin
  Windows: delete the MSD device file firmware.bin and copy in the new one
   rename the new file and put it under the same name 'firmware.bin'
 Disconnect the USB correctly (so writes are flushed first)
 Join and then disconnect "RESET" and then plug the USB back in and it's done

Best to update to one of the latest 2 listed below if you don't already
have one of them in your MMQ

The current latest different firmware are:

 Latest for support of normal or TLM bitstream:

 Latest with only normal bitstream support (Temps/HW Fix):

The code is currently tested on the modminer091012.bin firmware.
This comment will be updated when others have been tested


On many linux distributions there is an app called modem-manager that
may cause problems when it is enabled, due to opening the MMQ device
and writing to it

The problem will typically present itself by the flashing led on the
backplane going out (no longer flashing) and it takes a power cycle to
re-enable the MMQ firmware - which then can lead to the problem happening

You can either disable/uninstall modem-manager if you don't need it or:
a (hack) solution to this is to blacklist the MMQ USB device in

Adding 2 lines like this (just above APC) should help
ATTRS{idVendor}=="ifc9", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1"

The change will be lost and need to be re-done, next time you update the
modem-manager software

TODO: check that all MMQ's have the same product ID

Bitforce (BFL)

--bfl-range         Use nonce range on bitforce devices if supported

This option is only for bitforce devices. Earlier devices such as the single
did not have any way of doing small amounts of work which meant that a lot of
work could be lost across block changes. Some of the "minirigs" have support
for doing this, so less work is lost across a longpoll. However, it comes at
a cost of 1% in overall hashrate so this feature is disabled by default. It
is only recommended you enable this if you are mining with a minirig on

C source is included for a bitforce firmware flash utility on Linux only:
Using this, you can change the bitstream firmware on bitforce singles.
It is untested with other devices. Use at your own risk!

To compile:
 make bitforce-firmware-flash
To flash your BFL, specify the BFL port and the flash file e.g.:
 sudo ./bitforce-firmware-flash /dev/ttyUSB0 alphaminer_832.bfl
It takes a bit under 3 minutes to flash a BFL and shows a progress % counter
Once it completes, you may also need to wait about 15 seconds,
then power the BFL off and on again

If you get an error at the end of the BFL flash process stating:
 "Error reading response from ZBX"
it may have worked successfully anyway.
Test mining on it to be sure if it worked or not.

You need to give cgminer about 10 minutes mining with the BFL to be sure of
the MH/s value reported with the changed firmware - and the MH/s reported
will be less than the firmware speed since you lose work on every block change.

Icarus (ICA)

There are two hidden options in cgminer when Icarus support is compiled in:

--icarus-options <arg> Set specific FPGA board configurations - one set of values for all or comma separated

           baud           The Serial/USB baud rate - 115200 or 57600 only - default 115200
           work_division  The fraction of work divided up for each FPGA chip - 1, 2, 4 or 8
                          e.g. 2 means each FPGA does half the nonce range - default 2
           fpga_count     The actual number of FPGA working - this would normally be the same
                          as work_division - range is from 1 up to 'work_division'
                          It defaults to the value of work_division - or 2 if you don't specify

If you define fewer comma seperated values than Icarus devices, the last values will be used
for all extra devices

An example would be: --icarus-options 57600:2:1
This would mean: use 57600 baud, the FPGA board divides the work in half however
only 1 FPGA actually runs on the board (e.g. like an early CM1 Icarus copy bitstream)

--icarus-timing <arg> Set how the Icarus timing is calculated - one setting/value for all or comma separated
           default[=N]   Use the default Icarus hash time (2.6316ns)
           short         Calculate the hash time and stop adjusting it at ~315 difficulty 1 shares (~1hr)
           long          Re-calculate the hash time continuously
           value[=N]     Specify the hash time in nanoseconds (e.g. 2.6316) and abort time (e.g. 2.6316=80)

If you define fewer comma seperated values than Icarus devices, the last values will be used
for all extra devices

Icarus timing is required for devices that do not exactly match a default Icarus Rev3 in
processing speed
If you have an Icarus Rev3 you should not normally need to use --icarus-timing since the
default values will maximise the MH/s and display it correctly

Icarus timing is used to determine the number of hashes that have been checked when it aborts
a nonce range (including on a LongPoll)
It is also used to determine the elapsed time when it should abort a nonce range to avoid
letting the Icarus go idle, but also to safely maximise that time

'short' or 'long' mode should only be used on a computer that has enough CPU available to run
cgminer without any CPU delays (an active desktop or swapping computer would not be stable enough)
Any CPU delays while calculating the hash time will affect the result
'short' mode only requires the computer to be stable until it has completed ~315 difficulty 1 shares
'long' mode requires it to always be stable to ensure accuracy, however, over time it continually
corrects itself

When in 'short' or 'long' mode, it will report the hash time value each time it is re-calculated
In 'short' or 'long' mode, the scan abort time starts at 5 seconds and uses the default 2.6316ns
scan hash time, for the first 5 nonce's or one minute (whichever is longer)

In 'default' or 'value' mode the 'constants' are calculated once at the start, based on the default
value or the value specified
The optional additional =N specifies to set the default abort at N 1/10ths of a second, not the
calculated value, which is 112 for 2.6316ns

To determine the hash time value for a non Icarus Rev3 device or an Icarus Rev3 with a different
bitstream to the default one, use 'long' mode and give it at least a few hundred shares, or use
'short' mode and take note of the final hash time value (Hs) calculated
You can also use the RPC API 'stats' command to see the current hash time (Hs) at any time

The Icarus code currently only works with an FPGA device that supports the same commands as
Icarus Rev3 requires and also is less than ~840MH/s and greater than 2MH/s
If an FPGA device does hash faster than ~840MH/s it should work correctly if you supply the
correct hash time nanoseconds value

The timing code itself will affect the Icarus performance since it increases the delay after
work is completed or aborted until it starts again
The increase is, however, extremely small and the actual increase is reported with the
RPC API 'stats' command (a very slow CPU will make it more noticeable)
Using the 'short' mode will remove this delay after 'short' mode completes
The delay doesn't affect the calculation of the correct hash time
Top | Appendix A

Appendix B


Original CPU mining software:
Jeff Garzik <>

GPU mining and rewrite:
Con Kolivas <> 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ

BitFORCE FPGA mining and refactor:
Luke Dashjr <> 1NbRmS6a4dniwHHoSS9v3tEYUpP1Z5VVdL

Andrew Smith <> 1Jjk2LmktEQKnv8r2cZ9MvLiZwZ9gxabKm

David D Ochoa <> Lf9WKM61AhmXchG2Ph2cftHKSQhxHutcdk (LTC)

Top | Appendix A | Appendix B


This README contains details about the cgminer RPC API

It also includes some detailed information at the end,
about using miner.php

If you start cgminer with the "--api-listen" option, it will listen on a
simple TCP/IP socket for single string API requests from the same machine
running cgminer and reply with a string and then close the socket each time
If you add the "--api-network" option, it will accept API requests from any
network attached computer.

You can only access the comands that reply with data in this mode.
By default, you cannot access any privileged command that affects the miner -
you will receive an access denied status message see --api-allow below.

You can specify IP addresses/prefixes that are only allowed to access the API
with the "--api-allow" option e.g. --api-allow W:,10.0.0/24
will allow or any address matching 10.0.0.*, but nothing else
IP addresses are automatically padded with extra '.0's as needed
Without a /prefix is the same as specifying /32
0/0 means all IP addresses.
The 'W:' on the front gives that address/subnet privileged access to commands
that modify cgminer (thus all API commands)
Without it those commands return an access denied status.
See --api-groups below to define other groups like W:
Privileged access is checked in the order the IP addresses were supplied to
The first match determines the privilege level.
Using the "--api-allow" option overides the "--api-network" option if they
are both specified
With "--api-allow", is not by default given access unless specified

More groups (like the privileged group W:) can be defined using the
--api-groups command
Valid groups are only the letters A-Z (except R & W are predefined) and are
not case sensitive
The R: group is the same as not privileged access
The W: group is (as stated) privileged access (thus all API commands)
To give an IP address/subnet access to a group you use the group letter
in front of the IP address instead of W: e.g. P:192.168.0/32
An IP address/subnet can only be a member of one group
A sample API group would be:
 --api-groups P:switchpool:enablepool:addpool:disablepool:removepool:poolpriority:*
This would create a group 'P' that can do all current pool commands and all
non-priviliged commands - the '*' means all non-priviledged commands
Without the '*' the group would only have access to the pool commands
Defining multiple groups example:
 --api-groups Q:quit:restart:*,S:save
This would define 2 groups:
 Q: that can 'quit' and 'restart' as well as all non-priviledged commands
 S: that can only 'save' and no other commands

The RPC API request can be either simple text or JSON.

If the request is JSON (starts with '{'), it will reply with a JSON formatted
response, otherwise it replies with text formatted as described further below.

The JSON request format required is '{"command":"CMD","parameter":"PARAM"}'
(though of course parameter is not required for all requests)
where "CMD" is from the "Request" column below and "PARAM" would be e.g.
the CPU/GPU number if required.

An example request in both formats to set GPU 0 fan to 80%:

The format of each reply (unless stated otherwise) is a STATUS section
followed by an optional detail section

From API version 1.7 onwards, reply strings in JSON and Text have the
necessary escaping as required to avoid ambiguity - they didn't before 1.7
For JSON the 2 characters '"' and '\' are escaped with a '\' before them
For Text the 4 characters '|' ',' '=' and '\' are escaped the same way

Only user entered information will contain characters that require being
escaped, such as Pool URL, User and Password or the Config save filename,
when they are returned in messages or as their values by the API

For API version 1.4 and later:

The STATUS section is:


  STATUS=X Where X is one of:
   W - Warning
   I - Informational
   S - Success
   E - Error
   F - Fatal (code bug)

   Standard long time of request in seconds

   Each unique reply has a unigue Code (See api.c - #define MSG_NNNNNN)

   Message matching the Code value N

   This defaults to the cgminer version but is the value of --api-description
   if it was specified at runtime.

For API version 1.10 and later:

The list of requests - a (*) means it requires privileged access - and replies are:

 Request       Reply Section  Details
 -------       -------------  -------
 version       VERSION        CGMiner=cgminer, version
                              API=API| version

 config        CONFIG         Some miner configuration information:
                              GPU Count=N, <- the number of GPUs
                              PGA Count=N, <- the number of PGAs
                              CPU Count=N, <- the number of CPUs
                              Pool Count=N, <- the number of Pools
                              ADL=X, <- Y or N if ADL is compiled in the code
                              ADL in use=X, <- Y or N if any GPU has ADL
                              Strategy=Name, <- the current pool strategy
                              Log Interval=N, <- log interval (--log N)
                              Device Code=GPU ICA , <- spaced list of compiled devices
                              OS=Linux/Apple/..., <- operating System
                              Failover-Only=true/false, <- failover-only setting
                              ScanTime=N, <- --scan-time setting
                              Queue=N, <- --queue setting
                              Expiry=N| <- --expiry setting

 summary       SUMMARY        The status summary of the miner
                              e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...|

 pools         POOLS          The status of each pool
                              e.g. Pool=0,URL=,Status=Alive,...|

 devs          DEVS           Each available GPU, PGA and CPU with their details
                              e.g. GPU=0,Accepted=NN,MHS av=NNN,...,Intensity=D|
                              Last Share Time=NNN, <- standand long time in seconds
                               (or 0 if none) of last accepted share
                              Last Share Pool=N, <- pool number (or -1 if none)
                              Will not report PGAs if PGA mining is disabled
                              Will not report CPUs if CPU mining is disabled

 gpu|N         GPU            The details of a single GPU number N in the same
                              format and details as for DEVS

 pga|N         PGA            The details of a single PGA number N in the same
                              format and details as for DEVS
                              This is only available if PGA mining is enabled
                              Use 'pgacount' or 'config' first to see if there are any

 cpu|N         CPU            The details of a single CPU number N in the same
                              format and details as for DEVS
                              This is only available if CPU mining is enabled
                              Use 'cpucount' or 'config' first to see if there are any

 gpucount      GPUS           Count=N| <- the number of GPUs

 pgacount      PGAS           Count=N| <- the number of PGAs
                              Always returns 0 if PGA mining is disabled

 cpucount      CPUS           Count=N| <- the number of CPUs
                              Always returns 0 if CPU mining is disabled

 switchpool|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of switching pool N to the
                              highest priority (the pool is also enabled)
                              The Msg includes the pool URL

 enablepool|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of enabling pool N
                              The Msg includes the pool URL

 addpool|URL,USR,PASS (*)
               none           There is no reply section just the STATUS section
                              stating the results of attempting to add pool N
                              The Msg includes the pool URL
                              Use '\\' to get a '\' and '\,' to include a comma
                              inside URL, USR or PASS

 poolpriority|N,... (*)
               none           There is no reply section just the STATUS section
                              stating the results of changing pool priorities
                              See usage below

 disablepool|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of disabling pool N
                              The Msg includes the pool URL

 removepool|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of removing pool N
                              The Msg includes the pool URL
                              N.B. all details for the pool will be lost

 gpuenable|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of the enable request

 gpudisable|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of the disable request

 gpurestart|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of the restart request

 gpuintensity|N,I (*)
               none           There is no reply section just the STATUS section
                              stating the results of setting GPU N intensity to I

 gpumem|N,V (*)
               none           There is no reply section just the STATUS section
                              stating the results of setting GPU N memoryclock to V MHz

 gpuengine|N,V (*)
               none           There is no reply section just the STATUS section
                              stating the results of setting GPU N clock to V MHz

 gpufan|N,V (*)
               none           There is no reply section just the STATUS section
                              stating the results of setting GPU N fan speed to V%

 gpuvddc|N,V (*)
               none           There is no reply section just the STATUS section
                              stating the results of setting GPU N vddc to V

 save|filename (*)
               none           There is no reply section just the STATUS section
                              stating success or failure saving the cgminer config
                              to filename
                              The filename is optional and will use the cgminer
                              default if not specified

 quit (*)      none           There is no status section but just a single "BYE"
                              reply before cgminer quits

 notify        NOTIFY         The last status and history count of each devices problem
                              This lists all devices including those not supported
                              by the 'devs' command
                              e.g. NOTIFY=0,Name=GPU,ID=0,Last Well=1332432290,...|

 privileged (*)
               none           There is no reply section just the STATUS section
                              stating an error if you do not have privileged access
                              to the API and success if you do have privilege
                              The command doesn't change anything in cgminer

 pgaenable|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of the enable request
                              You cannot enable a PGA if it's status is not WELL
                              This is only available if PGA mining is enabled

 pgadisable|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of the disable request
                              This is only available if PGA mining is enabled

 pgaidentify|N (*)
               none           There is no reply section just the STATUS section
                              stating the results of the identify request
                              This is only available if PGA mining is enabled
                              and currently only BFL singles support this command
                              On a BFL single it will flash the led on the front
                              of the device for appoximately 4s
                              All other non BFL PGA devices will return a warning
                              status message stating that they dont support it
                              This adds a 4s delay to the BFL share being processed
                              so you may get a message stating that procssing took
                              longer than 7000ms if the request was sent towards
                              the end of the timing of any work being worked on
                              e.g.: BFL0: took 8438ms - longer than 7000ms
                              You should ignore this

 devdetails    DEVDETAILS     Each device with a list of their static details
                              This lists all devices including those not supported
                              by the 'devs' command
                              e.g. DEVDETAILS=0,Name=GPU,ID=0,Driver=opencl,...|

 restart (*)   none           There is no status section but just a single "RESTART"
                              reply before cgminer restarts

 stats         STATS          Each device or pool that has 1 or more getworks
                              with a list of stats regarding getwork times
                              The values returned by stats may change in future
                              versions thus would not normally be displayed
                              Device drivers are also able to add stats to the
                              end of the details returned

 check|cmd     COMMAND        Exists=Y/N, <- 'cmd' exists in this version
                              Access=Y/N| <- you have access to use 'cmd'

 failover-only|true/false (*)
               none           There is no reply section just the STATUS section
                              stating what failover-only was set to

 coin          COIN           Coin mining information:
                              Hash Method=sha256/scrypt,
                              Current Block Time=N.N, <- 0 means none
                              Current Block Hash=XXXX..., <- blank if none
                              LP=true/false| <- LP is in use on at least 1 pool

 debug|setting (*)
               DEBUG          Debug settings
                              The optional commands for 'setting' are the same as
                              the screen curses debug settings
                              You can only specify one setting
                              Only the first character is checked (case insensitive):
                              Silent, Quiet, Verbose, Debug, RPCProto, PerDevice,
                              WorkTime, Normal
                              The output fields are (as above):

 setconfig|name,N (*)
               none           There is no reply section just the STATUS section
                              stating the results of setting 'name' to N
                              The valid values for name are currently:
                              queue, scantime, expiry
                              N is an integer in the range 0 to 9999

When you enable, disable or restart a GPU or PGA, you will also get Thread messages
in the cgminer status window

The 'poolpriority' command can be used to reset the priority order of multiple
pools with a single command - 'switchpool' only sets a single pool to first priority
Each pool should be listed by id number in order of preference (first = most
Any pools not listed will be prioritised after the ones that are listed, in the
priority order they were originally
If the priority change affects the miner's preference for mining, it may switch

When you switch to a different pool to the current one (including by priority
change), you will get a 'Switching to URL' message in the cgminer status

Obviously, the JSON format is simply just the names as given before the '='
with the values after the '='

If you enable cgminer debug (-D or --debug) or, when cgminer debug is off,
turn on debug with the API command 'debug|debug' you will also get messages
showing some details of the requests received and the replies

There are included 4 program examples for accessing the API:

api-example.php - a php script to access the API
  usAge: php api-example.php command
 by default it sends a 'summary' request to the miner at
 If you specify a command it will send that request instead
 You must modify the line "$socket = getsock('', 4028);" at the
 beginning of "function request($cmd)" to change where it looks for cgminer
 a java program to access the API (with source code)
  usAge is: java API command address port
 Any missing or blank parameters are replaced as if you entered:
  java API summary 4028

api-example.c - a 'C' program to access the API (with source code)
  usAge: api-example [command [ip/host [port]]]
 again, as above, missing or blank parameters are replaced as if you entered:
  api-example summary 4028

miner.php - an example web page to access the API
 This includes buttons and inputs to attempt access to the privileged commands
 See the end of this API-README for details of how to tune the display
 and also to use the option to display a multi-rig summary


Feature Changelog for external applications using the API:

API V1.20

Modified API commands:
 'pools' - add 'Has Stratum', 'Stratum Active', 'Stratum URL'


API V1.19 (cgminer v2.7.6)

Added API commands:
 'pgaidentify|N' (only works for BFL Singles so far)

Modified API commands:
 'devs' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected',
              'Last Share Difficulty' to all devices
 'gpu|N' - add 'Diff1 Work', 'Difficulty Accepted',
              'Difficulty Rejected', 'Last Share Difficulty'
 'pga|N' - add 'Diff1 Work', 'Difficulty Accepted',
              'Difficulty Rejected', 'Last Share Difficulty'
 'notify' - add '*Dev Throttle' (for BFL Singles)
 'pools' - add 'Proxy Type', 'Proxy', 'Difficulty Accepted', 'Difficulty Rejected',
               'Difficulty Stale', 'Last Share Difficulty'
 'config' - add 'Queue', 'Expiry'
 'stats' - add 'Work Diff', 'Min Diff', 'Max Diff', 'Min Diff Count',
               'Max Diff Count' to the pool stats


API V1.18 (cgminer v2.7.4)

Modified API commands:
 'stats' - add 'Work Had Roll Time', 'Work Can Roll', 'Work Had Expire',
		'Work Roll Time' to the pool stats
 'config' - include 'ScanTime'


API V1.17 (cgminer v2.7.1)

Added API commands:

Modified API commands:
 'summary' - add 'Work Utility'
 'pools' - add 'Diff1 Shares'


API V1.16 (cgminer v2.6.5)

Added API commands:

Modified API commands:
 'config' - include failover-only state


API V1.15 (cgminer v2.6.1)

Added API commands:


API V1.14 (cgminer v2.5.0)

Modified API commands:
 'stats' - more icarus timing stats added
 'notify' - include new device comms error counter

The internal code for handling data was rewritten (~25% of the code)
Completely backward compatible


API V1.13 (cgminer v2.4.4)

Added API commands:

Support was added to cgminer for API access groups with the --api-groups option
It's 100% backward compatible with previous --api-access commands


API V1.12 (cgminer v2.4.3)

Modified API commands:
 'stats' - more pool stats added

Support for the ModMinerQuad FPGA was added


API V1.11 (cgminer v2.4.2)

Modified API commands:
 'save' no longer requires a filename (use default if not specified)

'save' incorrectly returned status E (error) on success before.
It now correctly returns S (success)


API V1.10 (cgminer v2.4.1)

Added API commands:

N.B. the 'stats' command can change at any time so any specific content
present should not be relied upon.
The data content is mainly used for debugging purposes or hidden options
in cgminer and can change as development work requires

Modified API commands:
 'pools' added "Last Share Time"


API V1.9 (cgminer v2.4.0)

Added API commands:

Modified API commands:
 'notify' corrected invalid JSON


API V1.8 (cgminer v2.3.5)

Added API commands:

Support for the ZTex FPGA was added


API V1.7 (cgminer v2.3.4)

Added API commands:

Modified API commands:
 'pools' added "User"

From API version 1.7 onwards, reply strings in JSON and Text have the
necessary escaping as required to avoid ambiguity
For JSON the 2 characters '"' and '\' are escaped with a '\' before them
For Text the 4 characters '|' ',' '=' and '\' are escaped the same way


API V1.6 (cgminer v2.3.2)

Added API commands:

Modified API commands:
 'devs' now includes Icarus and Bitforce FPGA devices
 'notify' added "*" to the front of the name of all numeric error fields
 'config' correct "Log Interval" to use numeric (not text) type for JSON

Support for Icarus and Bitforce FPGAs was added


API V1.5 was not released


API V1.4 (Kano's interim release of cgminer v2.3.1)

Added API commands:

Modified API commands:
 'config' added "Device Code" and "OS"

Added "When" to the STATUS reply section of all commands


API V1.3 (cgminer v2.3.1-2)

Added API commands:

Modified API commands:
 'devs'/'gpu' added "Total MH" for each device
 'summary' added "Total MH"


API V1.2 (cgminer v2.3.0)

Added API commands:

Modified API commands:
 'config' added "Log Interval"

Starting with API V1.2, any attempt to access a command that requires
privileged security, from an IP address that does not have privileged
security, will return an "Access denied" Error Status


API V1.1 (cgminer v2.2.4)

There were no changes to the API commands in cgminer v2.2.4,
however support was added to cgminer for IP address restrictions
with the --api-allow option


API V1.1 (cgminer v2.2.2)

Prior to V1.1, devs/gpu incorrectly reported GPU0 Intensity for all GPUs

Modified API commands:
 'devs'/'gpu' added "Last Share Pool" and "Last Share Time" for each device


API V1.0 (cgminer v2.2.0)

Remove default CPU support

Added API commands:


API V0.7 (cgminer v2.1.0)

Initial release of the API in the main cgminer git




miner.php is a PHP based interface to the cgminer RPC API
(referred to simply as the API below)

It can show rig details, summaries and input fields to allow you to change
You can also create custom summary pages with it

It has two levels to the security:
1) cgminer can be configured to allow or disallow API access and access level
   security for miner.php
2) miner.php can be configured to allow or disallow privileged cgminer
   access, if cgminer is configured to allow privileged access for miner.php


To use miner.php requires a web server with PHP

Basics: On xubuntu 11.04, to install apache2 and php, the commands are:
 sudo apt-get install apache2
 sudo apt-get install php5
 sudo /etc/init.d/apache2 reload

On Fedora 17:
 yum install httpd php
 systemctl restart httpd.service
 systemctl enable httpd.service --system

On windows there are a few options.
Try one of these (I've never used either one)


The basic cgminer option to enable the API is:


or in your cgminer.conf

 "api-listen" : true,

(without the ',' on the end if it is the last item)

If the web server is running on the cgminer computer, the above
is the only change required to give miner.php basic access to
the cgminer API


If the web server runs on a different computer to cgminer,
you will also need to tell cgminer to allow the web server
to access cgminer's API and tell miner.php where cgminer is

Assuming a.b.c.d is the IP address of the web server, you
would add the following to cgminer:

 --api-listen --api-allow a.b.c.d

or in your cgminer.conf

 "api-listen" : true,
 "api-allow" : "a.b.c.d",

to tell cgminer to give the web server read access to the API

You also need to tell miner.php where cgminer is.
Assuming cgminer is at IP address e.f.g.h, then you would
edit miner.php and change the line

 $rigs = array('');


 $rigs = array('e.f.g.h:4028');

See --api-network or --api-allow for more access details
and how to give write access


Once you have a web server with PHP running

 copy your miner.php to the main web folder

On Xubuntu 11.04

On Fedora 17

On Windows
 see your windows Web/PHP documentation

Assuming the IP address of the web server is a.b.c.d
Then in your web browser go to:


Done :)


The rest of this documentation deals with the more complex
functions of miner.php, using myminer.php, creaing custom
summaries and displaying multiple cgminer rigs


If you create a file called myminer.php in the same web folder
where you put miner.php, miner.php will load it when it runs

This is useful, to put any changes you need to make to miner.php
instead of changing miner.php
Thus if you update/get a new miner.php, you won't lose the changes
you have made if you put all your changes in myminer.php
(and don't change miner.php at all)

A simple example myminer.php that defines 2 rigs
(that I will keep referring to further below) is:

$rigs = array('', '');

Changes in myminer.php superscede what is in miner.php
However, this is only valid for variables in miner.php before the
2 lines where myminer.php is included by miner.php:

 if (file_exists('myminer.php'))
Every variable in miner.php above those 2 lines, can be changed by
simply defining them in your myminer.php

So although miner.php originally contains the line

 $rigs = array('');

if you created the example myminer.php given above, it would actually
change the value of $rigs that is used when miner.php is running
i.e. you don't have to remove or comment out the $rigs line in miner.php
It will be superceded by myminer.php


The example.php above also shows how to define more that one rig to
be shown my miner.php

Each rig string is 2 or 3 values seperated by colons ':'
They are simply an IP address or host name, followed by the
port number (usually 4028) and an optional Name string

miner.php displays rig buttons that will show the defails of a single
rig when you click on it - the button shows either the rig number,
or the 'Name' string if you provide it

PHP arrays contain each string seperated by a comma, but no comma after
the last one

So an example for 3 rigs would be:

 $rigs = array('', '', '');

Of course each of the rigs listed would also have to have the API
running and be set to allow the web server to access the API - as
explained before


So basically, any variable explained below can be put in myminer.php
if you wanted to set it to something different to it's default value
and did not want to change miner.php itself every time you updated it

Below is each variable that can be changed and an explanation of each


 $dfmt = 'H:i:s j-M-Y \U\T\CP';

Define the date format used to print full length dates
If you get the string 'UTCP' on the end of your dates shown, that
means you are using an older version of PHP and you can instead use:
 $dfmt = 'H:i:s j-M-Y \U\T\CO';

The PHP documentation on the date format is here:


 $title = 'Mine';

Web page title
If you know PHP you can of course use code to define it e.g.
 $title = 'My Rig at: '.date($dfmt);

Which would set the web page title to something like:
 My Rig at: 10:34:00 22-Aug-2012 UTC+10:00


 $readonly = false;

Set $readonly to true to force miner.php to be readonly
This means it won't allow you to change cgminer even if the cgminer API
options allow it to

If you set $readonly to false then it will check cgminer 'privileged'
and will show input fields and buttons on the single rig page
allowing you to change devices, pools and even quit or restart

However, if the 'privileged' test fails, the code will set $readonly to


 $notify = true;

Set $notify to false to NOT attempt to display the notify command
table of data

Set $notify to true to attempt to display the notify command on
the single rig page
If your older version of cgminer returns an 'Invalid command'
coz it doesn't have notify - it just shows the error status table


 $checklastshare = true;

Set $checklastshare to true to do the following checks:
If a device's last share is 12x expected ago then display as an error
If a device's last share is 8x expected ago then display as a warning
If either of the above is true, also display the whole line highlighted
This assumes shares are 1 difficulty shares

Set $checklastshare to false to not do the above checks

'expected' is calculated from the device MH/s value
So for example, a device that hashes at 380MH/s should (on average)
find a share every 11.3s
If the last share was found more than 11.3 x 12 seconds (135.6s) ago,
it is considered an error and highlighted
If the last share was found more than 11.3 x 8 seconds (90.4s) ago,
it is considered a warning and highlighted

The default highlighting is very subtle


 $poolinputs = false;

Set $poolinputs to true to show the input fields for adding a pool
and changing the pool priorities on a single rig page
However, if $readonly is true, it will not display them


 $rigs = array('');

Set $rigs to an array of your cgminer rigs that are running
 format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name'
If you only have one rig, it will just show the detail of that rig
If you have more than one rig it will show a summary of all the rigs
 with buttons to show the details of each rig -
 the button contents will be 'Name' rather than rig number, if you
 specify 'Name'
e.g. $rigs = array('','');


 $rigipsecurity = true;

Set $rigipsecurity to false to show the IP/Port of the rig
in the socket error messages and also show the full socket message


 $rigtotals = true;
 $forcerigtotals = false;

Set $rigtotals to true to display totals on the single rig page
'false' means no totals (and ignores $forcerigtotals)

If $rigtotals is true, all data is also right aligned
With false, it's as before, left aligned

This option is just here to allow people to set it to false
if they prefer the old non-total display when viewing a single rig

Also, if there is only one line shown in any section, then no
total will be shown (to save screen space)
You can force it to always show rig totals on the single rig page,
even if there is only one line, by setting $forcerigtotals = true;


 $socksndtimeoutsec = 10;
 $sockrcvtimeoutsec = 40;

The numbers are integer seconds

The defaults should be OK for most cases
However, the longer SND is, the longer you have to wait while
php hangs if the target cgminer isn't runnning or listening

RCV should only ever be relevant if cgminer has hung but the
API thread is still running, RCV would normally be >= SND

Feel free to increase SND if your network is very slow
or decrease RCV if that happens often to you

Also, on some windows PHP, apparently the $usec is ignored
(so usec can't be specified)


 $hidefields = array();

List of fields NOT to be displayed
You can use this to hide data you don't want to see or don't want
shown on a public web page
The list of sections are:
See the web page for the list of field names (the table headers)
It is an array of 'SECTION.Field Name' => 1

This example would hide the slightly more sensitive pool information:
Pool URL and pool username:
 $hidefields = array('POOL.URL' => 1, 'POOL.User' => 1);

If you just want to hide the pool username:
 $hidefields = array('POOL.User' => 1);


 $ignorerefresh = false;
 $changerefresh = true;
 $autorefresh = 0;

Auto-refresh of the page (in seconds) - integers only

$ignorerefresh = true/false always ignore refresh parameters
$changerefresh = true/false show buttons to change the value
$autorefresh = default value, 0 means dont auto-refresh


 $placebuttons = 'top';

Where to place the Refresh, Summary, Custom Pages, Quit, etc. buttons

Valid values are: 'top' 'bot' 'both'
 anything else means don't show them - case sensitive


 $miner_font_family = 'verdana,arial,sans';
 $miner_font_size = '13pt';

Change these to set the font and font size used on the web page


 $colouroverride = array();

Use this to change the web page colour scheme

See $colourtable in miner.php for the list of possible names to change

Simply put in $colouroverride, just the colours you wish to change

e.g. to change the colour of the header font and background
you could do the following:

 $colouroverride = array(
	'td.h color'		=> 'green',
	'td.h background'	=> 'blue'


 $allowcustompages = true;

Should we allow custom pages?
(or just completely ignore them and don't display the buttons)


OK this part is more complex: Custom Summary Pages

A custom summary page in an array of 'section' => array('FieldA','FieldB'...)

The section defines what data you want in the summary table and the Fields
define what data you want shown from that section

Standard sections are:

Fields are the names as shown on the headers on the normal pages

Fields can be 'name=new name' to display 'name' with a different heading
'new name'

There are also now joined sections:

These sections are an SQL join of the two sections and the fields in them
are named section.field where section. is the section the field comes from
See the example further down

Also note:
- empty tables are not shown
- empty columns (e.g. an unknown field) are not shown
- missing field data shows as blank
- the field name '*' matches all fields except in joined sections
  (useful for STATS and COIN)

There are 2 hard coded sections:
 DATE - displays a date table like at the start of 'Summary'
 RIGS - displays a rig table like at the start of 'Summary'

Each custom summary requires a second array, that can be empty, listing fields
to be totaled for each section
If there is no matching total data, no total will show


Looking at the Mobile example:

 $mobilepage = array(
  'DATE' => null,
  'RIGS' => null,
  'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 
			Accepted', 'Rejected=Rej', 'Utility'),
  'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.Status=Status',
			'DEVS.Temperature=Temp', 'DEVS.MHS av=MHS av',
			'DEVS.Accepted=Accept', 'DEVS.Rejected=Rej',
			'DEVS.Utility=Utility', 'NOTIFY.Last Not Well=Not Well'),
  'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', 'Last Share Time'));

 $mobilesum = array(
  'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'),
  'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Accepted', 'DEVS.Rejected', 'DEVS.Utility'),
  'POOL' => array('Accepted', 'Rejected'));

 $customsummarypages = array('Mobile' => array($mobilepage, $mobilesum));

This will show 5 tables (according to $mobilepage)
Each table will have the chosen details for all the rigs specified in $rigs

	A single box with the web server's current date and time

	A table of the rigs: description, time, versions etc


	This will use the API 'summary' command and show the selected fields:
		Elapsed, MHS av, Found Blocks, Accepted, Rejected and Utility
	However, 'Rejected=Rej' means that the header displayed for the 'Rejected'
	field will be 'Rej', instead of 'Rejected' (to save space)
	Same for 'Found Blocks=Blks' - to save space


	This will list each of the devices on each rig and display the list of
	fields as shown
	It will also include the 'Last Not Well' field from the 'notify' command
	so you know when the device was last not well

	You will notice that you need to rename each field e.g. 'DEVS.Name=Name'
	since each field name in the join between DEVS and NOTIFY is actually
	section.fieldname, not just fieldname

	The join code automatically adds 2 fields to each GPU device: 'Name' and 'ID'
	They don't exist in the API 'devs' output but I can correctly calculate
	them from the GPU device data
	These two fields are used to join DEVS to NOTIFY i.e. find the NOTIFY
	record that has the same Name and ID as the DEVS record and join them


	This will use the API 'pools' command and show the selected fields:
		POOL, Status, Accepted, Rejected, Last Share Time
	Again, I renamed the 'Rejected' field using 'Rejected=Rej', to save space

$mobilesum lists the sections and fields that should have a total
You can't define them for 'DATE' or 'RIGS' since they are hard coded tables
The example given:

	Show a total at the bottom of the columns for:
		MHS av, Found Blocks, Accepted, Rejected, Utility

	Firstly note that you use the original name i.e. for 'Rejected=Rej'
	you use 'Rejected', not 'Rej' and not 'Rejected=Rej'

	Secondly note that it simply adds up the fields
	If you ask for a total of a string field you will get the numerical
	sum of the string data


	Simply note in this join example that you must use the original field
	names which are section.fieldname, not just fieldname

	Show a total at the bottom of the columns for:
		Accepted and Rejected

	Again remember to use the original field name 'Rejected'
Top | Appendix A | Appendix B


See git repository ('git log') for full changelog.

Git repo can be found at:

Version 2.8.7 - October 29, 2012

- Fail on select() failing in stratum thread without needing to attempt
- Add share to stratum database before sending it again in case we get a
response from the pool before it's added.

Version 2.8.6 - October 29, 2012

- Shorten the initiate stratum connect timeout to 30 seconds.
- Shorten the stratum timeout on read to 90 seconds to detect unresponsive pool.
- Display best share difficulty on exit.
- Make stratum socket fail more robust on windows by disabling the send buffer.
- Reuse the same curl handle forcing a new connection instead of risking
- Add information about submission failure to stratum send.
- Only add stratum share to database if we succeeded in submitting it, with a
debug output saying it succeeded.
- Use keepalive with stratum sockets to improve its ability to detect broken
- Show only the URL in the status bar to avoid long prefixes making for extra
long lines.
- Display compact status in menu and update README to reflect current menu
- Add a compact display mode that does not list per device statistics in the
status window.
- Add blank spaces after best share displayed.
- Round a few static string arrays up to 4 byte boundaries for ARM.
- Display best share diff for scrypt as well.
- Show the best diff share as "best share" and add info to the README.
- Display the best diff share submitted so far.
- Redundant check.
- The work struct pointer in struct pc_data in findnonce is never freed yet
there is no need to allocate it separately so make struct work a static part of
the struct pc_data. s

Version 2.8.5 - October 23, 2012

- Handle crash exceptions by trying to restart cgminer unless the --no-restart
option is used.
- Switch queued count when choosing a different pool from a failed stratum pool
in getwork thread.
- Put a mandatory 5s wait between reattempting a getwork on failure to avoid
hammering requests.
- The ATI stream / AMD APP SDK environment variables appear to only interfere
with win32 builds so bypass them.
- Make sure to check pool stratum curl exists under lock before attempting any
recv to not risk dereferencing upon attempting to reinitiate stratum.
- Avoid redefining macros and align to 4 byte boundaries.
- API - add Stratum information to pools
- update FPGA-README for MMQ

Version 2.8.4 - October 18, 2012

- Time for dynamic is in microseconds, not ms.
- x86_64 builds of mingw32 are not supported directly and should just configure
as generic mingw32 builds since they're NOT 64 bit.
- Cope with both ATI stream and AMD APP SDK roots being set when building.
- Use 3 significant digits when suffix string is used and values are >1000.
- MMQ new initialisation (that works) and clocking control
- Get rid of unused warning for !scrypt.
- Use select on stratum send to make sure the socket is writeable.
- Cope with dval being zero in suffix_string and display a single decimal place
when significant digits is not specified but the value is greater than 1000.
- Pad out the suffix string function with zeroes on the right.
- Failure to calloc in bin2hex is a fatal failure always so just check for that
failure within the function and abort, simplifying the rest of the code.
- Provide locking around the change of the stratum curl structures to avoid
possible races.
- Bump opencl kernel version numbers.
- Remove atomic ops from opencl kernels given rarity of more than once nonce on
the same wavefront and the potential increased ramspeed requirements to use the
- Clear the pool idle flag in stratum when it comes back to life.
- Display correct share hash and share difficulty with scrypt mining.
- Use explicit host to BE functions in scrypt code instead of hard coding
byteswap everywhere.
- Show work target diff for scrypt mining.
- Ease the checking on allocation of padbuffer8 in the hope it works partially
anyway on an apparently failed call.
- Watch for buffer overflows on receiving data into the socket buffer.
- Round target difficulties down to be in keeping with the rounding of detected
share difficulties.
- Dramatically simplify the dynamic intensity calculation by oversampling many
runs through the opencl kernel till we're likely well within the timer
resolution on windows.
- String alignment to 4 byte boundaries and optimisations for bin<->hex
- In opencl_free_work, make sure to still flush results in dynamic mode.
- Align static arrays to 4 byte boundaries to appease ARM builds for stratum.

Version 2.8.3 - October 12, 2012

- Left align values that are suffix_string generated.
- Share_diff should not be converting the work data to hex.
- Off by one error.
- Prevent overflows of the port char array in extract_sockaddr.
- Disable stratum detection with scrypt.
- Use the suffix string function when displaying device hashrates.
- Be consistent with the get_statline function.
- Use the suffix string function for displaying hashrate with 4 significant
- Display the actual share diff next to the pool required diff, using a suffix
creation function to prevent values of >1000 being shown in their entirety.
- Fix 4 * 0 being 0 that would break dynamic intensity mode.
- Fix wrong byteswap macro being used on mingw32 which was breaking target
generation on stratum.

Version 2.8.2 - October 11, 2012

- Reinstate the history on dynamic intensity mode to damp fluctuations in
intensity but use an upper limit on how much the value can increase at any time
to cope with rare overflows.
- Create a fix-protocol option which prevents cgminer from switching to stratum
if it's detected.
- Simplify target generation code.
- Add support for client.get_version for stratum.
- Use a 64 bit unsigned integer on the diff target to generate the hex target.
- Update reconnect message to show whole address including port.
- Look for null values and parse correct separate array entries for url and port
with client reconnect commands for stratum.
- The command for stratum is client.reconnect, not mining.reconnect.
- Only copy the stratum url to the rpc url if an rpc url does not exist.
- Implement rudimentary mining.reconnect support for stratum.
- Ignore the value of stratum_active on calling initiate_stratum and assume
we're always trying to reinitiate it, and set the active flag to false in that
- stratum auth can be unset if we fail to authorise on subsequent calls to
auth_stratum which undoes the requirement of setting it in one place so set it
in pool_active.

Version 2.8.1 - October 8, 2012

- Use the stratum url as the rpc url advertised if we switch to it.
- Count an invalid nonce count as a hardware error on opencl.
- Count each stratum work item as local work.
- Cope with one stratum pool being the only active pool when it dies by sleeping
for 5 seconds before retrying to get work from it instead of getting work
- Detect stratum outage based on either select timing out or receiving an empty
buffer and properly re-establish connection by disabling the stratum_active
flag, coping with empty buffers in parse_stratum.

Version 2.8.0 - October 7, 2012

- Major upgrade - support for the stratum mining protocol.
- Fix various modminer warnings on mingw.
- Fix sign warning on windows build for bitforce.
- Cast socketfail to integer since SOCKET is an unsigned int on windows.
- Use strtod not strtol for bitforce temp backup.
- Cope with broken drivers returning nonsense values for bitforce temperatures.
- Minor warning fixes.
- Use the stratum thread to detect when a stratum pool has died based on no
message for 2 minutes.
- Only set the stratum auth flag once and once the stratum thread is started,
use that to set/unset the stratum active flag.
- Only hand off to stratum from getwork if we succeed in initiating the
- Target should only be 32 bytes copied.
- Use a static array for work submission data instead of stack memory.
- Clear the buffer data before sprinting to it.
- Clear work stratum strings before setting them and add them to debug output.
- Drop stratum connect failed message to verbose level only since it's a regular
probing message.
- TCP Keepalive in curl is only in very recent versions and not required with
regular messages on stratum anyway.
- Move stratum sockets to curl infrastructure with locking around send+recv to
begin support for proxies and ssl.
- Make detect stratum fail if a proxy has been set up.
- Stratum does not currently have any proxy support so do not try to switch to
stratum if a proxy has been specified.
- Windows doesn't work with MSG_PEEK on recv so move to a continuously updating
buffer for incoming messages.
- Alloca is unreliable on windows so use static arrays in util.c stratum code.
- Begin support for mingw stratum build.
- Add space to reject reason.
- Parse the reject reason where possible from stratum share submission.
- Pass json error value to share result function to be able to parse reject
reason in stratum.
- Don't try to parse unneeded parameters in response to mining.subscribe.
- Remove the sshare hash entry if we failed to send it.
- Change notify message to info level to avoid spamming repeatedly when a pool
is down.
- Check the stratum pool difference has not changed compared to the work diff
when testing whether a share meets the target or not and retarget if necessary.
- Bit error in target calculation for stratum.
- Set work_block in gen_stratum_work for when work is reused to avoid thinking
it's all stale.
- Offset the current block detection to the prev block hash.
- We should be testing for id_val, not id in parse stratum response.
- Make target on stratum scale to any size by clearing sequential bits according
to diff.
- Correct target calculation in gen_stratum_work.
- If a share result has an error code but still has an id, it is likely a
reject, not an error.
- Initiate stratum the first time in pool_active only, allowing us to switch to
it on getting a failed getwork and detecting the presence of stratum on the url
at that time.
- Use 5 second timeout on sock full for now as a temporary workaround.
- If no stratum url is set by the end of the detect stratum routine, copy the
sockaddr url.
- Make all buffers slightly larger to prevent overflow.
- Make the stratum recv buffer larger than the recvsize.
- Userpass needs to be copied to user and pass earlier to allow stratum
authorisation to work with it.
- Store a sockaddr url of the stripped url used in determining sockaddr to not
confuse it with the stratum url and fix build warnings.
- Decrease the queued count with stratum work once it's staged as well.
- Allow the stratum retry to initiate and auth stratum in pool_alive to make
sure the stratum thread is started.
- Avoid duplicating pool->rpc_url and setting pool->stratum_url twice to itself.
- Detect if a getwork based pool has the X-Stratum header on startup, and if so,
switch to the stratum based pool.
- Comment update.
- Minor message change.
- Create a work item from a "clean" request from stratum allowing the new block
to be detected and the appropriate block change message to be given.
- Use statically allocated stratum strings in struct work to cope with the
inability to safely deallocate dynamically allocated ram.
- Use the current pool when deciding whether to reuse work from a stratum source
rather than the work's previous pool.
- Copy the stratum url to the rpc url to avoid none being set.
- Provide locking around stratum send operations to avoid races.
- Submit shares from stratum through the abstracted submit share function
detecting what message they belong to and showing the data from the associated
work, and then deleting it from the hash.
- Use a more robust mechanism to obtain a \n terminated string over a socket.
- Abstract out share submit as a function to be useable by stratum.
- Rename parse_stratum to parse_method as it is only for stratum messages that
contain methods.
- Display stratum as mechanism in status line when current pool is running it.
- Count each stratum notify as a getwork equivalent.
- Correct nonce submitted with share.
- Extranonce2 should be added before coinbase2.
- We should be hashing the binary coinbase, not the hex one.
- Fix endianness of nonce submitted for stratum.
- Check that stratum is already active in initiate_stratum to avoid
de-authorising ourselves by subscribing again.
- Begin implementing a hash database of submissions and attempt sending results.
- Copy parameters from stratum work required for share submission.
- Set lagging flag on first adding a pool to prevent pool slow warning at
- Fix work->target being a 32 byte binary in gen_stratum_work.
- Store and display stripped url in its own variable.
- Create machinery to divert work requests to stratum.
- Generate the work target in gen_stratum_work, setting default diff to 1 in
case it is not yet set.
- Generate work data, midstate and hash1 in gen_stratum_work.
- Generate header created from stratum structures in gen_stratum_work.
- Generate merkle root hash in gen_stratum_work.
- Generate the coinbase for generation of stratum based work.
- The number of transactions is variable so make merkle a variable length
dynamically allocated array and track how many there are for stratum.
- Rename nonce2 to n2size reflecting that it's a size variable and not the
actual nonce.
- Provide rudimentary support for stratum clean work command in the stratum
- Cope with pools being removed in the stratum thread.
- Use the pool sock value directly in the stratum thread in case it changes
after reconnecting.
- Create a stratum thread per pool that has stratum that monitors the socket and
serves received data.
- Check return value of stratum_parse.
- Complete authorisation in stratum.
- Implement stratum parsing of notify parameters and storing them in the pool
stratum work structure.
- Create helper functions for duplicating json strings to avoid keeping json
references in use.
- Append \n in the sock_send function instead of adding it when constructing
json in stratum.
- Don't keep any json references around with stratum structures.
- Create parse_stratum function that hands off stratum parameters to other
functions to manage pool stratum work struct variables. Implement mining
difficulty setting.
- Create helper functions for checking when a socket is ready to read on and
receive a single line at a time. Begin stratum authorisation process.
- Provide a helper function for reading a single \n terminated string from a
- Create a stratum work structure to store current work variables.
- Test specifically for stratum being active in pool_active.
- Detect stratum in common place when adding urls, and use a bool to tell us
when it's active.
- Fix warnings.
- Extract and store various parameters on stratum init confirming successful
mining notify.
- Use existing socket macros and close the socket on failure in init stratum.
- Initiate stratum and grab first json result.
- Get detailed addressinfo from the parsed URL for future raw socket usage when
possible. IPV4 only for now.
- Prepare for getaddrinfo call.
- Add data structures to pool struct for socket communications.
- Put all socket definitions in util.h to allow reusing by added socket
functions to be used in util.c.

Version 2.7.7 - October 7, 2012

- Fix unused warnings on ming build.
- Fix sign warning in ocl.c
- fds need to be zeroed before set in modminer.
- Put scrypt warning on separate line to avoid 0 being shown on windows as
- Display correct pool number when block is found.
- Prevent corrupt values returned from the opencl code from trying to read
beyond the end of the buffer by masking the value to a max of 15.
- Icarus USB write failure is also a comms error
- api.c DEBUG message has no paramter
- Icarus catch more USB errors and close/reopen the port
- API-README update cgminer verison number
- hashmeter fix stats kh/s on 32bit windows

Version 2.7.6 - September 24, 2012

- Reorder libztex header include order to fix missing struct definition.
- Display share difficulty on log with a shortened hash display on submission.
- API stats add some pool getwork difficulty stats
- Ignore any pings pushed to the worker threads if the thread is still paused to
prevent it being enabled and disabled repeatedly.
- README - FAQ - usermod group - shouldn't remove other groups
- Test for sequential getwork failures on a pool that might actually be up but
failing to deliver work as we may end up hammering it repeatedly by mistake.
- reduce windows compile warnings
- util.c - bug - proxy - no data end condition
- As we average gpu time over 5 work intervals for dynamic GPU intensity, there
is no need to maintain a rolling average and it avoids the potential long term
corruption of a single overflow value.
- Test for the now-automatically exported variable AMDAPPSDKROOT when looking
for the presence of the OpenCL headers.
- API don't change 'Diff1 Shares' - backward compatability FTW
- miner.php highlighting correctly handling difficulty
- API - Add last share difficulty for devices and pool
- Store and report Accepted,Rejected,Stale difficulty in the summary and API
- WorkTime - display prevblock for scrypt
- api.c remove compile warnings
- Calculate work difficulty for each getwork and display with WorkTime debug
- remove MMQ unused variable warning
- FPGA - allow long or short device names in detect code + style police
- WorkTime - multiple nonce per work and identify the work source
- Optional WorkTime details with each Accepted/Rejected work item
- Icarus - ignore hardware errors in timing mode
- miner.php oops - mistype
- miner.php by default don't display IP/Port numbers in error messages
- api.c all STATUS messages automatically escaped
- api.c add missing escape for comma in MSG_PGAUNW
- API add display of and setting queue,scantime,expiry
- HW: dont submit bad shares
- save individual pool proxy settings to config
- --default-config - allow command line to define the default configuration file
for loading and saving
- API-README update for pools proxy info
- README URL proxy must use quote so show in the example
- bug: remove proxy: from the front of the proxy used
- CURL support for individual proxy per pool and all proxy types
- README spelling/etc
- README - FPGA device FAQ
- HW: error counter auto for all devices - ztex code not fixed
- API pgaidentify - unsupported message should be a warning
- API/BFL identify a device - currently only BFL to flash the led
- BFL add throttle count to internal stats + API
- BFL: missing device id in log message
- miner.php correct to new Diff1 Work field names
- API add device diff1 work
- API-README update
- api.c Correct diff1 field name
- count device diff1 shares
- API-README more debug parameter information
- API allow full debug settings control

Version 2.7.5 - August 31, 2012

- Adjust opencl intensity when adjusting thread count to prevent it getting
pegged at a value below the minimum threads possible.
- miner.h max_hashes -> int64_t
- Keep the local block number in the blocks structs stored and sort them by
number to guarantee we delete the oldest when ageing the block struct entries.
- Use correct sdk version detection for SDK 2.7
- Revert "Pick worksize 256 with Cypress if none is specified."
- Test for lagging once more in queue_request to enable work to leak to backup
- There is no need to try to switch pools in select_pool since the current pool
is actually not affected by the choice of pool to get work from.
- Only clear the pool lagging flag if we're staging work faster than we're using
- needed flag is currently always false in queue_request. Remove it for now.
- thr is always NULL going into queue_request now.

Version 2.7.4 - August 23, 2012

- Perform select_pool even when not lagging to allow it to switch back if needed
to the primary.
- Simplify macros in output kernels avoiding apparent loops and local variables.
- Carry the needed bool over the work command queue.
- Move the decision to queue further work upstream before threads are spawned
based on fine grained per-pool stats and increment the queued count immediately.
- Track queued and staged per pool once again for future use.
- OpenCL 1.0 does not have native atomic_add and extremely slow support with
atom_add so detect opencl1.0 and use a non-atomic workaround.
- Pools: add RollTime info to API 'stats' and 'Stats' button in miner.php

Version 2.7.3 - August 22, 2012

- Minimise the number of getwork threads we generate.

Version 2.7.2 - August 22, 2012

- Pick worksize 256 with Cypress if none is specified.
- Give warning with sdk2.7 and phatk as well.
- Whitelist sdk2.7 for diablo kernel as well.
- Only keep the last 6 blocks in the uthash database to keep memory usage
constant. Storing more is unhelpful anyway.
- BFL Flash - always distribute source
- Increase kernel versions signifying changed APIs.
- BFL flash - include source in builds and more FPGA-README
- Check we haven't staged work while waiting for a curl entry before proceeding.
- Use atomic ops to never miss a nonce on opencl kernels, including nonce==0,
also allowing us to make the output buffer smaller.
- Remove compile errors/warnings and document compile/usage in FPGA-README
- bitforce-firmware-flash.c by Luke-jr
- Ignore the submit_fail flag when deciding whether to recruit more curls or not
since we have upper bounds on how many curls can be recruited, this test is
redundant and can lead to problems.
- API-README update cgminer version number
- API-README fix groups P: example mistake
- API-README add COIN and other edits
- gpu->hit should be reset on new work as well.
- Do not add time to dynamic opencl calculations over a getwork.
- miner.php allow 'coin' is custom pages

Version 2.7.1 - August 21, 2012

- Update windows build instructions courtesy of sharky.
- Increase max curls to number of mining threads + queue * 2, accounting for up
and downstream comms.
- Queue enough requests to get started.
- There is no point trying to clone_work in get_work() any more since we clone
on every get_work_thread where possible.
- There is no point subtracting 1 from maxq in get_work_thread.
- Only set lagging flag once there are no staged work items.
- select_pool does not switch back to the primary once lagging is disabled.
- miner.php allow page title to be defined in myminer.php
- Free work before retrying in get_work_thread.
- Increment total work counter under mutex lock.
- Increment the queued count after the curl is popped in case there's a delay
waiting on curls and we think we've queued work when in fact we're waiting
- API new command 'coin' with mining information
- Do the dynamic timing in opencl code over a single pass through scanhash to
make sure we're only getting opencl times contributing to the measured inte
- Increase curl reaping time to 5 minutes since comms between  curl requests can
be 2 mins apart with lots of rolltime.
- No need for extra variable in hash_push.
- Remove short options -r and -R to allow them to be reused and remove readme
entries for deprecated options.
- Avoid attempting to recursively lock the console mutex by disabling warnings
in gpu_fanpercent when fanspeed monitoring fails on windows. Debugged by l
- Deprecate the opt_fail_pause parameter, leaving a null placeholder for
existing configurations.
- Don't pause after failed getwork, set lagging flag and reassess.
- Add message to share if it's a resubmit.
- We should not be pausing in trying to resubmit shares.
- Get rid of the extending fail pause on failed connects since we discard work
after a period.
- get_work always returns true so turn it into a void function.
- get_work never returns false so get rid of fail pause loop.
- Get rid of pause and retry from get_upstream_work so we only do it from one
- Deprecate the opt_retries feature as no one wants cgminer to automatically
abort. Leave a null placeholder for configurations that still have it.
- Reinstate fix ADL gpu-map not working when there are more ADL devices than
openCL patch by Nite69. Add virtual adl mapping for when none is specified o
- miner.php show summary Diff1 Shares total
- miner.php fix Work Utility totals
- miner.php format new Work Utility and Diff1 Shares
- API V1.17 show Work Utility and Diff1 Shares

Version 2.7.0 - August 18, 2012

- Introduce a new statistic, Work Utility, which is the number of difficulty 1
shares solved per minute. This is useful for measuring a relative rate of work
that is independent of reject rate and target difficulty.
- Implement a new pool strategy, BALANCE, which monitors work performed per pool
as a rolling average every 10 minutes to try and distribute work evenly over all
the pools. Do this by monitoring diff1 solutions to allow different difficulty
target pools to be treated equally, along with solo mining. Update the
documentation to describe this strategy and more accurately describe the
load-balance one.
- Getwork fail was not being detected. Remove a vast amount of unused variables
and functions used in the old queue request mechanism and redefine the getfail
- Don't try to start devices that don't support scrypt when scrypt mining.
- 0 is a valid return value for read so only break out if read returns -1.
- Consider us lagging only once our queue is almost full and no staged work.
- Simplify the enough work algorithm dramatically.
- Only queue from backup pools once we have nothing staged.
- Don't keep queueing work indefinitely if we're in opt failover mode.
- Make sure we don't opt out of queueing more work if all the queued work is
from one pool.
- Set lagging flag if we're on the last of our staged items.
- Reinstate clone on grabbing work.
- Grab clones from hashlist wherever possible first.
- Cull all the early queue requests since we request every time work is popped
- Keep track of staged rollable work item counts to speed up clone_available.
- Make expiry on should_roll to 2/3 time instead of share duration since some
hardware will have very fast share times.
- Do the cheaper comparison first.
- Check that we'll get 1 shares' worth of work time by rolling before saying we
should roll the work.
- Simplify all those total_secs usages by initialising it to 1 second.
- Overlap queued decrementing with staged incrementing.
- Artificially set the pool lagging flag on pool switch in failover only mode as
- Artificially set the pool lagging flag on work restart to avoid messages about
slow pools after every longpoll.
- Factor in opt_queue value into enough work queued or staged.
- Roll work whenever we can on getwork.
- Queue requests for getwork regardless and test whether we should send for a
getwork from the getwork thread itself.
- Get rid of age_work().
- 0 is a valid return value for read so only break out if read returns -1.
- Offset libusb reads/writes by length written as well in ztex.
- Cope with timeouts and partial reads in ztex code.
- fpga serial I/O extra debug (disabled by default)

Version 2.6.5 - August 15, 2012

- Don't try to get bitforce temperature if we're polling for a result to
minimise the chance of interleaved responses.
- Set memory clock based on memdiff if present from with engine changes,
allowing it to parallel manual changes from the menu as well.
- Increase the timeout on bitforce as per Paul Sheppard's suggestion to account
for throttling + work time + excess.
- Fix ADL gpu-map not working when there are more ADL devices than openCL.
Initial patch supplied by Nite69. Modified to suit.
- Windows' timer resolution is limited to 15ms accuracy. This was breaking
dynamic intensity since it tries to measure below this. Since we are repeatedly
sampling similar timeframes, we can average the gpu_us result over 5 different
values to get very fine precision.
- Fix harmless unused warnings in scrypt.h.
- api.c typo
- API allow display/change failover-only setting
- Check we are not lagging as well as there is enough work in getwork.
- Minimise locking and unlocking when getting counts by reusing shared mutex
lock functions.
- Avoid getting more work if by the time the getwork thread is spawned we find
ourselves with enough work.
- The bitforce buffer is cleared and hw error count incremented on return from a
failed send_work already so no need to do it within the send_work function.
- miner.php allow a custom page section to select all fields with '*' - e.g. to
create a STATS section on a custom page
- Escape " and \ when writing json config file
- miner.php optional single rig totals (on by default)

Version 2.6.4 - August 7, 2012

- Convert the serial autodetect functions to use int instead of char to
enumerate devices.
- Make the serial open timeout for BFL generically 1 second on windows.
- Deuglify windows autodetect code for BFL.
- There is no point zeroing temperature in BFL if we fail to get a response, and
we should register it as a HW error, suggesting throttling.
- Update SCRYPT README with information about HW errors.
- Use the scrypt CPU code to confirm results from OCL code, and mark failures as
HW errors, making it easier to tune scrypt parameters.
- We may as well leave one curl still available per pool instead of reaping the
last one.
- Need to recheck the pool->curls count on regaining the pool lock after the
pthread conditional wait returns.
- Display reaped debug message outside mutex lock to avoid recursive locking.
- Add specific information when ADL detects error -10 saying the device is not
- api.c update API start message and include port number
- miner.php ignore arg when readonly
- miner.php allow pool inputs: delete, addpool, poolpriority

Version 2.6.3 - August 5, 2012

- Count likely throttling episodes on bitforce devices as hardware errors.
- Style cleanups.
- Use FTD2XX.DLL on Windows to autodetect BitFORCE SHA256 devices.
- Make pool_disabled the first in the enums == 0, fixing the pool enabled count
which compares if value is not enabled before enabling it.
- Correct writing of scrypt parameters to config file based on command line
parameters only.
- Use different variables for command line specified lookup gap and thread
concurrency to differentiate user defined versus auto chosen values.
- Queue a request on pool switch in case we have no work from the new pool yet.
- Display failover only mode in pool menu and allow it to be toggled live.
- Reinstate check for system queueing lag when the current pool's queue is maxed
out, there is no staged work, and the work is needed now.
- There is no need for pool active testing to be mandatory any more with queue
request changes.
- Fix harmless warnings.
- Check the current staged and global queued as well before queueing requests.
Discard stales before ageing work in the watchdog thread. Queue requests after
discarding and ageing work in watchdog thread. Display accurate global queued in
curses output. Reuse variable in age_work().
- The queueing mechanism has become a complex state machine that is no longer
predictable. Rewrite it from scratch watching only current queues in flight and
staged work available on a pool by pool basis.
- API remove unused warning in non-GPU compile
- api.c in linux allow to open a closed socket in TIME_WAIT
- Queue an extra request whenever staged work drops below mining thread count in
- Update debian package configs to v2.6.2

Version 2.6.2 - August 3, 2012

- Scrypt mining does not support block testing yet so don't try to print it.
- Clear the bitforce buffer whenever we get an unexpected result as it has
likely throttled and we are getting cached responses out of order, and use the
temperature monitoring as a kind of watchdog to flush unexpected results.
- It is not critical getting the temperature response in bitforce so don't
mandatorily wait on the mutex lock.
- Check there is a cutoff temp actually set in bitforce before using it as a cut
off value otherwise it may think it's set to zero degrees.
- We dropped the temporary stopping of curl recruiting on submit_fail by
mistake, reinstate it.
- Make threads report in either side of the scanhash function in case we miss
reporting in when restarting work.
- Don't make mandatory work and its clones last forever.
- Make test work for pool_active mandatory work items to smooth out staged work
counts when in failover-only mode.
- Add debugging output when work is found stale as to why.
- Print the 3 parameters that are passed to applog for a debug line in
- Clear bitforce buffer on init as previously.
- Add some headroom to the number of curls available per pool to allow for
longpoll and sendwork curls.
- Revert "Revert "Change BFL driver thread initialising to a constant 100ms
delay between devices instead of a random arrangement.""
- Revert "Remove bitforce_thread_init"
- Show the correct base units on GPU summary.
- Differentiate between the send return value being a bool and the get return
value when managing them in bitforce scanhash.
- 23a8c60 Revert "bitforce: Skip out of sending work if work restart requested"

Version 2.6.1 - July 30, 2012

- Display scrypt as being built in as well.
- Fix build warning about KL_SCRYPT when built without scrypt support.
- Remove the low hash count determinant of hardware being sick. A low hash rate
can be for poor network connectivity or scrypt mining, neither of which are due
to a sick device.
- api.c poolpriority changes

Version 2.6.0 - July 29, 2012

- Display kilohash when suitable, but store the global mhash value still truly
in megahashes to not break the API output.
- Don't try and print curses output for devices that won't fit on the screen.
- Add scrypt documentation in the form of a separate readme.
- Fix build error without scrypt enabled.
- Limit total number of curls recruited per pool to the number of mining threads
to prevent blasting the network when we only have one pool to talk to.
- bitforce: Skip out of sending work if work restart requested
- Keep a counter of enabled pools and use that instead of iterating over the
pool list. Use that value to ensure we don't set the last remaining active pool
to the rejecting state.
- fpgautils: add support for 57.6 kBd serial
- miner.php add a socket RCV timeout for if cgminer is hung and the API thread
is still running
- Limit thread concurrency for scrypt to 5xshaders if shaders is specified.
- Simplify repeated use of gpus[gpu]. in ocl.c
- Find the nearest power of 2 maximum alloc size for the scrypt buffer that can
successfully be allocated and is large enough to accomodate the thread
concurrency chosen, thus mapping it to an intensity.
- Don't make opt_scrypt mandatory blocking with opencl code.
- Update kernel versions reflecting changes in the API.
- Make the thread concurrency and lookup gap options hidden on the command line
and autotune parameters with a newly parsed --shaders option.
- Fix target testing with scrypt kernel as it would have been missing shares
below target.
- Bugfix: Use a mutex to control non-curses output
- Simplify code to a single vprintf path for curses-less printing
- Move opt_quiet check to my_log_curses, so it works for curses-less builds
- Use log_generic for vapplog to cut down on code duplication
- Add space to log output now that there is more screen real estate available.
- BFL force all code to timeout to avoid hanging
- Bugfix: Copy argv[0] given to dirname()
- Always create the largest possible padbuffer for scrypt kernels even if not
needed for thread_concurrency, giving us some headroom for intensity levels.
- Use the detected maximum allocable memory on a GPU to determine the optimal
scrypt settings when lookup_gap and thread_concurrency parameters are not given.
- Check the maximum allocable memory size per opencl device.
- Add debugging output if buffer allocation fails for scrypt and round up
bufsize to a multiple of 256.
- Nonce testing for btc got screwed up, leading to no accepted shares. Fix it.
- Display size of scrypt buffer used in debug.
- Allow intensities up to 20 if scrypt is compiled in.
- Add name to scrypt kernel copyright.
- Allow lookup gap and thread concurrency to be passed per device and store
details in kernel binary filename.
- Ignore negative intensities for scrypt.
- Change the scale of intensity for scrypt kernel and fix a build warning.
- Correct target value passed to scrypt kernel.
- Use 256 output slots for kernels to allow 1 for each worksize.
- Test the target in the actual scrypt kernel itself saving further
- Reinstate GPU only opencl device detection.
- Decrease lookup gap to 1. Does not seem to help in any way being 2.
- Fix build.
- Make pad0 and pad1 local variable in scrypt kernel.
- Constify input variable in scrypt kernel.
- Send correct values to scrypt kernel to get it finally working.
- Create command queue before compiling program in opencl.
- Detach pthread from within the api thread in case it is terminated due to not
being instantiated before pthread_cancel is called from main, leading to a
- Debug output per thread hashrate is out by a factor of 1000.
- Initialise mdplatform.
- Find the gpu platform with the most devices and use that if no platform option
is passed.
- Allow more platforms to be probed if first does not return GPUs.
- Fix external scrypt algo missing.
- Limit scrypt to 1 vector.
- Handle KL_SCRYPT in config write.
- Get rid of stuff.
- Don't enqueuewrite buffer at all for pad8 and pass work details around for
scrypt in dev_blk.
- Set the correct data for cldata and prepare for pad8 fixes.
- Bugfix: Fix build without curses but with OpenCL
- Find the gpu platform with the most devices and use that if no platform option
is passed.
- Allow more platforms to be probed if first does not return GPUs.
- Get rid of spaces in arrays in scrypt kernel.
- Start with smaller amount of hashes in cpu mining to enable scrypt to return
today sometime.
- Show Khash hashrates when scrypt is in use.
- Free the scratchbuf memory allocated in scrypt and don't check if CPUs are
sick since they can't be. Prepare for khash hash rates in display.
- Add cpumining capability for scrypt.
- Set scrypt settings and buffer size in ocl.c code to be future modifiable.
- Cope with when we cannot set intensity low enough to meet dynamic interval by
inducing a forced sleep.
- Make dynamic and scrypt opencl calls blocking.
- Calculate midstate in separate function and remove likely/unlikely macros
since they're dependent on pools, not code design.
- bitforce: Use "full work" vs "nonce range" for kernel name
- Display in debug mode when we're making the midstate locally.
- Fix nonce submission code for scrypt.
- Make sure goffset is set for scrypt and drop padbuffer8 to something
manageable for now.
- Set up buffer8 for scrypt.
- Build fix for opt scrypt.
- Don't check postcalc nonce with sha256 in scrypt.
- Don't test nonce with sha and various fixes for scrypt.
- Make scrypt buffers and midstate compatible with cgminer.
- Use cgminer specific output array entries in scrypt kernel.
- Provide initial support for the scrypt kernel to compile with and mine scrypt
with the --scrypt option.
- Enable completely compiling scrypt out.
- Begin import of scrypt opencl kernel from reaper.
- bitforce_get_result returns -1 on error now.
- Check return value of read in BFgets
- Bugfix: Make our Windows nanosleep/sleep replacements standards-compliant
(which fixes nmsleep) and include compat.h for bitforce (for sleep)
- rpc: Use a single switch statement for both stringifications of cgpu->status
- Fix whitespace mangling.
- miner.php fix rig # when miners fail
- Only try to shut down work cleanly if we've successfully connected and started
- Use switch statement for cgpu->status and fix spelling.
- Abbrv. correction
- Bugfix: Don't declare devices SICK if they're just busy initialising
- Bugfix: Calculate nsec in nmsleep correctly
- Bugfix: Adapt OpenCL scanhash errors to driver API change (errors are now -1,
not 0)
- Remove superfluous ave_wait
- Put kname change for broken nonce-range back in
- Add average wait time to api stats
- Change BFL driver thread initialising to a constant 100ms delay between
devices instead of a random arrangement.
- Spelling typo.
- Time opencl work from start of queueing a kernel till it's flushed when
calculating dynamic intensity.
- Modify te scanhash API to use an int64_t and return -1 on error, allowing zero
to be a valid return value.
- Check for work restart after the hashmeter is invoked for we lose the hashes
otherwise contributed in the count.
- Remove disabled: label from mining thread function, using a separate
mt_disable function.
- Style changes.
- Missed one nonce-range disabling.
- Add average return time to api stats
- miner.php allow rig names in number buttons
- Remove bitforce_thread_init The delay thing does nothing useful... when long
poll comes around, all threads restart at the same time anyway.
- Change timeouts to time-vals for accuracy.
- fix API support for big endian machines
- Cope with signals interrupting the nanosleep of nmsleep.
- Use standard cfsetispeed/cfsetospeed to set baud rate on *nix
- miner.php split() flagged deprecated in PHP 5.3.0
- More BFL tweaks. Add delay between closing and reopening port. Remove buffer
clear in re-init Add kernel type (mini-rig or single)
- Make long timeout 10seconds on bitforce for when usleep or nanosleep just
can't be accurate...

Version 2.5.0 - July 6, 2012

- Fix --benchmark not working since the dynamic addition of pools and pool
- Make disabling BFL nonce range support a warning since it has to be explicitly
enabled on the command line now.
- miner.php allow renaming table headers
- Make bitforce nonce range support a command line option --bfl-range since
enabling it decrease hashrate by 1%.
- Add sanity checking to make sure we don't make sleep_ms less than 0 in
- The fastest minirig devices need a significantly smaller starting sleep time.
- Use a much shorter initial sleep time to account for faster devices and nonce
range working, and increase it if nonce range fails to work.
- Use nmsleep instead of usleep in bitforce.
- Provide a ms based sleep function that uses nanosleep to avoid the inaccuracy
of usleep on SMP systems.
- delay_time_ms is always set so need not be initialised in bitforce.
- Increase bitforce timeout to 10 seconds.
- Add more hysteresis and poll ~5 times to allow for timer delays in bitforce
- miner.php allow alternating line colours (off by default)
- Display the actual duration of wait when it is greater than the cutoff.
- Set nonce to maximum once we determine nonce range support is broken.
- Initial wait time is always known so no need to zero it beforehand in
- No point counting wait time until the work is actually sent to bitforce
- Use string comparison functions instead of explicit comparisons.
- Account for wait_ms time when nonce_range is in use on BFL.
- Split nonces up into 1/5 chunks when nonce range is supported.
- limit clear buffer iterations.
- Ad fd check to clear buffer.
- miner.php remove incorrect 'DATE' error message
- miner.php allow summary header in custom pages
- Disable nonce range support in BFL when broken support is detected.
- Restart_wait is only called with a ms value so incorporate that into the
- Only try to adjust dev width when curses is built in.
- miner.php define custom sum fields as a simple array
- Fix off-by-one error in nonce increment in bfl.
- Use BE when setting nonce in bitforce nonce range work.
- Enable nonce range in the normal init sequence for bfl.
- Queue extra work at 2/3 differently depending on whether we're using nonce
range or not.
- Initially enable support for nonce range support on bfl, splitting nonces up
into 3/4 size and only disable it if it fails on work submit.
- Attempt to detect nonce range support in BFL by sending work requring its
- Limit retrying on busy for up to BITFORCE_TIMEOUT_MS
- Attempt to initialise while bitforce device returns BUSY.
- Extend length of string that can be passed to BFL devices.
- Fix signedness warning.
- Adjust device width column to be consistent.
- Use cgpu-> not gpus[] in watchdog thread.
- Add api stats (sleep time)
- Timing tweaks Added long and short timeouts, short for detecting throttling,
long to give up totally. Reset sleep time when device re-initialised Still check
results after timeout Back up a larger time if result on first poll.
- Add API Notify counter 'Comms Error'
- Style police on api.c
- Do all logging outside of the bitforce mutex locking to avoid deadlocks.
- Remove applog call from bfwrite to prevent grabbing nested mutexes.
- Bitforce style changes.
- Minor style changes.
- Remove needless roundl define.
- Made JSON error message verbose.
- Fine-tune timing adjustment. Also remove old work_restart timing.
- Check for gpu return times of >= 0, not just 0, to fix intensity dropping to
- Restart is zeroed in the mining thread so no need to do it inside the bitforce
- More improvements to comms. BFL return nothing when throttling, so should not
be considered an error. Instead repeat with a longer delay.
- Polling every 10ms there's not much point checking the pthread_cond_timedwait
as it just adds overhead. Simply check the value of work_restart in the bfl main
polling loop.
- Use a pthread conditional that is broadcast whenever work restarts are
required. Create a generic wait function waiting a specified time on that
conditional that returns if the condition is met or a specified time passed to
it has elapsed. Use this to do smarter polling in bitforce to abort work, queue
more work, and check for results to minimise time spent working needlessly.
- Add busy time to wait time.
- api.c put version up to 1.14
- Add tiny delay after writing to BFL Change BFL errors to something more human
readable Send work busy re-tries after 10ms delay

Version 2.4.4 - July 1, 2012

- Fix builds on non gnu platforms.
- api.c ensure old mode is always available when not using --api-groups + quit()
on param errors
- Implement rudimentary X-Mining-Hashrate support.
- Detect large swings in temperature when below the target temperature range and
change fan by amounts dependant on the value of tdiff.
- Adjust the fanspeed by the magnitude of the temperature difference when in the
optimal range.
- Revert "Restarting cgminer from within after ADL has been corrupted only leads
to a crash. Display a warning only and disable fanspeed monitoring."
- api.c fix json already closed
- implement and document API option --api-groups
- Put upper bounds to under 2 hours that work can be rolled into the future for
bitcoind will deem it invalid beyond that.
- define API option --api-groups
- api.c allow unwell devices to be enabled so they can be cured
- miner.php - fix/enable autorefresh for custom pages
- miner.php allow custom summary pages - new 'Mobile' summary
- Work around pools that advertise very low expire= time inappropriately as this
leads to many false positives for stale shares detected.
- Only show ztex board count if any exist.
- There is no need for work to be a union in struct workio_cmd
- fpgautils.c include a debug message for all unknown open errors
- Don't keep rolling work right up to the expire= cut off. Use 2/3 of the time
between the scantime and the expiry as cutoff for reusing work.
- Log a specific error when serial opens fail due to lack of user permissions
- Increase GPU timing resolution to microsecond and add sanity check to ensure
times are positive.
- Opencl code may start executing before the clfinish order is given to it so
get the start timing used for dynamic intensity from before the kernel is
- fpgautils.c - set BAUD rate according to termio spec
- fpgautils.c - linux ordering back to the correct way
- miner.php remove unneeded '.'s
- miner.php add auto refresh options
- miner.php add 'restart' next to 'quit'
- miner.php make fontname/size configurable with myminer.php
- Make the pools array a dynamically allocated array to allow unlimited pools to
be added.
- Make the devices array a dynamically allocated array of pointers to allow
unlimited devices.
- Dynamic intensity for GPUs should be calculated on a per device basis. Clean
up the code to only calculate it if required as well.
- Use a queueing bool set under control_lock to prevent multiple calls to
queue_request racing.
- Use the work clone flag to determine if we should subtract it from the total
queued variable and provide a subtract queued function to prevent looping over
locked code.
- Don't decrement staged extras count from longpoll work.
- Count longpoll's contribution to the queue.
- Increase queued count before pushing message.
- Test we have enough work queued for pools with and without rolltime
- As work is sorted by age, we can discard the oldest work at regular intervals
to keep only 1 of the newest work items per mining thread.
- Roll work again after duplicating it to prevent duplicates on return to the
clone function.
- Abstract out work cloning and clone $mining_threads copies whenever a rollable
work item is found and return a clone instead.
- api.c display Pool Av in json
- Take into account average getwork delay as a marker of pool communications
when considering work stale.
- Work out a rolling average getwork delay stored in pool_stats.
- Getwork delay in stats should include retries for each getwork call.
- Walk through the thread list instead of searching for them when disabling
threads for dynamic mode.
- Extend nrolltime to support the expiry= parameter. Do this by turning the
rolltime bool into an integer set to the expiry time. If the pool supports
rolltime but not expiry= then set the expiry time to the standard scantime.
- When disabling fanspeed monitoring on adl failure, remove any twin GPU
association. This could have been leading to hangs on machines with dual GPU
cards when ADL failed.
- modminer: Don't delay 2nd+ FPGAs during work restart
- Disable OpenCL code when not available.
- Fix openwrt crashing on regeneratehash() by making check_solve a noop.
- FPGA - allow device detect override without an open failure
- Fix sign warning.

Version 2.4.3 - June 14, 2012

- can_roll and should_roll should have no bearing on the cycle period within the
miner_thread so remove it.
- Check for strategy being changed to load balance when enabling LPs.
- Check that all threads on the device that called get_work are waiting on
getwork before considering the pool lagging.
- Iterate over each thread belonging to each device in the hashmeter instead of
searching for them now that they're a list.
- When using rotate pool strategy, ensure we only select from alive enabled
- Start longpoll from every pool when load balance strategy is in use.
- Add mandatory and block fields to the work struct. Flag any shares that are
detected as blocks as mandatory to submit, along with longpoll work from a
previously rejecting pool.
- Consider the fan optimal if fanspeed is dropping but within the optimal speed
- Fix typo in some API messages (succeess/success)
- api.c MMQ stat bugs
- Bugfix: Fix warnings when built without libudev support
- Bugfix: slay a variety of warnings
- Bugfix: modminer: Fix unsigned/signed comparison and similar warnings
- API add ModMinerQuad support
- Bugfix: Honour forceauto parameter in serial_detect functions
- modminer: Temperature sensor improvements
- modminer: Make log messages more consistent in format
- Only adjust GPU speed up if the fanspeed is within the normal fanrange and
hasn't been turned to maximum speed under overheat conditions.
- ModMiner use valid .name
- New driver: BTCFPGA ModMiner
- Abstract generally useful FPGA code into fpgautils.c
- API add stats for pool getworks
- miner.php option to hide specific fields from the display
- miner.php add version numbers to the summary page
- Update debian configs to v2.4.2
- Add API and FPGA READMEs into Makefile to be included in source distribution.
- Icarus - fix unit64_t printf warnings

Version 2.4.2 - June 2, 2012

- API.class compiled with Java SE 6.0_03 - works with Win7x64
- miner.php highlight devs too slow finding shares (possibly failing)
- API update version to V1.11 and document changes
- API save default config file if none specified
- api.c save success incorrectly returns error
- api.c replace BUFSIZ (linux/windows have different values)
- Move RPC API content out of README to API-README
- Open a longpoll connection if a pool is in the REJECTING state as it's the
only way to re-enable it automatically.
- Use only one longpoll as much as possible by using a pthread conditional
broadcast that each longpoll thread waits on and checks if it's the current pool
- If shares are known stale, don't use them to decide to disable a pool for
sequential rejects.
- Restarting cgminer from within after ADL has been corrupted only leads to a
crash. Display a warning only and disable fanspeed monitoring.
- Icarus: fix abort calculation/allow user specified abort
- Icarus: make --icarus-timing hidden and document it in FPGA-README
- Icarus: high accuracy timing and other bitstream speed support
- add-MIPSEB-to-icarus-for-BIG_ENDIAN
- work_decode only needs swab32 on midstate under BIG ENDIAN
- add compile command to api-example.c
- save config bugfix: writing an extra ',' when no gpus
- Add dpkg-source commits

Version 2.4.1 - May 6, 2012

- In the unlikely event of finding a block, display the block solved count with
the pool it came from for auditing.
- Display the device summary on exit even if a device has been disabled.
- Use correct pool enabled enums in api.c.
- Import Debian packaging configs
- Ensure we test for a pool recovering from idle so long as it's not set to
- Fix pool number display.
- Give cgminer -T message only if curses is in use.
- Reinit_adl is no longer used.
- API 'stats' allow devices to add their own stats also for testing/debug
- API add getwork stats to cgminer - accesable from API 'stats'
- Don't initialise variables to zero when in global scope since they're already
- Get rid of unitialised variable warning when it's false.
- Move a pool to POOL_REJECTING to be disabled only after 3 minutes of
continuous rejected shares.
- Some tweaks to reporting and logging.
- Change FPGA detection order since BFL hangs on an ICA
- API support new pool status
- Add a temporarily disabled state for enabled pools called POOL_REJECTING and
use the work from each longpoll to help determine when a rejecting pool has
started working again. Switch pools based on the multipool strategy once a pool
is re-enabled.
- Removing extra debug
- Fix the benchmark feature by bypassing the new networking code.
- Reset sequential reject counter after a pool is disabled for when it is
- Icarus - correct MH/s and U: with work restart set at 8 seconds
- ztex updateFreq was always reporting on fpga 0
- Trying harder to get 1.15y working
- Specifying threads on multi fpga boards extra cgpu
- Missing the add cgpu per extra fpga on 1.15y boards
- API add last share time to each pool
- Don't try to reap curls if benchmarking is enabled.

Version 2.4.0 - May 3, 2012

- Only show longpoll warning once when it has failed.
- Convert hashes to an unsigned long long as well.
- Detect pools that have issues represented by endless rejected shares and
disable them, with a parameter to optionally disable this feature.
- Bugfix: Use a 64-bit type for hashes_done (miner_thread) since it can overflow
32-bit on some FPGAs
- Implement an older header fix for a label existing before the pthread_cleanup
- Limit the number of curls we recruit on communication failures and with
delaynet enabled to 5 by maintaining a per-pool curl count, and using a pthread
conditional that wakes up when one is returned to the ring buffer.
- Generalise add_pool() functions since they're repeated in add_pool_details.
- Bugfix: Return failure, rather than quit, if BFwrite fails
- Disable failing devices such that the user can attempt to re-enable them
- Bugfix: thread_shutdown shouldn't try to free the device, since it's needed
- API bool's and 1TBS fixes
- Icarus - minimise code delays and name timer variables
- api.c V1.9 add 'restart' + redesign 'quit' so thread exits cleanly
- api.c bug - remove extra ']'s in notify command
- Increase pool watch interval to 30 seconds.
- Reap curls that are unused for over a minute. This allows connections to be
closed, thereby allowing the number of curl handles to always be the minimum
necessary to not delay networking.
- Use the ringbuffer of curls from the same pool for submit as well as getwork
threads. Since the curl handles were already connected to the same pool and are
immediately available, share submission will not be delayed by getworks.
- Implement a scaleable networking framework designed to cope with any sized
network requirements, yet minimise the number of connections being reopened. Do
this by create a ring buffer linked list of curl handles to be used by getwork,
recruiting extra handles when none is immediately available.
- There is no need for the submit and getwork curls to be tied to the pool
- Do not recruit extra connection threads if there have been connection errors
to the pool in question.
- We should not retry submitting shares indefinitely or we may end up with a
huge backlog during network outages, so discard stale shares if we failed to
submit them and they've become stale in the interim.

Version 2.3.6 - April 29, 2012

- Shorten stale share messages slightly.
- Protect the freeing of current_hash under mutex_lock to prevent racing on it
when set_curblock is hit concurrently.
- Change default behaviour to submitting stale, removing the --submit-stale
option and adding a --no-submit-stale option.
- Make sure to start the getwork and submit threads when a pool is added on the
fly. This fixes a crash when a pool is added to running cgminer and then
switched to.
- Faster hardware can easily outstrip the speed we can get work and submit
shares when using only one connection per pool.
- Test the queued list to see if any get/submits are already queued and if they
are, start recruiting extra connections by generating new threads.
- This allows us to reuse network connections at low loads but recuit new open
connections as they're needed, so that cgminer can scale to hardware of any

Version 2.3.5 - April 28, 2012

- Restarting cgminer leads to a socket that can't be bound for 60 seconds, so
increase the interval that API binding waits to 30 seconds to minimise the
number of times it will retry, spamming the logs.
- Give a longpoll message for any longpoll that detects a block change, primary
or backup, and also display which pool it was.
- Decrease utility display to one decimal place.
- Small cosmetic output alignment.
- Add pool number to stale share message.
- Add space to log output now that there is more screen real estate available.
- Indentation clean up.
- Merge branch 'master' of
- Remove thread id display from rejected shares as well.
- Merge pull request #185 from Diapolo/diakgcn
- add goffset support for diakgcn with -v 1 and update kernel version
- Set have_longpoll to true when there is at least one pool with longpoll.
- Don't display the thread ID since it adds no useful information over the
device number.
- Don't display the first 8 bytes of a share since they will always be zero at
>= 1 difficulty.
- work->longpoll is reset across test_work_current so we need to recheck what
pool it belongs to.
- Use longpolls from backup pools with failover-only enabled just to check for
block changes, but don't use them as work.
- Start longpoll only after we have tried to extract the longpoll URL.
- Check for submitold flag on resubmit of shares, and give different message for
stale shares on retry.
- Check for submitold before submitstale.
- Don't force fresh curl connections on anything but longpoll threads.
- Create one longpoll thread per pool, using backup pools for those pools that
don't have longpoll.
- Use the work created from the longpoll return only if we don't have
failover-enabled, and only flag the work as a longpoll if it is the current
- This will work around the problem of trying to restart the single longpoll
thread on pool changes that was leading to race conditions.
- It will also have less work restarts from the multiple longpolls received from
different pools.
- Remove the ability to disable longpoll. It is not a useful feature and will
conflict with planned changes to longpoll code.
- Remove the invalid entries from the example configuration file.
- Add support for latest ATI SDK on windows.
- Export missing function from libztex.
- miner.php change socktimeoutsec = 10 (it only waits once)
- Bugfix: Make initial_args a const char** to satisfy exec argument type warning
(on Windows only)
- miner.php add a timeout so you don't sit and wait ... forever
- Create discrete persistent submit and get work threads per pool, thus allowing
all submitworks belonging to the same pool to reuse the same curl handle, and
all getworks to reuse their own handle.
- Use separate handles for submission to not make getwork potentially delay
share submission which is time critical.
- This will allow much more reusing of persistent connections instead of opening
new ones which can flood routers.
- This mandated a rework of the extra longpoll support (for when pools are
switched) and this is managed by restarting longpoll cleanly and waiting for a
thread join.
- miner.php only show the current date header once
- miner.php also add current time like single rig page
- miner.php display rig 'when' table at top of the multi-rig summary page
- README - add some Ztex details
- api.c include zTex in the FPGA support list
- api.c ensure 'devs' shows PGA's when only PGA code is compiled
- cgminer.c sharelog code consistency and compile warning fix
- README correct API version number
- README spelling error
- api.c combine all pairs of sprintfs()
- api.c uncomment and use BLANK (and COMMA)
- Code style cleanup
- Annotating frequency changes with the changed from value
- README clarification of 'notify' command
- README update for API RPC 'devdetails'
- api.c 'devdetails' list static details of devices
- Using less heap space as my TP-Link seems to not handle this much

Version 2.3.4 - April 25, 2012

- Extensively document the cause of GPU device issues and the use of --gpu-map.
- Support for share logging
- Detect poorly performing combination of SDK and phatk kernel and add verbose
warning at startup.
- Icarus update to new add_cgpu()
- Icarus driver working with Linux and Windows
- api.c fix unused variable compile warning
- Display all OpenCL devices when -n is called as well to allow debugging of
differential mapping of OpenCL to ADL.
- Add a --gpu-map option which will allow arbitrarily mapping ADL devices to
OpenCL devices for instances where association by enumeration alone fails.
- Increase upper limit on number of extra items to queue as some FPGA code can't
yet reliably keep many devices busy.
- Display configuration file information when -c option is passed and only when
file exists on loading default config file.
- Display configuration file loaded, if any, and debug output if configuration
file parsing failed.
- Add missing ztex header to Makefile for distribution.
- Document long-form COM port device names on Windows, required to specify
serial ports above 9
- Include ztex bitstreams firmware in distribution and install if configured in.
- Style police on driver-ztex.c
- work_restart should only be changed by cgminer.c now
- Shut down the api cleanly when the api thread is cancelled. This should allow
the api socket to be closed successfully to next be reopened with app_restart.
- Make a union for cgpu device handles, and rename "device" to "device_ztex"
since it's Ztex-specific
- Initialise name variable.
- Remove unnecessary check for variable that always has memory allocated.
- Bugfix: Missing "break" no-op in default case
- Make the status window and log window as large as can fit on startup,
rechecking to see if it can be enlarged after the fact. This allows any number
of devices to be displayed provided the window is made long enough without
corrupting the output.
- Style police on libztex.c.
- API add removepool like the screen interface
- api.c escape required characters in return strings + pools returns the
- Set lp_path to NULL after free for consistency.
- Removing dmalloc import left behind by mistake
- Fixing leak in resp_hdr_cb
- miner.php warning highlight GPU stats if they are zero (e.g. ADL not enabled)
- miner.php highlight any device that isn't 'Enabled'
- miner.php highlight any Status that isn't 'Alive'
- miner.php optionally support multiple rigs
- Initial Ztex support 1.15x board.

Version 2.3.3 - April 15, 2012

- Don't even display that cpumining is disabled on ./configure to discourage
people from enabling it.
- Do a complete cgminer restart if the ATI Display Library fails, as it does on
windows after running for some time, when fanspeed reporting fails.
- Cache the initial arguments passed to cgminer and implement an attempted
restart option from the settings menu.
- Disable per-device status lines when there are more than 8 devices since
screen output will be corrupted, enumerating them to the log output instead at
- Reuse Vals[] array more than W[] till they're re-initialised on the second
sha256 cycle in poclbm kernel.
- Minor variable alignment in poclbm kernel.
- Make sure to disable devices with any status not being DEV_ENABLED to ensure
that thermal cutoff code works as it was setting the status to DEV_RECOVER.
- Re-initialising ADL simply made the driver fail since it is corruption over
time within the windows driver that's responsible. Revert "Attempt to
re-initialise ADL should a device that previously reported fanspeed stops
reporting it."
- Microoptimise poclbm kernel by ordering Val variables according to usage

Version 2.3.2 - March 31, 2012

- Damping small changes in hashrate so dramatically has the tendency to always
make the hashrate underread so go back to gentle damping instead.
- Revert the crossover of variables from Vals to W in poclbm kernel now that
Vals are the first declared variables so they're used more frequently.
- Vals variables appearing first in the array in poclbm is faster.
- Change the preferred vector width to 1 for Tahiti only, not all poclbm
- Use a time constant 0.63 for when large changes in hashrate are detected to
damp change in case the large change is an aliasing artefact instead of a real
- Only increment stale counter if the detected stales are discarded.
- Attempt to re-initialise ADL should a device that previously reported fanspeed
stops reporting it.
- Move the ADL setup and clearing to separate functions and provide a reinit_adl
function to be used when adl fails while running.
- Use slightly more damping on the decay time function in the never-ending quest
to smooth off the hashmeter.
- Set the starting fanspeed to a safe and fairly neutral 50% when autofan is
- Provide locking around updates of cgpu hashrates as well to prevent multiple
threads accessing data fields on the same device.
- Display the beginning of the new block in verbose mode in the logs.
- Reinstate old diablo kernel variable ordering from 120222, adding only goffset
and vector size hint. The massive variable ordering change only helped one SDK
- Change the version number on the correct kernels.
- api.c devicecode/osinfo incorrectly swapped for json
- Add extensive instructions on how to make a native windows build.
- Update version numbers of poclbm and diablo kernels as their APIs have also
- Use global offset parameter to diablo and poclbm kernel ONLY for 1 vector
- Use poclbm preferentially on Tahiti now regardless of SDK.
- Remove unused constant passed to poclbm.
- Clean up use of macros in poclbm and use bitselect everywhere possible.
- Add vector type hint to diablo kernel.
- Add worksize and vector attribute hints to the poclbm kernel.
- Spaces for non-aligned variables in poclbm.
- More tidying of poclbm.
- Swap Vals and W variables where they can overlap in poclbm.
- More tidying of poclbm.
- Tidy up first half of poclbm.
- Clean up use of any() by diablo and poclbm kernels.
- Minor variable symmetry changes in poclbm.
- Put additions on separate lines for consistency in poclbm.
- Consolidate last use of W11 into Vals4 in poclbm.
- Change email due to SPAM
- api.c miner.php add a '*' to the front of all notify counters - simplifies
future support of new counters
- miner.php add display 'notify' command
- Small change to help arch's without processor affinity
- Fix bitforce compile error
- api.c notify should report disabled devices also - of course
- API returns the simple device history with the 'notify' command
- code changes for supporting a simple device history
- api.c Report an OS string in config to help with device issues
- api.c fix Log Interval - integer in JSON
- api.c config 'Device Code' to show list of compiled devices + README
- api.c increase buffer size close to current code allowable limit
- removed 8-component vector support from kernel, as this is not supported in
CGMINER anyway
- forgot to update kernel modification date, fixed ;)
- reordered an addition in the kernel, which results in less instructions used
in the GPU ISA code for GCN
- miner.php: option for readonly or check privileged access
- Ignore reduntant-with-build options --disable-gpu, --no-adl, and --no-restart
- miner.php: ereg_replace is DEPRECATED so use preg_replace instead
- Make curses TUI support optional at compile-time.
- Bugfix: AC_ARG_WITH provides withval instead of enableval
- miner.php split devs output for different devices
- api.c: correct error messages
- icarus.c modify (regular) timeout warning to only be debug
- icarus.c set the windows TODO timeout
- Allow specifying a specific driver for --scan-serial
- optimized nonce-check and output code for -v 2 and -v 4
- Bugfix: Check for libudev header (not just library) in configure, and document
optional dependency
- Add API support for Icarus and Bitforce
- Next API version is 1.4 (1.3 is current)
- README/api.c add "When" the request was processed to STATUS
- Bugfix: ZLX to read BitFORCE temp, not ZKX -.-
- Use libudev to autodetect BitFORCE GPUs, if available
- Use the return value of fan_autotune to set fan_optimal instead of passing it
as a pointer.
- Pass the lasttemp from the device we're using to adjust fanspeed in twin
- fix the name to 3 chars, fix the multi-icarus support
- Bugfix: "-S auto" is the default if no -S is specified, and there is no such
delay in using it
- README add information missing from --scan-serial
- Update README RPC API Version comment
- Bugfix: Allow enabling CPU even without OpenCL support
- Change failed-to-mine number of requested shares messge to avoid segfault on
recursive calling of quit().
- Get rid of extra char which is just truncated in poclbm kernel.
- only small code formating changes
- removed vec_step() as this could lead to errors on older SDKs
- unified code for generating nonce in kernel and moved addition of base to the
end -> faster

Version 2.3.1 - February 24, 2012

- Revert input and output code on diakgcn and phatk kernels to old style which
worked better for older hardware and SDKs.
- Add a vector*worksize parameter passed to those kernels to avoid one op.
- Increase the speed of hashrate adaptation.
- Only send out extra longpoll requests if we want longpolls.
- API implement addpool command
- API return the untouched Total MH also (API now version 1.3)
- Add enable/disablepool to miner.php example and reduce font size 1pt

Version 2.3.0 - February 23, 2012

- Consider extra longpoll work items as staged_extra so as to make sure we queue
more work if queueing regular work items as longpolls.
- Use diablo kernel on all future SDKs for Tahiti and set preferred vector width
to 1 on poclbm kernel only.
- Explicitly type the constants in diakgcn kernel as uint, to be in line with
poclbm kernel.
- Reset all hash counters at the same time as resetting start times to get
accurate hashrates on exiting which is mandatory for benchmarking.
- Report thread out before it starts to avoid being flagged as sick when waiting
for the first work item.
- Don't disable and re-enable devices as they may recover and in the meantime
have their status set to OFF.
- API new commands enablepool and disablepool (version already incremented)
- Tolerate new-format temperature readings for bitforce
- Modify cgminer.c pool control to allow API to call it
- Bugfix: Fix BitFORCE driver memory leak in debug logging
- Extra byte was being unused in poclbm leading to failure on some platforms.
- Explicitly type the constants in poclbm kernel as uint.
- Don't save 'include' when saving the configuration
- Allow configuration file to include another recursively
- Use the SDK and hardware information to choose good performing default
- Move phatk kernel to offset vector based nonce bases as well.
- Add a --benchmark feature which works on a fake item indefinitely to compare
device performance without any server or networking influence.
- Allow writing of multiple worksizes to the configuration file.
- Allow writing of multiple vector sizes to the configuration file.
- Allow writing of multiple kernels to the configuration file.
- Allow multiple different kernels to be chosen per device.
- Allow the worksize to be set per-device.
- Allow different vectors to be set per device.
- If we're well below the target temperature, increase gpu engine speed back to
maximum in case we have gotten lost between profiles during an idle period.
- We should be setting the value of fan_optimal, not its address.
- As all kernels will be new versions it's an opportunity to change the .bin
format and make it simpler. Specifying bitalign is redundant and long can be l.
- Use any() in kernel output code.
- Put the nonce for each vector offset in advance, avoiding one extra addition
in the kernel.
- Reset times after all mining threads are started to make estimating hashrates
easier at startup.
- Bugfix: allow no-exec (NX) stack
- Fix minor warning.
- fix the bitforce.c code style follow 1TBS
- fix icarus.c compile warning
- small changes to speedup no vec for AMD 898.1 OCL runtime
- Update licensing to GPL V3.
- Reset the longpoll flag after it's been used once to prevent it restarting
work again.
- Begin import of DiabloMiner kernel.
- Modify API debug messages to say API instead of DBG
- When API shuts down cgminer don't kill itself
- Don't make rolled work from the longpoll be seen as other longpoll work items.
- API add 'privileged' command so can verify access level
- Set the lp_sent variable under lock since there will almost always be a race
on setting this variable, potentially leading to multiple LPs being sent out.
- API restrict access to all non display commands by default
- Update API version to 1.2 for new 'Log Interval'
- API add --log Interval to 'config' reply
- --api-allow special case 0/0 means all

Version 2.2.7 - February 20, 2012

- Send out extra longpolls when we have switched pools and the longpoll thread
is still bound to the old one. This is particularly useful with p2pool where
longpolls do not correlate with main bitcoin block change and would have led to
high reject rates on failover.
- Store whether a work item is the result of a longpoll or not in struct work
and use it to help determine block changes directly from the work longpoll bool.
- Keep track of when a longpoll has been sent for a pool and if the current pool
is requesting work but has not sent a longpoll request, convert one of the work
items to a longpoll.
- Store the longpoll url in the pool struct and update it from the pool_active
test in case it changes. This is to allow further changes to longpoll management
on switching pools.
- Re-check for a longpoll supporting pool every 30 seconds if none is found
- Report threads as busy waiting on getwork on startup to avoid them being
flagged sick on startup during slow networking.
- Allow devices that are disabled due to overheating to be flagged as recovering
instead of disabling them and re-enable them if they're below ideal temperatures
- Tahiti prefers worksize 64 with poclbm.
- No need to expressly retain the opencl program now that the zero binary issue
is fixed. This actually fixes cgminer to work with the latest SDK included with
the ATI catalyst driver 12.2.
- Show error code on any opencl failure status.
- Add detection for version 898.1 SDK as well but only give SDK 2.6 warning once
on startup instead of with each device initialisation.
- Always use a fresh connection for longpoll as prolonged persistent connections
can fail for many reasons.
- Keep track of intended engine clock speed and only adjust up if it's higher
than the last intended speed. This avoids setting the clock speed to one
relative to a lower profile one by mistake.
- Use gpu-memdiff on startup if an engine clockspeed is set and a memdiff value
is set.
- Revert "Adjust engine speed up according to performance level engine setting,
not the current engine speed." - ineffectual.
- Freeze the queues on all threads that are sent the pause message to prevent
them trying to start up again with saved pings in their queues.
- Updates to diakgcn kernel/
- Consolidate all screen updates to the watchdog thread and touch both windows
before refresh.
- Curses will be disabled in clean_up so don't do it early in kill_work, and
disable_adl so that GPU settings may be restored to normal in case shutting down
curses leads to instability on windows.
- Stop the mining threads before trying to kill them.
- Plain refresh() does not give reliably screen updates so get rid of all uses
of it.
- First release with working diakgcn kernel.

Version 2.2.6 - February 16, 2012

- Provide warning on each startup about sdk 2.6
- Fix unused warnings on win32.
- bitforce: Simplify BFopen WIN32 ifdef/else
- Fix initialization warning with jansson 1.3
- bitforce: Cleanup extraneous TODO that isn't needed
- Move tcsetattr (and new tcflush) into *nix BFopen to simplify things a bit
- Add message explaining 2nd thread disabling for dynamic mode and how to tune
- Move logwindow down once number of devices is known.
- Automatically choose phatk kernel for bitalign non-gcn ATI cards, and then
only select poclbm if SDK2.6 is detected.
- Allow the refresh interval to be adjusted in dynamic intensity with a
--gpu-dyninterval parameter.
- Make curses display visible right from the beginning and fix the window sizes
so the initial messages don't get lost once the status window is drawn.
- The amount of work scanned can fluctuate when intensity changes and since we
do this one cycle behind, we increment the work more than enough to prevent
- bitforce: Set a 30 second timeout for serial port on Windows, since the
default is undefined
- Use PreVal4addT1 instead of PreVal4 in poclbm kernel.
- Import PreVal4 and PreVal0 into poclbm kernel.
- Import more prepared constants into poclbm kernel.
- Keep variables in one array but use Vals[] name for consistency with other
kernel designs.
- Replace constants that are mandatorily added in poclbm kernel with one value.
- Remove addition of final constant before testing for result in poclbm kernel.
- Hand optimise variable addition order.
- Hand optimise first variable declaration order in poclbm kernel.
- Radical reordering machine based first pass to change variables as late as
possible, bringing their usage close together.
- fix strcpy NULL pointer if env HOME unset.
- bitforce: Disable automatic scanning when at least one device is specified
- Unroll all poclbm additions to enable further optimisations.

Version 2.2.5 - February 13, 2012

- Make output buffer write only as per Diapolo's suggestion.
- Constify nonce in poclbm.
- Use local and group id on poclbm kernel as well.
- Microoptimise phatk kernel on return code.
- Adjust engine speed up according to performance level engine setting, not the
current engine speed.
- Try to load a binary if we've defaulted to the poclbm kernel on SDK2.6
- Use the poclbm kernel on SDK2.6 with bitalign devices only if there is no
binary available.
- Further generic microoptimisations to poclbm kernel.
- The longstanding generation of a zero sized binary appears to be due to the
OpenCL library putting the binary in a RANDOM SLOT amongst 4 possible binary
locations. Iterate over each of them after building from source till the real
binary is found and use that.
- Fix harmless warnings with -Wsign-compare to allow cgminer to build with -W.
- Fix missing field initialisers warnings.
- Put win32 equivalents of nanosleep and sleep into compat.h fixing sleep() for
- Restore compatibility with Jansson 1.3 and 2.0 (api.c required 2.1)
- Modularized logging, support for priority based logging
- Move CPU chipset specific optimization into device-cpu

Version 2.2.4 - February 11, 2012

- Fix double definition of A0 B0 to zeroA zeroB.
- Retain cl program after successfully loading a binary image. May decrease
failures to build kernels at startup.
- Variable unused after this so remove setting it.
- BFI INT patching is not necessarily true on binary loading of files and not
true on ATI SDK2.6+. Report bitalign instead.
- Various string fixes for reject reason.
- Generalize --temp-cutoff and implement support for reading temperature from
- Change message from recovered to alive since it is used on startup as well as
when a pool has recovered.
- Start mining as soon as any pool is found active and rely on the watchpool
thread to bring up other pools.
- Delayed responses from testing pools that are down can hold up the watchdog
thread from getting to its device testing code, leading to false detection of
the GPU not checking in, and can substantially delay auto gpu/auto fan
management leading to overheating. Move pool watching to its own thread.
- Bugfix: BitFORCE index needs to be static to count correctly
- Space out retrieval of extra work according to the number of mining threads.
- Make shutdown more robust. Enable the input thread only after the other
threads exist. Don't kill off the workio thread and use it to exit main() only
if there is an unexpected problem. Use kill_work() for all anticipated shutdowns
where possible. Remove unused thread entry.
- Change poclbm version number.
- One array is faster than 2 separate arrays so change to that in poclbm kernel.
- Microoptimisations to poclbm kernel which increase throughput slightly.
- Import diablominer kernel. Currently disabled as not working.
- Import diapolo kernel. Currently disabled as not working.
- Conflicting entries of cl_kernel may have been causing problems, and
automatically chosen kernel type was not being passed on. Rename the enum to
cl_kernels and store the chosen kernel in each clState.
- Set cl_amd_media_ops with the BITALIGN flag and allow non-bitselect devices to
- ALlow much longer filenames for kernels to load properly.
- Allow different kernels to be used by different devices and fix the logic fail
of overcorrecting on last commit with !strstr.
- Fix kernel selection process and build error.
- queue_phatk_kernel now uses CL_SET_VARG() for base-nonce(s), too
- added OpenCL >= 1.1 detection code, in preparation of OpenCL 1.1 global offset
parameter support
- Use K array explicitly to make it clear what is being added.
- Work items have a tendency to expire at exactly the same time and we don't
queue extra items when there are plenty in the queue, regardless of age. Allow
extra work items to be queued if adequate time has passed since we last
requested work even if over the limit.
- Discard work when failover-only is enabled and the work has come from a
different pool.
- Missing include to build on newer mingw32.
- Move from the thread safe localtime_r to regular localtime which is the only
one supported on newer pthread libraries on mingw32 to make it compile with the
newer ming. Thread safety is of no importance where localtime is used in this
- Define in_addr_t in windows if required
- sys/wait.h not required in windows
- Allow API to restrict access by IP address
- Add pool switching to example miner.php
- Display X-Reject-Reason, when provided
- Remove the test for whether the device is on the highest profil level before
raising the GPU speed as it is ineffectual and may prevent raising the GPU
- Remove unnecessary check for opt_debug one every invocation of applog at
LOG_DEBUG level and place the check in applog().

Version 2.2.3 - February 6, 2012

- Revert "Rewrite the convoluted get_work() function to be much simpler and roll
work as much as possible with each new work item." This seems to cause a race on
work in free_work(). Presumably other threads are still accessing the structure.

Version 2.2.2 - February 6, 2012

- Provide support for the submitold extension on a per-pool basis based on the
value being detected in a longpoll.
- Don't send a ping to a dynamic device if it's not enabled as that will just
enable it for one pass and then disable it again.
- Rewrite the convoluted get_work() function to be much simpler and roll work as
much as possible with each new work item.
- Roll as much work as possible from the work returned from a longpoll.
- Rolling work on each loop through the mining thread serves no purpose.
- Allow to stage more than necessary work items if we're just rolling work.
- Replace divide_work with reuse_work function used twice.
- Give rolled work a new ID to make sure there is no confusion in the hashtable
- Remove now-defunct hash_div variables.
- Remove unused get_dondata function.
- Silence ADL warnings.
- Silence unused parameter warnings.
- Stagger the restart of every next thread per device to keep devices busy ahead
of accessory threads per device.
- Deprecate the --donation feature. Needlessly complex, questionable usefulness,
depends on author's server and a central pool of some kind, and was not heavily
- It's devices that report back now, not threads, update message.
- Continue auto-management of fan and engine speeds even if a device is disabled
for safety reasons.
- No need to check we're highest performance level when throttling GPU engine
- Abstract out tests for whether work has come from a block that has been seen
before and whether a string is from a previously seen block.
- Probe but don't set the timeout to 15 seconds as some networks take a long
time to timeout.
- Remove most compiler warnings from api.c
- Add last share's pool info in cgpu_info
- Allow the OpenCL platform ID to be chosen with --gpu-platform.
- Iterate over all platforms displaying their information and number of devices
when --ndevs is called.
- Deprecate main.c
- Some networks can take a long time to resolve so go back to 60 second timeouts
instead of 15.
- Only enable curses on failure if curses is desired.
- Fix warnings in bitforce.c
- Bugfix: Need to open BitForce tty for read-write
- Fix various build issues.
- Modularize code: main.c -> device-cpu + device-gpu
- Fix phatk kernel not working on non-bitalign capable devices (Nvidia, older
- Update poclbm kernel for better performance on GCN and new SDKs with bitalign
support when not BFI INT patching. Update phatk kernel to work properly for non
BFI INT patched kernels, providing support for phatk to run on GCN and non-ATI
- Return last accepted share pool/time for devices
- Display accepted share pool/time for CPUs
- Bug intensity always shows GPU 0
- Update example web miner.php to use new API commands

Version 2.2.1 - January 30, 2012

NOTE - The GPU Device reordering in 2.2.0 by default was considered a bad idea
so the original GPU ordering is used by default again unless reordering is
explicitly requested.

- Fix bitforce failing to build into cgminer.
- Add missing options to write config function.
- Add a --gpu-reorder option to only reorder devices according to PCI Bus ID
when requested.
- Fix for midstate support being broken on pools that supported no-midstate
work by ensuring numbers are 32 bits in sha2.c
- Set virtual GPUs to work when ADL is disabled or all mining will occur on GPU
- Add information about paused threads in the menu status.
- Disable all but the first thread on GPUs in dynamic mode for better
- Set the latest network access time on share submission for --net-delay even if
we're not delaying that submission for further network access.
- Clear adl on exiting after probing values since it may attempt to overclock.
- As share submission is usually staggered, and delays can be costly, submit
shares without delay even when --net-delay is enabled.
- Display GPU number and device name when ADL is successfully enabled on it.
- Display GPU ordering remapping in verbose mode.
- Don't fail in the case the number of ADL and OpenCL devices do not match, and
do not attempt to reorder devices unless they match. Instead give a warning
- Display error codes should ADL not return ADL_OK in the more critical function
- Fix unused warning.
- Fix compile warnings in api.c
- Add extensive ADL based device info in debug mode.
- Make --ndevs display verbose opencl information as well to make debugging
version information easier.
- Display information about the opencl platform with verbose enabled.
- Explicitly check for nvidia in opencl platform strings as well.

Version 2.2.0 - January 29, 2012

NOTE: GPU Device order will change with this release with ATI GPUs as cgminer
now can enumerate them according to their Bus ID which means the values should
now correlate with their physical position on the motherboard.

- Default to poclbm kernel on Tahiti (7970) since phatk does not work, even
though performance is sub-standard so that at least it will mine successfully by
- Retain cl program after every possible place we might build the program.
- Update ADL SDK URL.
- Fix potential overflow.
- Map GPU devices to virtual devices in their true physical order based on
- Change the warning that comes with failure to init cl on a device to be more
generic and accurate.
- Advertise longpoll support in X-Mining-Extensions
- Detect dual GPU cards by iterating through all GPUs, finding ones without
fanspeed and matching twins with fanspeed one bus ID apart.
- Do not attempt to build the program that becomes the kernel twice. This could
have been leading to failures on initialising cl.
- Some opencl compilers have issues with no spaces after -D in the compiler
- Allow intensity up to 14.
- Use calloced stack memory for CompilerOptions to ensure sprintf writes to the
beginning of the char.
- Whitelist 79x0 cards to prefer no vectors as they perform better without.
- Adjust fan speed gently while in the optimal range when temperature is
drifting to minimise overshoot in either direction.
- Detect dual GPU cards via the indirect information of - 1st card has a fan
controller. 2nd card does not have a fan controller, cards share the same device
- Instead of using the BFI_INT patching hack on any device reporting
cl_amd_media_ops, create a whitelist of devices that need it. This should enable
GCN architec
- Fixed API compiling issue on OS X
- Add more explanation of JSON format and the 'save' command
- Return an error if using ADL API commands when it's not available
- Read off lpThermalControllerInfo from each ADL device.
- Add ADL_Overdrive5_ThermalDevices_Enum interface.
- Add API commands: config, switchpool, gpu settings, save
- Implement socks4 proxy support.
- Fix send() for JSON strings
- Introduce a --net-delay option which guarantees at least 250ms between any
networking requests to not overload slow routers.
- Generalise locking init code.
- Allow invalid values to be in the configuration file, just skipping over them
provided the rest of the file is valid JSON. This will allow older configurat
- Allow CPU mining explicitly enable only if other mining support is built in.
- BitForce FPGA support
- Configure out building and support of all CPU mining code unless
--enable-cpumining is enabled.
- Allow parsed values to be zero which will allow 0 values in the config file to
- Advertise that we can make our own midstate, so the pool can skip generating
it for us
- Refactor the CPU scanhash_* functions to use a common API. Fixes bugs.
- Don't consider a pool lagging if a request has only just been filed. This
should decrease the false positives for "pool not providing work fast enough".
- Invalidating work after longpoll made hash_pop return no work giving a false
positive for dead pool. Rework hash_pop to retry while finds no staged work u
- Remove TCP_NODELAY from curl options as many small packets may be contributing
to network overload, when --net-delay is enabled.
- Refactor miner_thread to be common code for any kind of device
- Simplify submit_nonce loop and avoid potentially missing FOUND - 1 entry.
Reported by Luke-Jr.
- Micro-optimisation in sha256_sse2 code courtesy of Guido Ascioti
- Refactor to abstract device-specific code

Version 2.1.2 - January 6, 2012

- If api-description is specified, save it when writing the config file
- Adjust utility width to be constant maximum as well.
- Add percent signs to reject ratio outputs
- Should the donation pool fail, don't make the fallover pool behave as though
the primary pool is lagging.
- Use an alternative pool should the donation getwork fail.

Version 2.1.1 - January 1, 2012

- Include API examples in distribution tarball.
- Don't attempt to pthread_join when cancelling threads as they're already
detached and doing so can lead to a segfault.
- Give more generic message if slow pool at startup is the donation pool.
- Continue to attempt restarting GPU threads if they're flagged dead at 1 min.
- Don't attempt to restart sick flagged GPUs while they're still registering
- Make curl use fresh connections whenever there is any communication issue
in case there are dead persistent connections preventing further comms from
- Display pool in summary if only 1 pool.
- Adjust column width of A/R/HW to be the maximum of any device and align them.

Version 2.1.0 - December 27, 2011

- Major infrastructure upgrade with RPC interface for controlling via sockets
encoded with/without JSON courtesy of Andrew Smith. Added documentation for
use of the API and sample code to use with it.
- Updated linux-usb-cgminer document.
- Rewrite of longpoll mechanism to choose the current pool wherever possible to
use for the longpoll, or any pool that supports longpoll if the current one
does not.
- Display information about longpoll when the chosen server has changed.
- Fix the bug where longpoll generated work may have been sent back to the
wrong pool, causing rejects.
- Fix a few race conditions on closing cgminer which caused some of the crashes
on exit.
- Only adjust gpu engine speed in autotune mode if the gpu is currently at the
performance level of that being adjusted.
- Various fixes for parsing/writing of configuration files.
- Do not add blank lines for threads of unused CPUs.
- Show which pool is unresponsive on startup.
- Only show GPU management menu item if GPUs are in use.
- Align most device columns in the curses display.

Version 2.0.8 - November 11, 2011

- Make longpoll do a mandatory flushing of all work even if the block hasn't
changed, thus supporting longpoll initiated work change of any sort and merged
- Byteswap computed hash in hashtest so it can be correctly checked. This fixes
the very rare possibility that a block solve on solo mining was missed.
- Add x86_64 w64 mingw32 target
- Allow a fixed speed difference between memory and GPU clock speed with
--gpu-memdiff that will change memory speed when GPU speed is changed in
autotune mode.
- Don't load the default config if a config file is specified on the command
- Don't build VIA on apple since -a auto bombs instead of gracefully ignoring
VIA failing.
- Build fix for dlopen/dlclose errors in glibc.

Version 2.0.7 - October 17, 2011

- Support work without midstate or hash1, which are deprecated in bitcoind 0.5+
- Go to kernel build should we fail to clCreateProgramWithBinary instead of
failing on that device. This should fix the windows problems with devices not
- Support new configuration file format courtesy of Chris Savery which can write
the config file from the menu and will load it on startup.
- Write unix configuration to .cgminer/cgminer.conf by default and prompt to
overwrite if given a filename from the menu that exists.

Version 2.0.6 - October 9, 2011

- Must initialise the donorpool mutex or it fails on windows.
- Don't make donation work interfere with block change detection allowing
donation to work regardless of the block chain we're mining on.
- Expire shares as stale with a separate timeout from the scantime, defaulting
to 120 seconds.
- Retry pools after a delay of 15 seconds if none can be contacted on startup
unless a key is pressed.
- Don't try to build adl features without having adl.
- Properly check shares against target difficulty - This will no longer show
shares when solo mining at all unless they're considered to be a block solve.
- Add altivec 4 way (cpu mining) support courtesy of Gilles Risch.
- Try to use SSL if the server supports it.
- Display the total solved blocks on exit (LOL if you're lucky).
- Use ADL activity report to tell us if a sick GPU is still busy suggesting it
is hard hung and do not attempt to restart it.

Version 2.0.5 - September 27, 2011

- Intensity can now be set to dynamic or static values per-device.
- New donation feature --donation sends a proportion of shares to author's
account of choice, but is disabled by default!
- The hash being displayed and block detection has been fixed.
- Devices not being mined on will not attempt to be ADL managed.
- Intensity is now displayed per GPU device.
- Make longpoll attempt to restart as often as opt_retries specifies.
- We weren't rolling work as often as we could.
- Correct some memory management issues.
- Build fixes.
- Don't mess with GPUs if we don't have them.

Version 2.0.4 - September 23, 2011

- Confused Longpoll messages should be finally fixed with cgminer knowing for
sure who found the new block and possibly avoiding a rare crash.
- Display now shows the actual hash and will say BLOCK! if a block is deemed
- Extra spaces, which would double space lines on small terminals, have been
- Fan speed change is now damped if it is already heading in the correct
direction to minimise overshoot.
- Building without opencl libraries is fixed.
- GPUs are autoselected if there is only one when in the GPU management menu.
- GPU menu is refreshed instead of returning to status after a GPU change.

Version 2.0.3 - September 17, 2011

- Various modes of failure to set fanspeeds and adl values have been addressed
and auto-fan should work now on most hardware, and possibly other values
which previously would not have worked.
- Fixed a crash that can occur on switching pools due to longpoll thread races.
- Use ATISTREAMSDKROOT if available at build time.
- Fanspeed management is returned to the driver default on exit instead of
whatever it was when cgminer was started.
- Logging of events deemed WARNING or ERR now will display even during
periods where menu input is being awaited on.

Version 2.0.2 - September 11, 2011

- Exit cleanly if we abort before various threads are set up or if they no
longer exist.
- Fix a rare crash in HASH_DEL due to using different mutexes to protect the
- Flag devices that have never started and don't allow enabling of devices
without restarting them.
- Only force the adapter speed to high if we've flagged this device as being
- Flag any devices with autofan or autogpu as being managed.
- Use a re-entrant value to store what fanspeed we're trying to set in case the
card doesn't support small changes.     Force it to a multiple of 10% if it
fails on trying to speed up the fan.
- Do not bother resetting values to old ones if changes to GPU parameters report
failure, instead returning a failure code only if the return value from get()
- Remove redundant check.
- Only display supported values from fanspeed on change settings.
- Missing bracket from output.
- Display fan percentage on devices that only support reporting percent and not
- Properly substitute DLOPEN flags to build with ADL support when -ldl is needed
and not when opencl is not found.

Version 2.0.1 - September 9, 2011

- Fix building on 32bit glibc with dlopen with -lpthread and -ldl
- ByteReverse is not used and the bswap opcode breaks big endian builds. Remove
- Ignore whether the display is active or not since only display enabled devices
work this way, and we skip over repeat entries anwyay.
- Only reset values on exiting if we've ever modified them.
- Flag adl as active if any card is successfully activated.
- Add a thermal cutoff option as well and set it to 95 degrees by default.
- Change the fan speed by only 5% if it's over the target temperature but less
than the hysteresis value to minimise overshoot down in temperature.
- Add a --no-adl option to disable ADL monitoring and GPU settings.
- Only show longpoll received delayed message at verbose level.
- Allow temperatures greater than 100 degrees.
- We should be passing a float for the remainder of the vddc values.
- Implement accepting a range of engine speeds as well to allow a lower limit to
be specified on the command line.
- Allow per-device fan ranges to be set and use them in auto-fan mode.
- Display which GPU has overheated in warning message.
- Allow temperature targets to be set on a per-card basis on the command line.
- Display fan range in autofan status.
- Setting the hysteresis is unlikely to be useful on the fly and doesn't belong
in the per-gpu submenu.
- With many cards, the GPU summaries can be quite long so use a terse output
line when showing them all.
- Use a terser device status line to show fan RPM as well when available.
- Define max gpudevices in one macro.
- Allow adapterid 0 cards to enumerate as a device as they will be non-AMD
cards, and enable ADL on any AMD card.
- Do away with the increasingly confusing and irrelevant total queued and
efficiency measures per device.
- Only display values in the log if they're supported and standardise device log
line printing.

Version 2.0.0 - September 6, 2011

Major feature upgrade - GPU monitoring, (over)clocking and fan control for ATI

New command line switches:
--auto-fan-     Automatically adjust all GPU fan speeds to maintain a target
--auto-gpu-     Automatically adjust all GPU engine clock speeds to maintain
a target temperature
--gpu-engine <arg>  Set the GPU engine (over)clock in Mhz - one value for all or
separate by commas for per card.
--gpu-fan <arg>     Set the GPU fan percentage - one value for all or separate
by commas for per card.
--gpu-memclock <arg> Set the GPU memory (over)clock in Mhz - one value for all
or separate by commas for per card.
--gpu-powertune <arg> Set the GPU powertune percentage - one value for all or
separate by commas for per card.
--gpu-vddc <arg>    Set the GPU voltage in Volts - one value for all or separate
by commas for per card.
--temp-hysteresis <arg> Set how much the temperature can fluctuate outside
limits when automanaging speeds (default: 3)
--temp-overheat <arg> Set the overheat temperature when automatically managing
fan and GPU speeds (default: 85)
--temp-target <arg> Set the target temperature when automatically managing fan
and GPU speeds (default: 75)

- Implement ATI ADL support for GPU parameter monitoring now and setting later
(temp, fan, clocks etc.).
- Check for the presence of the ADL header files in ADL_SDK.
- Import adl_functions.h from amd overdrive ctrl.
- Implement a setup function that tries to detect GPUs that support the ADL and
link in the parameters into the gpus struct.
- Put a summary of monitoring information from the GPU menu.
- Implement changing memory speed and voltage on the fly.
- Implement fan speed setting.
- Minor corrections to set fan speed by percentage.
- Make sure to read off the value in RPM only.
- Implement auto fanspeed adjustment to maintain a target temperature and
fanspeed below 85%, with an overheat check that will speed the fan up to 100%.
- Add an --auto-fan command line option to allow all GPUs to have autofan
enabled from startup.
- Add a gpu autotune option which adjusts GPU speed to maintain a target
temperature within the bounds of the default GPU speed and any overclocking set.
- Avoid a dereference if the longpoll thread doesn't exist.
- Clean up by setting performance profiles and fan settings to startup levels on
- Add a small amount of hysteresis before lowering clock speed.
- Allow target, overheat and hysteresis temperatures to be set from command
- Combine all stats collating into one function to avoid repeating function
calls on each variable.
- Add gpu statistics to debugging output via the watchdog thread.
- Implement menus to change temperature limits.
- Implement setting the GPU engine clock speed of all devices or each device as
a comma separated value.
- Implement setting the GPU memory clock speed of all devices or each device as
a comma separated value.
- Implement setting the GPU voltage of all devices or each device as a comma
separated value.
- Implement setting the GPU fan speed of all devices or each device as a comma
separated value.
- Add support for monitoring powertune setting.
- Implement changing of powertune value from the GPU change settings menu.
- Get the value of powertune in get_stats.
- Implement setting the GPU powertune value of all devices or each device as a
comma separated value.
- Remove the safety checks in speed setting since confirmation is done first in
the menu, then show the new current values after a short pause.
- Force the speed to high on startup and restore it to whatever the setting was
on exit.
- Add temperature to standard output where possible and use more compact output.
- Move and print at the same time in curses to avoid random trampling display
- Update the status window only from the watchdog thread, do not rewrite the top
status messages and only refresh once all the status window is complete,
clearing the window each time to avoid corruption.
- Set a safe starting fan speed if we're automanaging the speeds.
- Provide locking around all adl calls to prevent races.
- Lower profile settings cannot be higher than higher profile ones so link any
drops in settings.
- Add new needed text files to distribution.
- Queue requests ignoring the number of staged clones since they get discarded
very easily leading to false positives for pool not providing work fast enough.
- Include libgen.h in opt.c to fix win32 compilation warnings.
- Fix compilation warning on win32.
- Add the directory name from the arguments cgminer was called from as well to
allow it running from a relative pathname.
- Add a --disable-adl option to configure and only enable it if opencl support
- Retry before returning a failure to get upstream work as a failure to avoid
false positives for pool dead.
- Retry also if the decoding of work fails.
- Use the presence of X-Roll-Ntime in the header as a bool for exists unless N
is found in the response.

Version 1.6.2 - September 2, 2011

- Add --failover-only option to not leak work to backup pools when the primary
pool is lagging.
- Change recommendation to intensity 9 for dedicated miners.
- Fix the bouncing short term value by allowing it to change dynamically when
the latest value is very different from the rolling value, but damp the change
when it gets close.
- Use the curses_lock to protect the curses_active variable and test it under
- Go back to requesting work 2/3 of the way through the current scantime with
CPU mining as reports of mining threads running out of work have occurred with
only 5 seconds to retrieve work.
- Add start and stop time scheduling for regular time of day running or once off
start/stop options.
- Print summary on quit modes.
- Put some sanity checks on the times that can be input.
- Give a verbose message when no active pools are found and pause before
- Add verbose message when a GPU fails to initialise, and disable the correct
- Cryptopp asm32 was not correctly updated to the incremental nonce code so the
hash counter was bogus.
- Get rid of poorly executed curl check.
- If curl does not have sockopts, do not try to compile the
json_rpc_call_sockopt_cb function, making it possible to build against older
curl libraries.
- Most people expect /usr/local when an unspecified prefix is used so change to
- Rename localgen occasions to getwork fail occasions since localgen is
unrelated now.

Version 1.6.1 - August 29, 2011

- Copy cgminer path, not cat it.
- Switching between redrawing windows does not fix the crash with old
libncurses, so redraw both windows, but only when the window size hasn't
- Reinstate minimum 1 extra in queue to make it extremely unlikely to ever have
0 staged work items and any idle time.
- Return -1 if no input is detected from the menu to prevent it being
interpreted as a 0.
- Make pthread, libcurl and libcurses library checks mandatory or fail.
- Add a --disable-opencl configure option to make it possible to override
detection of opencl and build without GPU mining support.
- Confusion over the variable name for number of devices was passing a bogus
value which likely was causing the zero sized binary issue.
- cgminer no longer supports default url user and pass so remove them.
- Don't show value of intensity since it's dynamic by default.
- Add options to explicitly enable CPU mining or disable GPU mining.
- Convert the opt queue into a minimum number of work items to have queued
instead of an extra number to decrease risk of getting idle devices without
increasing risk of higher rejects.
- Statify tv_sort.
- Check for SSE2 before trying to build 32 bit SSE2 assembly version. Prevents
build failure when yasm is installed but -msse2 is not specified.
- Add some defines to to enable exporting of values and packaging,
and clean up output.
- Give convenient summary at end of ./configure.
- Display version information and add --version command line option, and make
sure we flush stdout.
- Enable curses after the mining threads are set up so that failure messages
won't be lost in the curses interface.
- Disable curses after inputting a pool if we requested no curses interface.
- Add an option to break out after successfully mining a number of accepted
- Exit with a failed return code if we did not reach opt_shares.
- The cpu mining work data can get modified before we copy it if we submit it
async, and the sync submission is not truly sync anyway, so just submit it sync.

Version 1.6.0 - August 26, 2011

- Make restarting of GPUs optional for systems that hang on any attempt to
restart them.     Fix DEAD status by comparing it to last live time rather than
last attempted restart time since that happens every minute.
- Move staged threads to hashes so we can sort them by time.
- Create a hash list of all the blocks created and search them to detect when a
new block has definitely appeared, using that information to detect stale work
and discard it.
- Update for newer autoconf tools.
- Use the new hashes directly for counts instead of the fragile counters
currently in use.
- Update to latest sse2 code from cpuminer-ng.
- Allow LP to reset block detect and block detect lp flags to know who really
came first.
- Get start times just before mining begins to not have very slow rise in
- Add message about needing one server.
- We can queue all the necessary work without hitting frequent stales now with
the time and string stale protection active all the time.     This prevents a
pool being falsely labelled as not providing work fast enough.
- Include uthash.h in distro.
- Implement SSE2 32 bit assembly algorithm as well.
- Fail gracefully if unable to open the opencl files.
- Make cgminer look in the install directory for the .cl files making make
install work correctly.
- Allow a custom kernel path to be entered on the command line.
- Bump threshhold for lag up to maximum queued but no staged work.
- Remove fragile source patching for bitalign, vectors et. al and simply pass it
with the compiler options.
- Actually check the value returned for the x-roll-ntime extension to make sure
it isn't saying N.
- Prevent segfault on exit for when accessory threads don't exist.
- Disable curl debugging with opt protocol since it spews to stderr.

Version 1.5.8 - August 23, 2011

- Minimise how much more work can be given in cpu mining threads each interval.
- Make the fail-pause progressively longer each time it fails until the network
- Only display the lagging message if we've requested the work earlier.
- Clean up the pool switching to not be dependent on whether the work can roll
or not by setting a lagging flag and then the idle flag.
- Only use one thread to determine if a GPU is sick or well, and make sure to
reset the sick restart attempt time.
- The worksize was unintentionally changed back to 4k by mistake, this caused a

Version 1.5.7 - August 22, 2011

- Fix a crash with --algo auto
- Test at appropriate target difficulty now.
- Add per-device statics log output with --per-device-stats
- Fix breakage that occurs when 1 or 4 vectors are chosen on new phatk.
- Make rolltime report debug level only now since we check it every work
- Add the ability to enable/disable per-device stats on the fly and match
logging on/off.
- Explicitly tell the compiler to retain the program to minimise the chance of
the zero sized binary errors.
- Add one more instruction to avoid one branch point in the common path in the
cl return code. Although this adds more ALUs overall and more branch points, the
common path code has the same number of ALUs and one less jmp, jmps being more
- Explicitly link in ws2_32 on the windows build and update README file on how
to compile successfully on windows.
- Release cl resources should the gpu mining thread abort.
- Attempt to restart a GPU once every minute while it's sick.
- Don't kill off the reinit thread if it fails to init a GPU but returns safely.
- Only declare a GPU dead if there's been no sign of activity from the reinit
thread for 10 mins.
- Never automatically disable any pools but just specify them as idle if they're
unresponsive at startup.
- Use any longpoll available, and don't disable it if switching to a server that
doesn't have it. This allows you to mine solo, yet use the longpoll from a pool
even if the pool is the backup server.
- Display which longpoll failed and don't free the ram for lp_url since it
belongs to the pool hdr path.
- Make the tcp setsockopts unique to linux in the hope it allows freebsd et. al
to compile.

Version 1.5.6 - August 17, 2011

- New phatk and poclbm kernels. Updated phatk to be in sync with latest 2.2
courtesy of phateus. Custom modified to work best with cgminer.
- Updated output buffer code to use a smaller buffer with the kernels.
- Clean up the longpoll management to ensure the right paths go to the right
pool and display whether we're connected to LP or not in the status line.

Version 1.5.5 - August 16, 2011

- Rework entirely the GPU restart code. Strike a balance between code that
re-initialises the GPU entirely so that soft hangs in the code are properly
managed, but if a GPU is completely hung, the thread restart code fails
gracefully, so that it does not take out any other code or devices. This will
allow cgminer to keep restarting GPUs that can be restarted, but continue
mining even if one or more GPUs hangs which would normally require a reboot.
- Add --submit-stale option which submits all shares, regardless of whether they
would normally be considered stale.
- Keep options in alphabetical order.
- Probe for slightly longer for when network conditions are lagging.
- Only display the CPU algo when we're CPU mining.
- As we have keepalives now, blaming network flakiness on timeouts appears to
have been wrong.     Set a timeout for longpoll to 1 hour, and most other
network connectivity to 1 minute.
- Simplify output code and remove HW errors from CPU stats.
- Simplify code and tidy output.
- Only show cpu algo in summary if cpu mining.
- Log summary at the end as per any other output.
- Flush output.
- Add a linux-usb-cgminer guide courtesy of Kano.

Version 1.5.4 - August 14, 2011

- Add new option: --monitor <cmd> Option lets user specify a command <cmd> that
will get forked by cgminer on startup. cgminer's stderr output subsequently gets
piped directly to this command.
- Allocate work from one function to be able to initialise variables added
- Add missing fflush(stdout) for --ndevs and conclusion summary.
- Preinitialise the devices only once on startup.
- Move the non cl_ variables into the cgpu info struct to allow creating a new
cl state on reinit, preserving known GPU variables.
- Create a new context from scratch in initCQ in case something was corrupted to
maximise our chance of succesfully creating a new worker thread. Hopefully this
makes thread restart on GPU failure more reliable, without hanging everything
in the case of a completely wedged GPU.
- Display last initialised time in gpu management info, to know if a GPU has
been re-initialised.
- When pinging a sick cpu, flush finish and then ping it in a separate thread in
the hope it recovers without needing a restart, but without blocking code
- Only consider a pool lagging if we actually need the work and we have none
staged despite queue requests stacking up. This decreases significantly the
amount of work that leaks to the backup pools.
- The can_roll function fails inappropriately in stale_work.
- Only put the message that a pool is down if not pinging it every minute. This
prevents cgminer from saying pool down at 1 minute intervals unless in debug
- Free all work in one place allowing us to perform actions on it in the future.
- Remove the extra shift in the output code which was of dubious benefit. In
fact in cgminer's implementation, removing this caused a miniscule speedup.
- Test each work item to see if it can be rolled instead of per-pool and roll
whenever possible, adhering to the 60 second timeout. This makes the period
after a longpoll have smaller dips in throughput, as well as requiring less
getworks overall thus increasing efficiency.
- Stick to rolling only work from the current pool unless we're in load balance
mode or lagging to avoid aggressive rolling imitating load balancing.
- If a work item has had any mining done on it, don't consider it discarded

Version 1.5.3 - July 30, 2011

- Significant work went into attempting to make the thread restart code robust
to identify sick threads, tag them SICK after 1 minute, then DEAD after 5
minutes of inactivity and try to restart them. Instead of re-initialising the
GPU completely, only a new cl context is created to avoid hanging the rest of
the GPUs should the dead GPU be hung irrevocably.
- Use correct application name in syslog.
- Get rid of extra line feeds.
- Use pkg-config to check for libcurl version
- Implement per-thread getwork count with proper accounting to not over-account
queued items when local work replaces it.
- Create a command queue from the program created from source which allows us
to flush the command queue in the hope it will not generate a zero sized binary
any more.
- Be more willing to get work from the backup pools if the work is simply being
queued faster than it is being retrieved.

Version 1.5.2 - July 28, 2011

- Restarting a hung GPU can hang the rest of the GPUs so just declare it dead
and provide the information in the status.
- The work length in the miner thread gets smaller but doesn't get bigger if
it's under 1 second.     This could end up leading to CPU under-utilisation and
lower and lower hash rates.     Fix it by increasing work length if it drops
under 1 second.
- Make the "quiet" mode still update the status and display errors, and add a
new --real-quiet option which disables all output and can be set once while
- Update utility and efficiency figures when displaying them.
- Some Intel HD graphics support the opencl commands but return errors since
they don't support opencl. Don't fail with them, just provide a warning and
disable GPU mining.
- Add http:// if it's not explicitly set for URL entries.
- Log to the output file at any time with warnings and errors, instead of just
when verbose mode is on.
- Display the correct current hash as per blockexplorer, truncated to 16
characters, with just the time.

Version 1.5.1 - July 27, 2011

- Two redraws in a row cause a crash in old libncurses so just do one redraw
using the main window.
- Don't adjust hash_div only up for GPUs. Disable hash_div adjustment for GPUs.
- Only free the thread structures if the thread still exists.
- Update both windows separately, but not at the same time to prevent the double
refresh crash that old libncurses has.     Do the window resize check only when
about to redraw the log window to minimise ncurses cpu usage.
- Abstract out the decay time function and use it to make hash_div a rolling
average so it doesn't change too abruptly and divide work in chunks large enough
to guarantee they won't overlap.
- Sanity check to prove locking.
- Don't take more than one lock at a time.
- Make threads report out when they're queueing a request and report if they've
- Make cpu mining work submission asynchronous as well.
- Properly detect stale work based on time from staging and discard instead of
handing on, but be more lax about how long work can be divided for up to the
- Do away with queueing work separately at the start and let each thread grab
its own work as soon as it's ready.
- Don't put an extra work item in the queue as each new device thread will do so
- Make sure to decrease queued count if we discard the work.
- Attribute split work as local work generation.
- If work has been cloned it is already at the head of the list and when being
reinserted into the queue it should be placed back at the head of the list.
- Dividing work is like the work is never removed at all so treat it as such.
However the queued bool needs to be reset to ensure we *can* request more work
even if we didn't initially.
- Make the display options clearer.
- Add debugging output to tq_push calls.
- Add debugging output to all tq_pop calls.

Version 1.5.0 - July 26, 2011

- Increase efficiency of slow mining threads such as CPU miners dramatically. Do
this by detecting which threads cannot complete searching a work item within the
scantime and then divide up a work item into multiple smaller work items.
Detect the age of the work items and if they've been cloned before to prevent
doing the same work over. If the work is too old to be divided, then see if it
can be time rolled and do that to generate work. This dramatically decreases the
number of queued work items from a pool leading to higher overall efficiency
(but the same hashrate and share submission rate).
- Don't request work too early for CPUs as CPUs will scan for the full
opt_scantime anyway.
- Simplify gpu management enable/disable/restart code.
- Implement much more accurate rolling statistics per thread and per gpu and
improve accuracy of rolling displayed values.
- Make the rolling log-second average more accurate.
- Add a menu to manage GPUs on the fly allowing you to enable/disable GPUs or
try restarting them.
- Keep track of which GPUs are alive versus enabled.
- Start threads for devices that are even disabled, but don't allow them to
start working.
- The last pool is when we are low in total_pools, not active_pools.
- Make the thread restart do a pthread_join after disabling the device, only
re-enabling it if we succeed in restarting the thread. Do this from a separate
thread so as to not block any other code.This will allow cgminer to continue
even if one GPU hangs.
- Try to do every curses manipulation under the curses lock.
- Only use the sockoptfunction if the version of curl is recent enough.

Version 1.4.1 - July 24, 2011

- Do away with GET for dealing with longpoll forever. POST is the one that works
everywhere, not the other way around.
- Detect when the primary pool is lagging and start queueing requests on backup
pools if possible before needing to roll work.
- Load balancing puts more into the current pool if there are disabled pools.
- Disable a GPU device should the thread fail to init.
- Out of order command queue may fail on osx. Try without if it fails.
- Fix possible dereference on blank inputs during input_pool.
- Defines missing would segfault on --help when no sse mining is built in.
- Revert "Free up resources/stale compilers." - didn't help.
- Only try to print the status of active devices or it would crash.
- Some hardware might benefit from the less OPS so there's no harm in leaving
kernel changes that do that apart from readability of the code.

Version 1.4.0 - July 23, 2011

- Feature upgrade: Add keyboard input during runtime to allow modification of
and viewing of numerous settings such as adding/removing pools, changing
multipool management strategy, switching pools, changing intensiy, verbosity,
etc. with a simple keypress menu system.
- Free up resources/stale compilers.
- Kernels are safely flushed in a way that allows out of order execution to
- Sometimes the cl compiler generates zero sized binaries and only a reboot
seems to fix it.
- Don't try to stop/cancel threads that don't exist.
- Only set option to show devices and exit if built with opencl support.
- Enable curses earlier and exit with message in main for messages to not be
lost in curses windows.
- Make it possible to enter server credentials with curses input if none are
specified on the command line.
- Abstract out a curses input function and separate input pool function to allow
for live adding of pools later.
- Remove the nil arguments check to allow starting without parameters.
- Disable/enable echo & cbreak modes.
- Add a thread that takes keyboard input and allow for quit, silent, debug,
verbose, normal, rpc protocol debugging and clear screen options.
- Add pool option to input and display current pool status, pending code to
allow live changes.
- Add a bool for explicit enabling/disabling of pools.
- Make input pool capable of bringing up pools while running.
- Do one last check of the work before submitting it.
- Implement the ability to live add, enable, disable, and switch to pools.
- Only internally test for block changes when the work matches the current pool
to prevent interleaved block change timing on multipools.
- Display current pool management strategy to enable changing it on the fly.
- The longpoll blanking of the current_block data may not be happening before
the work is converted and appears to be a detected block change.     Blank the
current block be
- Make --no-longpoll work again.
- Abstract out active pools count.
- Allow the pool strategy to be modified on the fly.
- Display pool information on the fly as well.
- Add a menu and separate out display options.
- Clean up the messy way the staging thread communicates with the longpoll
thread to determine who found the block first.
- Make the input windows update immediately instead of needing a refresh.
- Allow log interval to be set in the menu.
- Allow scan settings to be modified at runtime.
- Abstract out the longpoll start and explicitly restart it on pool change.
- Make it possible to enable/disable longpoll.
- Set priority correctly on multipools.     Display priority and alive/dead
information in display_pools.
- Implement pool removal.
- Limit rolltime work generation to 10 iterations only.
- Decrease testing log to info level.
- Extra refresh not required.
- With huge variation in GPU performance, allow intensity to go from -10 to +10.
- Tell getwork how much of a work item we're likely to complete for future
splitting up of work.
- Remove the mandatory work requirement at startup by testing for invalid work
being passed which allows for work to be queued immediately.     This also
removes the requirem
- Make sure intensity is carried over to thread count and is at least the
minimum necessary to work.
- Unlocking error on retry. Locking unnecessary anyway so remove it.
- Clear log window from consistent place. No need for locking since logging is
disabled during input.
- Cannot print the status of threads that don't exist so just queue enough work
for the number of mining threads to prevent crash with -Q N.
- Update phatk kernel to one with new parameters for slightly less overhead
again.     Make the queue kernel parameters call a function pointer to select
phatk or poclbm.
- Make it possible to select the choice of kernel on the command line.
- Simplify the output part of the kernel. There's no demonstrable advantage from
more complexity.
- Merge pull request #18 from ycros/cgminer
- No need to make leaveok changes win32 only.
- Build support in for all SSE if possible and only set the default according to
machine capabilities.
- Win32 threading and longpoll keepalive fixes.
- Win32: Fix for mangled output on the terminal on exit.

Version 1.3.1 - July 20, 2011

- Feature upgrade; Multiple strategies for failover. Choose from default which
now falls back to a priority order from 1st to last, round robin which only
changes pools when one is idle, rotate which changes pools at user-defined
intervals, and load-balance which spreads the work evenly amongst all pools.
- Implement pool rotation strategy.
- Implement load balancing algorithm by rotating requests to each pool.
- Timeout on failed discarding of staged requests.
- Implement proper flagging of idle pools, test them with the watchdog thread,
and failover correctly.
- Move pool active test to own function.
- Allow multiple strategies to be set for multipool management.
- Track pool number.
- Don't waste the work items queued on testing the pools at startup.
- Reinstate the mining thread watchdog restart.
- Add a getpoll bool into the thread information and don't restart threads stuck
waiting on work.
- Rename the idlenet bool for the pool for later use.
- Allow the user/pass userpass urls to be input in any order.
- When json rpc errors occur they occur in spits and starts, so trying to limit
them with the comms error bool doesn't stop a flood of them appearing.
- Reset the queued count to allow more work to be queued for the new pool on
pool switch.

Version 1.3.0 - July 19, 2011

- Massive infrastructure update to support pool failover.
- Accept multiple parameters for url, user and pass and set up structures of
pool data accordingly.
- Probe each pool for what it supports.
- Implement per pool feature support according to rolltime support as
advertised by server.
- Do switching automatically based on a 300 second timeout of locally generated
work or 60 seconds of no response from a server that doesn't support rolltime.
- Implement longpoll server switching.
- Keep per-pool data and display accordingly.
- Make sure cgminer knows how long the pool has actually been out for before
deeming it a prolonged outage.
- Fix bug with ever increasing staged work in 1.2.8 that eventually caused
infinite rejects.
- Make warning about empty http requests not show by default since many
servers do this regularly.

Version 1.2.8 - July 18, 2011

- More OSX build fixes.
- Add an sse4 algorithm to CPU mining.
- Fix CPU mining with other algorithms not working.
- Rename the poclbm file to ensure a new binary is built since.
- We now are guaranteed to have one fresh work item after a block change and we
should only discard staged requests.
- Don't waste the work we retrieve from a longpoll.
- Provide a control lock around global bools to avoid racing on them.
- Iterating over 1026 nonces when confirming data from the GPU is old code
and unnecessary and can lead to repeats/stales.
- The poclbm kernel needs to be updated to work with the change to 4k sized
output buffers.
- longpoll seems to work either way with post or get but some servers prefer
get so change to httpget.

Version 1.2.7 - July 16, 2011

- Show last 8 characters of share submitted in log.
- Display URL connected to and user logged in as in status.
- Display current block and when it was started in the status line.
- Only pthread_join the mining threads if they exist as determined by
pthread_cancel and don't fail on pthread_cancel.
- Create a unique work queue for all getworks instead of binding it to thread 0
to avoid any conflict over thread 0's queue.
- Clean up the code to make it clear it's watchdog thread being messaged to
restart the threads.
- Check the current block description hasn't been blanked pending the real
new current block data.
- Re-enable signal handlers once the signal has been received to make it
possible to kill cgminer if it fails to shut down.
- Disable restarting of CPU mining threads pending further investigation.
- Update longpoll messages.
- Add new block data to status line.
- Fix opencl tests for osx.
- Only do local generation of work if the work item is not stale itself.
- Check for stale work within the mining threads and grab new work if
- Test for idle network conditions and prevent threads from being restarted
by the watchdog thread under those circumstances.
- Make sure that local work generation does not continue indefinitely by
stopping it after 10 minutes.
- Tweak the kernel to have a shorter path using a 4k buffer and a mask on the
nonce value instead of a compare and loop for a shorter code path.
- Allow queue of zero and make that default again now that we can track how
work is being queued versus staged. This can decrease reject rates.
- Queue precisely the number of mining threads as longpoll_staged after a
new block to not generate local work.

Version 1.2.6 - July 15, 2011

- Put a current system status line beneath the total work status line
- Fix a counting error that would prevent cgminer from correctly detecting
situations where getwork was failing - this would cause stalls sometimes
- Limit the maximum number of requests that can be put into the queue which
otherwise could get arbitrarily long during a network outage.
- Only count getworks that are real queue requests.

Version 1.2.5 - July 15, 2011

- Conflicting -n options corrected
- Setting an intensity with -I disables dynamic intensity setting
- Removed option to manually disable dynamic intensity
- Improve display output
- Implement signal handler and attempt to clean up properly on exit
- Only restart threads that are not stuck waiting on mandatory getworks
- Compatibility changes courtesy of Ycros to build on mingw32 and osx
- Explicitly grab first work item to prevent false positive hardware errors
due to working on uninitialised work structs
- Add option for non curses --text-only output
- Ensure we connect at least once successfully before continuing to retry to
connect in case url/login parameters were wrong
- Print an executive summary when cgminer is terminated
- Make sure to refresh the status window

Versions -> 1.2.4

- Con Kolivas - July 2011. New maintainership of code under cgminer name.
- Massive rewrite to incorporate GPU mining.
- Incorporate original oclminer c code.
- Rewrite gpu mining code to efficient work loops.
- Implement per-card detection and settings.
- Implement vector code.
- Implement bfi int patching.
- Import poclbm and phatk ocl kernels and use according to hardware type.
- Implement customised optimised versions of opencl kernels.
- Implement binary kernel generation and loading.
- Implement preemptive asynchronous threaded work gathering and pushing.
- Implement variable length extra work queues.
- Optimise workloads to be efficient miners instead of getting lots of extra
- Implement total hash throughput counters, per-card accepted, rejected and
  hw error count.
- Staging and watchdog threads to prevent fallover.
- Stale and reject share guarding.
- Autodetection of new blocks without longpoll.
- Dynamic setting of intensity to maintain desktop interactivity.
- Curses interface with generous statistics and information.
- Local generation of work (xroll ntime) when detecting poor network

Version 1.0.2

- Linux x86_64 optimisations - Con Kolivas
- Optimise for x86_64 by default by using sse2_64 algo
- Detects CPUs and sets number of threads accordingly
- Uses CPU affinity for each thread where appropriate
- Sets scheduling policy to lowest possible
- Minor performance tweaks

Version 1.0.1 - May 14, 2011

- OSX support

Version 1.0 - May 9, 2011

- jansson 2.0 compatibility
- correct off-by-one in date (month) display output
- fix platform detection
- improve yasm configure bits
- support full URL, in X-Long-Polling header

Version 0.8.1 - March 22, 2011

- Make --user, --pass actually work

- Add User-Agent HTTP header to requests, so that server operators may
  more easily identify the miner client.

- Fix minor bug in example JSON config file

Version 0.8 - March 21, 2011

- Support long polling:

- Adjust max workload based on scantime (default 5 seconds,
  or 60 seconds for longpoll)

- Standardize program output, and support syslog on Unix platforms

- Suport --user/--pass options (and "user" and "pass" in config file),
  as an alternative to the current --userpass

Version 0.7.2 - March 14, 2011

- Add port of ufasoft's sse2 assembly implementation (Linux only)
  This is a substantial speed improvement on Intel CPUs.

- Move all JSON-RPC I/O to separate thread.  This reduces the
  number of HTTP connections from one-per-thread to one, reducing resource
  usage on upstream bitcoind / pool server.

Version 0.7.1 - March 2, 2011

- Add support for JSON-format configuration file.  See example
  file example-cfg.json.  Any long argument on the command line
  may be stored in the config file.
- Timestamp each solution found
- Improve sha256_4way performance.  NOTE: This optimization makes
  the 'hash' debug-print output for sha256_way incorrect.
- Use __builtin_expect() intrinsic as compiler micro-optimization
- Build on Intel compiler
- HTTP library now follows HTTP redirects

Version 0.7 - February 12, 2011

- Re-use CURL object, thereby reuseing DNS cache and HTTP connections
- Use bswap_32, if compiler intrinsic is not available
- Disable full target validation (as opposed to simply H==0) for now

Version 0.6.1 - February 4, 2011

- Fully validate "hash &lt; target", rather than simply stopping our scan
  if the high 32 bits are 00000000.
- Add --retry-pause, to set length of pause time between failure retries
- Display proof-of-work hash and target, if -D (debug mode) enabled
- Fix max-nonce auto-adjustment to actually work.  This means if your
  scan takes longer than 5 seconds (--scantime), the miner will slowly
  reduce the number of hashes you work on, before fetching a new work unit.

Version 0.6 - January 29, 2011

- Fetch new work unit, if scanhash takes longer than 5 seconds (--scantime)
- BeeCee1's sha256 4way optimizations
- lfm's byte swap optimization (improves via, cryptopp)
- Fix non-working short options -q, -r

Version 0.5 - December 28, 2010

- Exit program, when all threads have exited
- Improve JSON-RPC failure diagnostics and resilience
- Add --quiet option, to disable hashmeter output.

Version 0.3.3 - December 27, 2010

- Critical fix for sha256_cryptopp 'cryptopp_asm' algo

Version 0.3.2 - December 23, 2010

- Critical fix for sha256_via

Version 0.3.1 - December 19, 2010

- Critical fix for sha256_via
- Retry JSON-RPC failures (see --retry, under "minerd --help" output)

Version 0.3 - December 18, 2010

- Add crypto++ 32bit assembly implementation
- show version upon 'minerd --help'
- work around gcc 4.5.x bug that killed 4way performance

Version 0.2.2 - December 6, 2010

- VIA padlock implementation works now
- Minor build and runtime fixes

Version 0.2.1 - November 29, 2010

- avoid buffer overflow when submitting solutions
- add Crypto++ sha256 implementation (C only, ASM elided for now)
- minor internal optimizations and cleanups

Version 0.2 - November 27, 2010

- Add script for building a Windows installer
- improve hash performance (hashmeter) statistics
- add tcatm 4way sha256 implementation
- Add experimental VIA Padlock sha256 implementation

Version 0.1.2 - November 26, 2010

- many small cleanups and micro-optimizations
- build win32 exe using mingw
- RPC URL, username/password become command line arguments
- remove unused OpenSSL dependency

Version 0.1.1 - November 24, 2010

- Do not build sha256_generic module separately from cpuminer.

Version 0.1 - November 24, 2010

- Initial release.