Enable Cgminer / Sgminer API

For Awesome Miner to monitor the mining performed by Cgminer, Sgminer or similar mining software, the API of the mining software must be enabled. While this guide uses Cgminer and Sgminer in the examples, most Cgminer clones uses the same API and syntax.

The API can run in two different modes.

  • Restricted (read-only mode)
    This will allow Awesome Miner to connect to Cgminer and display mining statistics. It is however not possible to make any changes to the miner, like changing pool and changing device settings.
  • Privileged (write/modify mode)
    This mode will give Awesome Miner full access to the Cgminer API.

Awesome Miner will automatically configure the Managed Miners to use Privileged mode by default. These settings can be changed from the Advanced section of the miner properties in the Awesome Miner Options dialog.

Configure Cgminer & Sgminer

When connecting to an External Miner, the API access must be enabled in Cgminer configuration for that miner. There are two important parameters that are used to define API access.
  • api-listen
    This setting defines if the API should be enabled or disabled. When enabled, it will allow Awesome Miner to connect to the Cgminer/Sgminer API and request mining statistics.
  • api-allow
    If only api-listen is defined, the API will run in restricted mode. In order to enable privileged mode, api-allow needs to be defined with a prefix and IP address.

    There are two prefixes. R defines the restricted mode (read-only). W defines the privileged mode (write).

    The IP address specifies either a single IP address or a IP subnet (range of IP addresses).
    192.168.1.10 specifies that the API allows connections only from the IP address 192.168.1.10.
    192.168.1.0/24 specifies that the API allows connections from the IP address range 192.168.1.0 - 192.168.1.255 (will be written as 192.168.1.X in further examples).

Examples of api-allow usage
Configuration Description
192.168.1.10 Restricted access to IP address 192.168.1.10
W:192.168.1.10 Privileged access to IP address 192.168.1.10
W:192.168.1.0/24 Privileged access to IP addresses 192.168.1.X
W:192.168.0.0/16 Privileged access to IP addresses 192.168.X.X
W:192.168.0.0/16,W:127.0.0.1 Privileged access to IP addresses 192.168.X.X and 127.0.0.1
W:192.168.1.10,R:192.168.0.0/16 Privileged access to IP addresses 192.168.1.10 and restricted access to IP addresses 192.168.X.X (except 192.168.1.10 that will have privileged access)
W:0/0 Privileged access to all IP addresses

The parameters can either be set in the Cgminer configuration file or by command line parameters to Cgminer. Example of Cgminer configuration file settings that will enabled privileged API access to all computers with IP-addresses 192.168.X.X and to localhost (127.0.0.1).

            "api-listen": true,
            "api-allow": "W:192.168.0.0/16,W:127.0.0.1",
Example of Cgminer command line parameters to set the same configuration:
            cgminer.exe --api-listen --api-allow W:192.168.0.0/16,W:127.0.0.1

Back to help section