Setup notes for bitcoin/bfgminer on Fedora 17 with nVidia GPU

From Nearline Storage
Jump to: navigation, search

This isn't a HOWTO, these are just my personal notes

Based on http://servertoast.com/2013/04/02/cgminer-on-fedora-18-with-nvidia-gpu/

nVidia GPU setup

  1. Must have nVidia propietary driver installed - use RPMFusion repo
  2. Install development headers for driver: xorg-x11-drv-nvidia-devel
  3. Install nVidia CUDA 5.0.35 for Fedora 16: https://developer.nvidia.com/cuda-toolkit-50-archive
    chmod ugo+x cuda_5.0.35_linux_64_fedora16-1.run
    sudo ./cuda_5.0.35_linux_64_fedora16-1.run -override compiler
  4. Create /etc/ld.conf.d/cuda.conf:
    /usr/local/cuda/lib64
    /usr/local/cuda/lib
  5. sudo ln -s /usr/lib64/nvidia/libOpenCL.so.1 /usr/lib64/nvidia/libOpenCL.so
  6. sudo ldconfig -v

Bitcoin client/wallet setup

  1. Download bitcoin source: http://bitcoin.org/en/download
  2. Added freeglut-devel miniupnpc
  3. CFLAGS=-I/usr/local/cuda/include LDFLAGS=-L/usr/lib64/nvidia ./configure --enable-cpumining && make && sudo make install
  4. sudo ldconfig -v
  5. Create ~/.bitcoin/bitcoin.conf:
    server=1
    rpcuser=randomUserid
    rpcpassword=randomPassword
    rpcport=randomPortNumber
  6. Start up, set options to minimize to taskbar and to minimize on close
  7. Set up autostart with "-min" option

Bitcoin API reference

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Issue commands as "bitcoind command parameters | jq '.'"

Responses are in JSON format, use "jq" for parsing JSON in bash scripts: http://stedolan.github.io/jq/download/

Miner setup

I started out using cgminer 3.4.0, which worked fine with my nVidia GPU, but not with the Bitfountain/ASICMiner Block Erupter USB keys. Reading the Bitcoin forums it appears that you have to use cgminer 3.1.1 with those to get them to work. So I reverted to that for everything. The steps are essentially the same for all of these versions, what varies is what you download.

Prebuilt binary downloads are available for cgminer 3.1.1 which work fine, but you can build your own as well.

For any of these, if you want nVidia GPU support, then you have to install the nVidia drivers as described above and use the "CFLAGS=-I/usr/local/cuda/include LDFLAGS=-L/usr/lib64/nvidia ./configure ..." incantation as described above as well.

  1. From normal repos, I added libmicrohttpd libmicrohttpd-devel jansson jansson-devel libudev-devel lm_sensors-devel libcurl-devel libusb-devel
  2. Installed uthash package, it's in the F19 repo but I had to search for it for F17. Found it in F20 rawhide, which worked fine on F17: uthash-1.9.8-4.fc20.noarch
  3. CFLAGS=-I/usr/local/cuda/include LDFLAGS=-L/usr/lib64/nvidia ./configure --enable-icarus && make && sudo make install
  4. sudo ldconfig -v
  5. Create ~/.cgminer/cgminer.conf:
    1. Define pools
    2. Turn on API interface
      "api-listen" : true
    3. Allow local machine to send privileged API commands
      "api-allow" : "W:127.0.0.1"
    4. Add icarus options if you're using ASCMiner USB keys
      "icarus-options" : "115200:1:1"
      "icarus-timing" : "3.0=100"
  6. Set up autostart

The command to run one ASICMiner USB device is "cgminer -S /dev/ttyUSB0" Add additional "-S /dev/ttyUSBn" options if you have more than one device.

The cgminer/bfgminer API

Issue commands with "echo -n command|parameter,value | nc 127.0.0.1 4028 | sed 's/|/\n/g;s/,/\n\t/g'"
Responses are strings delimited with "|" and commas.

If you want JSON format responses, you have to do JSON format requests:
"echo -n "{\"command\":\"command\",\"parameter\":\"parameter,value\"}" | nc 127.0.0.1 4028 | jq '.'"

Use "jq" for parsing JSON in bash scripts: http://stedolan.github.io/jq/download/

See cgminer's API-README for information on the available commands. There are minor differences in the API command names and results returned between versions of the programs. Experiment.