How bitmaintech/cgminer works
cgminer is a multithreaded Bitcoin miner: users configure one or more pools, the miner obtains work, dispatches it to supported FPGA/ASIC hardware, and submits resulting shares. The README also documents a command-line/configuration interface, an optional monitoring/control API, and an optional curses interface. Hardware support is spread across device-specific drivers, with USB and SPI/I2C transport helpers beneath some drivers. The sampled core and transport sources support those internal layers; the README supplies the broader product capabilities, so unsampled subsystem wiring is kept conservative.
Main entry points: cgminer.c Work and shares · usbutils.c USB transport · driver-SPI-bitmine-A1.c SPI miner drivers · driver-avalon.c USB miner drivers
Components 17
Mining runtime
- Mining coordinator
cgminer.c - Work and shares
cgminer.c
Pool connectivity
- Pool protocols
cgminer.c
Mining hardware
- USB miner drivers
driver-avalon.c - SPI miner drivers
driver-SPI-bitmine-A1.c - Avalon drivers
driver-avalon.c - Bitmain drivers
driver-bitmain.c - Spondoolies drivers
driver-spondoolies-sp10.c - USB transport
usbutils.c - SPI transport
spi-context.c - I2C transport
i2c-context.c
User control
- Options and config
cgminer.c - Curses interface
cgminer.c - Miner API
api.c
Other components
- Miner operator
- Mining pool
- FPGA and ASIC devices
Connections 28
- Miner operator → Options and config: sets options
- Options and config → Mining coordinator: configures
- Miner operator → Curses interface: controls
- Curses interface → Mining coordinator: controls
- Miner operator → Miner API: requests status
- Miner API → Mining coordinator: queries or controls
- Mining coordinator → Pool protocols: manages pools
- Pool protocols → Mining pool: requests work
- Mining pool → Pool protocols: returns work
- Pool protocols → Work and shares: supplies work
- Mining coordinator → Work and shares: coordinates
- Work and shares → Avalon drivers: dispatches work
- Work and shares → Bitmain drivers: dispatches work
- Work and shares → Spondoolies drivers: dispatches work
- Work and shares → USB miner drivers: dispatches work
- Work and shares → SPI miner drivers: dispatches work
- Avalon drivers → USB transport: uses USB
- Bitmain drivers → USB transport: uses USB
- Spondoolies drivers → USB transport: uses USB
- SPI miner drivers → SPI transport: transfers data
- SPI miner drivers → I2C transport: accesses controls
- USB miner drivers → USB transport: transfers data
- USB transport → FPGA and ASIC devices: communicates
- SPI transport → FPGA and ASIC devices: communicates
- I2C transport → FPGA and ASIC devices: communicates
- FPGA and ASIC devices → Work and shares: returns results
- Work and shares → Pool protocols: submits shares
- Pool protocols → Mining pool: submits shares