Bitcoin/CGMiner

From Omnia
Revision as of 21:26, 26 October 2023 by Kenneth (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CGMiner

CGMiner - http://ck.kolivas.org/apps/cgminer/

"This is a multi-threaded multi-pool FPGA and ASIC miner for bitcoin."

ckolivas/cgminer · GitHub - https://github.com/ckolivas/cgminer

Install

Source

Dependencies:

yum install libudev-devel

Build:

wget http://ck.kolivas.org/apps/cgminer/4.5/cgminer-4.5.0.tar.bz2
tar -jvxf cgminer-4.5.0.tar.bz2
cd cgminer-4.5.0
#./configure --enable-icarus --enable-ants2
./configure --enable-icarus --enable-ants2 --prefix=/opt/cgminer
make clean && make
sudo make install

Run (from build):

./cgminer --config ~/conf/bitcoin.conf

Run (from install):

/opt/cgminer/bin/cgminer --config ~/conf/bitcoin.conf

Binary

wget http://ck.kolivas.org/apps/cgminer/cgminer-4.5.0-x86_64-built.tar.bz2
tar -jvxf cgminer-4.5.0-x86_64-built.tar.bz2
cd cgminer-4.5.0-x86_64-built
./cgminer --config ~/conf/bitcoin.conf

Error when I tried to run it on CentOS 6:

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

Notes

http://learn.adafruit.com/system/assets/assets/000/009/127/medium640/BlockErupterUSB-FrontBack-crop.jpg?1371638254

sudo apt-get update
sudo apt-get install libudev-dev autoconf automake pkg-config libtool libcurl4-openssl-dev \
   libncurses5-dev git pkg-config yasm make libusb-1.0-0-dev \
   build-essential curl libncurses-dev
yum install gcc make git autoconf automake pkg-config libtool libudev-devel libcurl-devel ncurses-devel

Build method #1: (doesn't work)

git clone https://github.com/ckolivas/cgminer.git
cd cgminer
libtoolize
aclocal
autoheader
automake --add-missing  # ignore errors here
autoconf
./configure --enable-icarus  # FAILS HERE WITH MISSING Makefile.in
make

Build method #2:

git clone https://github.com/ckolivas/cgminer.git
cd cgminer
aclocal
./autogen.sh
## export LIBCURL_CFLAGS='-I/usr/include/curl'
## export LIBCURL_LIBS='-L/usr/lib -lcurl'
./configure --enable-icarus
make

Deep Bit:

./cgminer -o http://pit.deepbit.net:8332 -u kenneth@k.ttak.org -p [password]
./cgminer -o http://pit.deepbit.net:8332 -u kenneth@k.ttak.org_[WORKER] -p [password]

BitMinter:

./cgminer -o http://mint.bitminter.com:8332 -u kennethburgener -p [password]
./cgminer -o http://mint.bitminter.com:8332 -u kennethburgener_[WORKER] -p [password]

Raspberry Pi dmesg: (notice the "cp210x converter now attached to ttyUSB0")

# dmesg
Oct  2 17:47:59 pi-ken kernel: [   58.113629] usb 1-1.3.4: new full-speed USB device number 8 using dwc_otg
Oct  2 17:47:59 pi-ken kernel: [   58.220510] usb 1-1.3.4: New USB device found, idVendor=10c4, idProduct=ea60
Oct  2 17:47:59 pi-ken kernel: [   58.220543] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct  2 17:47:59 pi-ken kernel: [   58.220561] usb 1-1.3.4: Product: CP2102 USB to UART Bridge Controller
Oct  2 17:47:59 pi-ken kernel: [   58.220576] usb 1-1.3.4: Manufacturer: Silicon Labs
Oct  2 17:47:59 pi-ken kernel: [   58.220589] usb 1-1.3.4: SerialNumber: 0001
Oct  2 17:47:59 pi-ken kernel: [   58.276808] usbcore: registered new interface driver usbserial
Oct  2 17:47:59 pi-ken kernel: [   58.278557] usbcore: registered new interface driver usbserial_generic
Oct  2 17:47:59 pi-ken kernel: [   58.280299] USB Serial support registered for generic
Oct  2 17:47:59 pi-ken kernel: [   58.280348] usbserial: USB Serial Driver core
Oct  2 17:47:59 pi-ken kernel: [   58.288666] usbcore: registered new interface driver cp210x
Oct  2 17:47:59 pi-ken kernel: [   58.290465] USB Serial support registered for cp210x
Oct  2 17:47:59 pi-ken kernel: [   58.290643] cp210x 1-1.3.4:1.0: cp210x converter detected
Oct  2 17:47:59 pi-ken kernel: [   58.363660] usb 1-1.3.4: reset full-speed USB device number 8 using dwc_otg
Oct  2 17:47:59 pi-ken kernel: [   58.468256] usb 1-1.3.4: cp210x converter now attached to ttyUSB0

CentOS 6 dmesg: (notice the "cp210x converter now attached to ttyUSB0")

# dmesg
Oct  3 09:40:05 klinux kernel: usb 3-1: new full speed USB device number 2 using uhci_hcd
Oct  3 09:40:05 klinux kernel: usb 3-1: New USB device found, idVendor=10c4, idProduct=ea60
Oct  3 09:40:05 klinux kernel: usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct  3 09:40:05 klinux kernel: usb 3-1: Product: CP2102 USB to UART Bridge Controller
Oct  3 09:40:05 klinux kernel: usb 3-1: Manufacturer: Silicon Labs
Oct  3 09:40:05 klinux kernel: usb 3-1: SerialNumber: 0001
Oct  3 09:40:05 klinux kernel: usb 3-1: configuration #1 chosen from 1 choice
Oct  3 09:40:05 klinux kernel: usbcore: registered new interface driver usbserial
Oct  3 09:40:05 klinux kernel: USB Serial support registered for generic
Oct  3 09:40:05 klinux kernel: usbcore: registered new interface driver usbserial_generic
Oct  3 09:40:05 klinux kernel: usbserial: USB Serial Driver core
Oct  3 09:40:05 klinux kernel: USB Serial support registered for cp210x
Oct  3 09:40:05 klinux kernel: cp210x 3-1:1.0: cp210x converter detected
Oct  3 09:40:05 klinux kernel: usb 3-1: reset full speed USB device number 2 using uhci_hcd
Oct  3 09:40:05 klinux kernel: usb 3-1: cp210x converter now attached to ttyUSB0
Oct  3 09:40:05 klinux kernel: usbcore: registered new interface driver cp210x
Oct  3 09:40:05 klinux kernel: cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
# lsusb
Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 001 Device 007: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
# ./cgminer -n
 [2013-10-02 23:10:28] USB all: found 7 devices - listing known devices
.USB dev 0: Bus 1 Device 7 ID: 10c4:ea60
  Manufacturer: 'Silicon Labs'
  Product: 'CP2102 USB to UART Bridge Controller'
.USB dev 1: Bus 1 Device 5 ID: 10c4:ea60
  Manufacturer: 'Silicon Labs'
  Product: 'CP2102 USB to UART Bridge Controller'
 [2013-10-02 23:10:28] 2 known USB devices

References:

cgminer raspberry pi

Recommended to use an older version on Raspberry Pi:

Initial Setup & Overview | PiMiner Raspberry Pi Bitcoin Miner | Adafruit Learning System - http://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/initial-setup-and-assembly

Install Software | PiMiner Raspberry Pi Bitcoin Miner | Adafruit Learning System - http://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/install-cgminer

Note: 3.1.1 is the last version that includes support for targeted device selection:

--scan-serial|-S <arg> Serial port to probe for Icarus FPGA Mining device

tar method:

sudo apt-get update
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 libcurl4-openssl-dev libncurses5-dev libudev-dev

wget http://ck.kolivas.org/apps/cgminer/3.1/cgminer-3.1.1.tar.bz2
tar xvf cgminer-3.1.1.tar.bz2
cd cgminer-3.1.1
./configure --enable-icarus
make

git source method:

sudo apt-get update
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 libcurl4-openssl-dev libncurses5-dev libudev-dev autoconf automake

git clone https://github.com/ckolivas/cgminer.git
cd cgminer
git checkout v3.1.1
aclocal
./autogen.sh
./configure --enable-icarus
make

config:

cat > cgminer.conf << EOF
{
    "api-allow": "0/0",
    "api-listen": true,
    "api-port": "4028",
    "expiry": "120",
    "failover-only": true,
    "icarus-options": "115200:1:1",
    "icarus-timing": "3.0=100",
    "kernel-path": "/usr/local/bin",
    "log": "5",
    "no-pool-disable": true,
    "pools": [
        {
            "pass": "[PASSWORD]",
            "url": "http://pit.deepbit.net:8332",
            "user": "kenneth@k.ttak.org"
        }
    ],
    "queue": "2",
    "scan-time": "60",
    "shares": "0",
    "worktime": true
}
EOF

config:

cat > cgminer.conf << EOF
{
    "pools": [
        {
            "url": "http://pit.deepbit.net:8332",
            "user": "kenneth@k.ttak.org",
            "pass": "[PASSWORD]"
        }
    ]
}
EOF
ls /dev/*USB*

# sudo nohup ./cgminer-3.1.1/cgminer --config /home/pi/cgminer.conf -S /dev/ttyUSB0 -S /dev/ttyUSB1 >/dev/null 2>&1&
sudo nohup ./cgminer --config cgminer.conf -S /dev/ttyUSB0 >/dev/null 2>&1&

cgminer api

cgminer API - https://github.com/ckolivas/cgminer/blob/master/API-README

PiMiner

git clone https://github.com/adafruit/PiMiner.git

Forked to: https://github.com/kiloforce/cgminerminer

git clone https://github.com/kiloforce/cgminerminer.git

string command version:

# nc localhost 4028
version|
STATUS=S,When=1380856129,Code=22,Msg=CGMiner versions,Description=cgminer 3.1.1|VERSION,CGMiner=3.1.1,API=1.25|

json command version:

# nc localhost 4028
{"command":"version"}
{"STATUS":[{"STATUS":"S","When":1380856108,"Code":22,"Msg":"CGMiner versions","Description":"cgminer 3.1.1"}],
"VERSION":[{"CGMiner":"3.1.1","API":"1.25"}],"id":1}

keywords