--- layout: post status: publish published: true title: Cryptocurrency Mining Rig setup author: display_name: sipp11 login: sipp11 email: sipp11@gmail.com url: '' author_login: sipp11 author_email: sipp11@gmail.com wordpress_id: 918 wordpress_url: http://blog.10ninox.com/?p=918 date: '2014-02-20 15:51:01 +0700' date_gmt: '2014-02-20 08:51:01 +0700' categories: - linux tags: - mining --- Don't ask me if it's worth investment. I don't know since difficulty and exchange rate change (drop?) everyday. It's getting harder and harder to get even but it makes me feel building computer fun again. LoL After trial and error, the painless route is to creating USB flash drive for it. Clone it for another rig. Of course, I use Xubuntu, I don't know how to deal with Windows these days. What you need:- * Xubuntu - get x64 one -- Xubuntu, not Ubuntu. Unity is weird * 8GB or more Flash drive; it doesn't necessarily need to be a fast one. Just make sure it's not extraordinarily slow. (You need one extra for Xubuntu setup if you don't burn Xubuntu ISO to CD) * Mining Rig -- Any hardware with AMD/ATI VGA cards, 4GB of RAM, any CPU would do it. * 1x-to-16x PCI-e riser or 16x PCI-e riser -- 1x-to-16x is preferred since better airflow preferred. Well, basically you don't need this to get fully functional rig, but your rig will run so darn hot and it is NOT good at all. What you don't need:- * From my experience, you don't need any dummy plug. * Powered 1x-to-16x PCI-e riser -- some recommended it over unpowered but you only need if you have > 3 GPUs (or using 1x slot) since 75W each slot draw -- GPU specification -- from mainboard is pretty much putting load under mainboard, esp. you are using 1x PCI-e slot which by specification 1x slot can't handle that much power (only 25W) while 16x is comfortably handled. To build your mining rig is pretty much like every computer, but we choose to have only needed things, Mainboard, CPU, RAM, Flash drive, VGA cards, to save power as much as possible. If you like to know which hardware is better, you probably what to look at Mining hardware comparison. You should look at kH/s rate, the more the better, but IMHO you need to think of average kH/s of each GPU since the highest hash rate in that table means they overclocks their GPUs as well. To me, mining coins is long-term; need to be stable; run every at stock; keep temperature normal. For the first time ever, you need to have monitor, keyboard or mouse. * get into BIOS, ```del``` on POST and choose to boot with Xubuntu setup flash drive. Also, you might like to check option power on after power failure too. It's very handy. * Xubuntu setup process is pretty much painless, you mostly click many 'next' buttons to get it done. One thing you need an attention is Log in automatically checkbox. You need to make sure it's checked. * Reboot after setup is done. Now you need to test if it's working by taking out Xubuntu setup flash drive out and let Xubuntu one boot up. * If it boots into Xubuntu, we are on half way to success. If not, repeat above. * Go to terminal and install GPU driver and necessary stuffs $ sudo apt-get update $ sudo apt-get install byobu openssh-server fglrx-updates fglrx-amdcccle-updates fglrx-updates-dev * Check if Xubuntu sees all your GPU $ sudo aticonfig --lsa If you see every GPU, that's good. If not, try to power off, check, re-insert your GPU again * Configure your GPU $ sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak $ sudo aticonfig --adapter=all --initial * Reboot to verify if everything works $ sudo aticonfig --adapter=all --odgt Next is ```cgminer``` part, download here. Please download 3.7.2 version since it's the last version supporting ```scrypt``` which is likely to be protocol for most pool; otherwise, we need proxy in order to join any pool. This post will not cover that since I like to write how I setup and get it running automatically first. $ tar xjvf cgminer-3.7.2-x86_64-built.tar.bz2 You end up having ```cgminer-3.7.2-x86_64-built``` directory if download from here. You can test whether it is working: $ cd cgminer-3.7.2-x86_64-built $ ./cgminer -n [2014-02-20 13:08:06] CL Platform 0 vendor: Advanced Micro Devices, Inc. [2014-02-20 13:08:06] CL Platform 0 name: AMD Accelerated Parallel Processing [2014-02-20 13:08:06] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3) [2014-02-20 13:08:06] Platform 0 devices: 3 [2014-02-20 13:08:06] 0 Pitcairn [2014-02-20 13:08:06] 1 Pitcairn [2014-02-20 13:08:06] 2 Tahiti [2014-02-20 13:08:06] ADL Initialisation Error! Error -1! [2014-02-20 13:08:06] 3 GPU devices max detected [2014-02-20 13:08:06] USB all: found 9 devices - listing known devices [2014-02-20 13:08:06] No known USB devices * ```-n means listing all GPU devices``` If you don't see all, you like to try ```aticonfig``` things above again.
My example rig above consisting of 2 * Gigabyte 7870 [Pitcairn] and 1 * Gigabyte 280x [Tahiti]. I just want to show that you can have different GPU in the same rig as long as your power supply unit can handle. If you see all devices, that's a good sign. Do not worry errors like above though. It's working just fine and that's you have everything you need to mine. Up to this point, monitor, keyboard and mouse are useless. You can shut computer down and take them off. From now on, you plug your power and switch on at power supply, it should be able to turn on automatically and surely that's what we intend to. Running ```cgminer``` is the last thing left to do. Well, I can't cover everything, but Mining hardware comparison is where you can see other configurations which is a good guideline for trials and errors. For pool, if you don't know anything, you will google a lot to see what the heck is pool. For me: * If you want to mine LiteCoin (LTC), you go register and add worker at WeMineLtc.com. Some says they are too large pool already, but I say it's very reliable and as newbie, you need to get familiar with mining process first. This is a good place to start. * If you want to mine DogeCoin (DOGE), you go register and add worker at RapidHash. Very reliable service there. You can also find small pools everywhere, but I used to try some of them and I don't get coins at all after a week mining. -*- Maybe your mileage may vary. After registration, you will get: * Statum Servers -- usually on pools' front page * WeMineLTC index page: World-Wide Server (VARDIFF): ```stratum+tcp://hot.wemineltc.com:3335``` * Rapidhash has an example command shown on first page: ```stratum+tcp://stratum.rapidhash.net:3333``` * Worker user/password: it will usually be your username.xxx; for password, you can just use 1 or anything simple. If someone else want to mine for you, why not let them? haha You only keep account password and PIN safe. That's enough. Next you try running ```cgminer```, command is something like this $ export DISPLAY=:0 $ export GPU_MAX_ALLOC_PERCENT=100 $ export GPU_USE_SYNC_OBJECTS=1 $ ./cgminer --scrypt --no-submit-stale -o stratum+tcp://stratum.rapidhash.net:3333 -u username.worker -I 13 -w 256 --thread-concurrency 8192 --auto-fan --gpu-engine 980 --gpu-threads 2 * ```-I ```means Intensity [0-20] more intensity usually means more hashes, but with 280x >13 intensity produces more invalids; well, trial and error after all. * ```-w 256 ```means worksize, I only see people use this value haha. * ```--thread-concurrency 8192 ``` to set GPU thread concurrency for scrypt mining, larger doesn't always mean more hashes though. * ```--auto-fan ``` means let card adjust how fast fan is based on temperature. You could do like ```--auto-fan --gpu-fan 30-85``` to specify range fan should be also. People claimed that running 24|7 at max fan speed could kill fan in 2 months. Well, believe it or not? I don't dare trying * ```--gpu-engine 980 ``` means GPU clock speed; range setting like ```--gpu-engine 980-1000``` is also possible. * ```--gpu-threads 2``` means number of threads per GPU (1 - 10) Above you are setting one value per parameters. If you have many of the same card in your rig, that will be applied to all cards. However, if you want each card running different parameters, you could do like ```-I 13,18 -w 256,256 --thread-concurrency 8192,12000 --auto-fan --gpu-engine 980,1050``` to have different settings for each card. However, it's better to run many ```cgminer``` instance if you have 2 different GPU by using ```-d 2``` means using only device number 2 (from ```./cgminer -n``` as shown above) or you can use ```-d 0,1``` to use this ```cgminer``` instance for device number 0 and 1. When you get satisfied parameters, you can create a script file. For example, ```mining.sh``` #!/bin/sh export DISPLAY=:0 export GPU_MAX_ALLOC_PERCENT=100 export GPU_USE_SYNC_OBJECTS=1 cd /home/ninox/cgminer-3.7.2-x86_64-built ./cgminer --scrypt --no-submit-stale -o stratum+tcp://stratum.rapidhash.net:3333 -u ninox.w1 -p 1 -d 2 -I 13 -w 256 --thread-concurrency 8192 --auto-fan --gpu-fan 20-85 --gpu-engine 980 --gpu-threads 2 Then make this file executable $ chmod +x mining.sh Verify if it works $ ./mining.sh You should see something like cgminer version 3.7.2 - Started: [2014-02-19 11:42:25] -------------------------------------------------------------------------------- (5s):699.9K (avg):684.5Kh/s | A:566864 R:4944 HW:0 WU:618.4/m ST: 2 SS: 7 NB: 919 LW: 8874 GF: 1 RF: 0 Connected to stratum.rapidhash.net diff 128 with stratum as user ninox.w1 Block: 2102e8d1... Diff:1.15K Started: [03:17:01] Best share: 2.18M -------------------------------------------------------------------------------- [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit GPU 0: 75.0C 100% | OFF / 5.000h/s | A: 0 R: 0 HW:0 WU: 0.0/m I:13 GPU 1: 73.0C 60% | OFF / 0.000h/s | A: 0 R: 0 HW:0 WU: 0.0/m I:13 GPU 2: 74.0C 3367RPM | 698.9K/684.5Kh/s | A:566864 R:4944 HW:0 WU: 618.4/m I:13 -------------------------------------------------------------------------------- [2014-02-20 03:16:24] Accepted 01a73a13 Diff 155/128 GPU 2 pool 0 [2014-02-20 03:16:29] Accepted 2b989e17 Diff 1.5K/128 GPU 2 pool 0 [2014-02-20 03:16:30] Accepted 01ed9e3c Diff 133/128 GPU 2 pool 0 [2014-02-20 03:16:36] Stratum from pool 0 detected new block [2014-02-20 03:16:56] Accepted 01423a05 Diff 203/128 GPU 2 pool 0 [2014-02-20 03:17:01] Stratum from pool 0 detected new block Shown above is using Gigabyte R9-280x working alone. The ambient temperature is roughly 30ºC; at night with lower ambient temperature, I could push more hashes in 7x0, but in quite hot country, I don't want to kill my GPU quickly by running at 8xºC always. I'm impressed with 2 * Gigabyte 7870 more. With half a price of Gigabyte R9-280x, they are running smooothly at 42x kH/s each card at very low temperature. cgminer version 3.7.2 - Started: [2014-02-19 11:43:02] -------------------------------------------------------------------------------- (5s):823.8K (avg):844.7Kh/s | A:697728 R:4608 HW:0 WU:765.9/m ST: 2 SS: 66 NB: 923 LW: 9081 GF: 1 RF: 1 Connected to stratum.rapidhash.net diff 128 with stratum as user ninox.w1 Block: a3b04227... Diff:1.15K Started: [03:20:46] Best share: 289K -------------------------------------------------------------------------------- [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit GPU 0: 74.0C 100% | 422.9K/422.5Kh/s | A:349488 R:2304 HW:0 WU: 382.8/m I:18 GPU 1: 73.0C 31% | 423.0K/422.2Kh/s | A:348240 R:2304 HW:0 WU: 383.2/m I:18 GPU 2: 75.0C 3359RPM | OFF / 0.000h/s | A: 0 R: 0 HW:0 WU: 0.0/m I:18 -------------------------------------------------------------------------------- This is stock clock speed of 7870 while I have to underclock my R9-280x and put it on the outermost to get coldest air to retain 7x ºC or its temperature will rise to 8x ºC. As always, your mileage may vary. Mining part is complete. Nonetheless, you would want to have it start automatically if your system fails. The easiest way to deal with is crontab. I like to have one script to run it. ```~/mining-cron.sh``` #!/bin/sh sleep 40 screen -dmS miner280 /home/ninox/rapid-280.sh sleep 40 screen -dmS miner7870 /home/ninox/rapid-2-7870.sh Don't forget to make this file executable also. $ chmod +x mining-cron.sh Above means hold for 40 seconds then run ```/home/ninox/rapid-280.sh``` in ```screen``` named miner280 and hold for another 40 seconds before running another file in ```screen``` named miner7870. For those who do not know what ```screen``` is it's a shell session which is always running in background. To check how session is, you could do: $ screen -r There are several suitable screens on: 1892.miner7870 (02/19/2014 11:43:00 PM) (Detached) 1680.miner280 (02/19/2014 11:42:20 PM) (Detached) Type "screen [-d] -r [pid.]tty.host" to resume one of them. $ * To open specific screen using ```screen -r miner7870``` and * ```CTRL + a then d``` to get out of that session without terminating the process. Then putting in crontab $ crontab -e @reboot /home/ninox/rapid-cronjob.sh This is setting cron job for your own user, not system.