LinuxCommandLibrary

cgminer

TLDR

Mine Bitcoin using a pool with username and password

$ cgminer -o [stratum+tcp://pool:port] -u [username] -p [password]
copy
Solo mine to a local Bitcoin node
$ cgminer -o [http://localhost:8332] -u [rpcuser] -p [rpcpassword] --btc-address [your_address]
copy
Run in benchmark mode without submitting shares
$ cgminer --benchmark
copy
Enable the API on a specific port
$ cgminer -o [stratum+tcp://pool:port] -u [username] -p [password] --api-listen --api-port [4028]
copy
Load configuration from file
$ cgminer -c [path/to/config.json]
copy
Mine with multiple pools using load balancing
$ cgminer -o [pool1:port] -u [user1] -p [pass1] -o [pool2:port] -u [user2] -p [pass2] --load-balance
copy

SYNOPSIS

cgminer [-DdlmpPqUTouOchnV] [-o url] [-u user] [-p pass]

DESCRIPTION

cgminer is a multi-threaded multi-pool miner for Bitcoin and other SHA256d cryptocurrencies. Originally supporting CPU, GPU, FPGA, and ASIC mining, modern versions focus exclusively on ASIC devices as GPU mining is no longer economically viable for Bitcoin.
The miner supports multiple pools with configurable failover, load-balancing, and rotation strategies. It connects using the stratum protocol or JSON-RPC and submits proof-of-work solutions. The built-in API allows remote monitoring and control of mining operations.
CGMiner supports various ASIC hardware including Avalon, AntMiner, BitFury, Cointerra, Drillbit, HashFast, Icarus, and Klondike devices. On Linux, direct USB support requires no additional drivers, though udev rules may be needed for non-root access.

PARAMETERS

-o, --url URL

URL for bitcoin JSON-RPC server (pool or local node)
-u, --user USERNAME
Username for JSON-RPC server
-p, --pass PASSWORD
Password for JSON-RPC server
-O, --userpass USER:PASS
Username:password pair for server
-c, --config FILE
Load a JSON-formatted configuration file
--benchmark
Run in benchmark mode producing no actual shares
--shares NUMBER
Quit after mining the specified number of shares
--no-submit-stale
Do not submit shares if they are detected as stale
--btc-address ADDRESS
Bitcoin address for solo mining coinbase rewards
--balance
Change pool strategy to even share balance
--load-balance
Change pool strategy to quota based balance
--rotate MINUTES
Rotate between pools every N minutes
--failover-only
Do not leak work to backup pools when primary is active
--api-listen
Enable the miner API (disabled by default)
--api-port PORT
Port number for API (default: 4028)
--api-allow [G:]IP[/PREFIX]
Allow API access only to the given addresses
-D, --debug
Enable debug output
-l, --log INTERVAL
Interval in seconds between log output (default: 5)
-q, --quiet
Disable logging output, display status and errors only
-T, --text-only
Disable ncurses formatted screen output
--temp-cutoff TEMP
Temperature where devices will be disabled
--usb DEVICES
USB device selection (e.g., 1:2,1:3 or BAS:1,BFL:1)
-h, --help
Print help message and exit
-V, --version
Display version and exit

CAVEATS

GPU mining support has been removed in recent versions as it is no longer profitable for Bitcoin. On Linux, USB device permissions may require adding the user to the plugdev group or installing udev rules from the cgminer distribution. High hash rates generate significant heat and power consumption. Pool URLs must use the correct protocol prefix (http:// for solo mining, stratum+tcp:// for pool mining).

HISTORY

CGMiner was created by Con Kolivas (ckolivas) and first released in 2011. It began as a fork of the CPU miner cpuminer and was initially called poclbm-mod before being renamed to CGMiner. The name stands for Con's GPU Miner, though it later expanded to support FPGAs and ASICs. It became one of the most widely used Bitcoin mining programs during the GPU and early ASIC mining eras. BFGMiner was later forked from CGMiner in 2012 with a focus on FPGA/ASIC modularity.

SEE ALSO

bfgminer(1), minerd(1), xmrig(1)

Copied to clipboard