Monday, December 23, 2013

Bitcoin Mining with Block Erupter ASIC Miner in Ubuntu

With the new rise of Bitcoin prices yet again more and more people invest in buying coins and mining hardware. This drives the prices up, not only of the coins themselves but the hardware too.
There are still people who consider bitcoin as a learning process, hobby or simply don't have the money to invest thousands of Euros in mining hardware, but would like to mine efficiently. The solution can be the Block Erupter Bitcoin miner.


Block Erupter is a small USB ASIC miner (Application Specific Integrated Circuit) that consumes very low power and gives a reasonable hash rate in return (roughly half of that of a modern GPU, but at a fraction of the cost!). It is small, "plug and play" and makes a perfect gift or hobby investment for enthusiasts.
In Europe the price of these miners has climbed quite strong after the price of Bitcoins went high (800-1000€ range), a Block Erupter was selling for around 25€ at the beginning of November where it is selling at around 75€ at mid December.




Technical Specifications


Dimensions: 2x4 cm (WxH; without USB connector)
Connection: USB port
Power Usage: 2.5W (5V DC, 500-510mA)
Hash Rate: 300-336 MH/s
Price: Varies, cheapest new devices is ~50€ as of 2013 Dec 15 (ebay)
Additional: Green LED indicates the status (LED on=standby, LED blinking=share is found/hashing)

(Reference see [1])

Mining with cgminer


In this example I will describe how to mine using cgminer [2] software under Ubuntu 12.10. If your Ubuntu is newer, it is not a problem, the steps should also work on the newer system. 

The device is "plug and play" under Linux, it doesn't require any drivers to be installed (unlike in Windows) so it is pretty easy to set up. Individual problems (missing packages and such) may arise during installation, however these are rather easy to solve. If you are having problems, leave a comment and I will get back to you ASAP to find the problem and help you get going.
  1. Download the latest cgminer.tar version from: http://ck.kolivas.org/apps/cgminer/
  2. Open a terminal (CTRL+T) and navigate to your download folder, by default
    cd Downloads
  3. Untar the file
    tar -xjvf cgminer-x.x.x.tar.bz2
  4. Go into the newly created directory
    cd  cgminer-x.x.x.tar.bz2
  5. ./configure --enable-icarus
  6. If you got any errors at the end of configuration, check them and see what package(s) are you missing. Install them with sudo apt-get install <package-name> OR from the synaptic package manager (sudo synaptic from he terminal)
    After eliminating the errors run
    sudo make && sudo make install
  7. Copy the example configuration file into a new configuration file that contains your pool's details.
    cp example.conf yourconfig.conf
  8. Now edit the config file you just created. This will have lines in it with pool address, worker name and passwords. Fill these out and save them.
    gedit yourconfig.conf
  9. Then to run cgminer, but note that you have to be root in order for Ubuntu to recognize the USB miner, so
    sudo cgminer --config yourconfig.conf 
  10. Alternatively, if you do not want to use a config file you can also run cgminer with
    sudo cgminer -o pooladdress:port -u minername -p port
Block Erupter mining under my Ubuntu machine

Suggestions


Now the down side, the Block Erupter gets hot in normal operating conditions. And by hot I mean HOT. After about 5 minutes of testing it almost burned my finger when I touched it. Hence it is advised to invest into cooling to prolong the lifetime of the miner.


Additional:
  • Powered USB Hub (each Block Erupter requires ~0.5A)
  • Cooling fan
  • Heat sinks
  • OPTIONAL: Raspberry Pi to control the miner(s)

Powered USB Hub


Make sure it can supply enough power to the miners. Each miner takes 0.5A at 5V DC giving 2.5 Watts of power consumption (Power=Voltage*Current). Hence a 5 USB port hub should get at least 5*0.5A=2.5A of current in order to supply enough power if 5 miners are connected. Even better, it is advised to get one with a slightly higher rating, say 3A supply for 5 miners. On the other side if you need 2.5A and you only have 2, it won't work.

Cooling


Passive Cooling
Generally preferred in power electronics as there are no components to fail (in the cooling system). Efficiency is lower than that of forced air or liquid cooling, but the miner should be built so that it can function out of the box as well. Although I doubt that the Block Erupter would live too long if running extensively without some cooling measures.

Forced Air Cooling
Installing a small fan to provide airflow over the miner is a common technique. USB fans are the easiest to use as they are "plug and play", however it is going to take 1 of the USB ports
A12V DC CPU fan can also do the job, and most likely provide better cooling performance as well. However, a CPU fan requires a separate 12V DC power supply. While practically it can run off from 5V DC, the airflow will be severely limited.


I have seen many people using a fan such as this one, I assume it does a nice job.

 

Personal Experience


I have decided to cover the top of my Block Erupter in heat sinks to increase heat transfer to the environment. I have ordered some small Copper heat sinks from eBay with some thermal paste sticker on the back for easy application. I will mount these on the front side of my miner and then direct a small USB fan on it as well. I hope to keep the temperature of the miner as low as possible using this method.


USB fan (source:Amazon.com)


Update: Unfortunately, my heat sinks didn't arrive from eBay so I have decided to give up this plan. Instead I have found a small USB fan I bought previously that I can use here.  (see image on the left)
The fan  produces quite a strong air flow so I have decided to have  a go at it.





I have removed the outer case so I am left with the inside only that allows me to better direct the airflow over the Block Erupter.
It is a little noisy, but I am running it in the basement so it doesn't bother anyone.
This fan keeps the ASIC miner at room temperature without any problem, it doesn't heat anywhere as much as without the fan.

As a footnote I noticed that when operating the miner from a USB port on my laptop it heats up  much faster than when powering it via an USB hub. Also I noticed that (at least when plugged into my laptop) the miner heats up even when I am not mining with it, LED lighting.

 

Conclusion


Is it worth to buy a Bloc Erupter? It depends why you want to buy it. It could be considered more of a hobby rather than a serious income. With the ~300 MH/s one will not get rich, it is just enough to make up for the price of electricity and the initial investment. 

Unfortunately I do not have any data on the lifetime of the small miners, nor could I find anything related online. So I cannot clearly state whether they are worth their money (on a purely economical basis) or not. I will record my progress of using my Block Erupter and update this article depending on my findings. One thing is for sure, it is a fun thing to have around, showing your support and liking of the Bitcoin community and possibly spreading the word about Bitcoins to your friends.

Sunday, November 17, 2013

Ubuntu Update Error - Disk Is Full ?

My last Software Update didn't go well and something got broken. Afterwards I had a nice little red mark on the top bar on my Desktop saying that the Update was unsuccessful. No matter how many times I tried to re-run the upgrade it didn't work.

sudo apt-get update

Returned that there are is a broken package and I should run apt-get -f install to repair broken packages.

Trying the command as per suggested in the terminal window gave the following result:

nargren@T808:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-headers-3.2.0-56
The following NEW packages will be installed
  linux-headers-3.2.0-56
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
3 not fully installed or removed.
Need to get 0 B/11.7 MB of archives.
After this operation, 56.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 803914 files and directories currently installed.)
Unpacking linux-headers-3.2.0-56 (from .../linux-headers-3.2.0-56_3.2.0-56.86_all.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-3.2.0-56_3.2.0-56.86_all.deb (--unpack):
 unable to create `/usr/src/linux-headers-3.2.0-56/arch/parisc/include/asm/superio.h.dpkg-new' (while processing `./usr/src/linux-headers-3.2.0-56/arch/parisc/include/asm/superio.h'): No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-headers-3.2.0-56_3.2.0-56.86_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Saying that there is no space left on the device made me check my disk partitions.

nargren@T808:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        14G   11G  2.3G  84% /
udev            489M  4.0K  489M   1% /dev
tmpfs           199M  980K  198M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            497M  224K  496M   1% /run/shm
/dev/sda3        58G   30G   25G  55% /home

It showed that there is plenty of space. Looking for further advice on my issue I stumbled upon this post on superb.com. Although the issue was not much related to my problem, I could use the techniques described there.

Using the command

for i in /*; do echo $i; find $i | wc -l; done

What this does is it counts the number of files in the root (/*) directory. Once it finishes (can take some time) run it again on the directory that had most f the files in it. To do so simply change the "/*" part of the code. So for example if your /usr directory contained the most of the files, then it would be 

for i in /usr/*; do echo $i; find $i | wc -l; done

(Please not that this command can take a while to run, be patient)

I found that for me the /usr directory was overcrowded with files, 786000 to be exact. Most of this was occupied by the /usr/src sub-directory. After some more searching and research, turns out this holds the different kernel header files.

Since it is not advised to manually remove these files, I checked quickly what kernel I'm using, just to know what to leave intact.

nargren@T808:~$ uname -a
Linux T808 3.2.0-56-generic-pae #86-Ubuntu SMP Wed Oct 23 17:51:27 UTC 2013 i686 i686 i386 GNU/Linux

Afterwards I opened synaptic manager and marked all kernel files up until 3.2.0-49 for removal (left the last few, just to be on the safe side).

You can open the synaptic manager either from the Dash (Windows button) or with
sudo synaptic






After this, the error message was gone, my kernel wasn't damaged and had been updated successfully.

Sunday, November 3, 2013

Creating Bookmarks in Ubuntu File Manager (Nauitilus)

It is very handy to have some extra directories added to the sidebar in the Ubuntu file manager (Nautilus) to allow quick navigation, especially if one has rather complex file structures on your computer.

Adding bookmark

  1. First, open the file manager
  2. Select the directory you would like to add to the sidebar and enter that directory (!)
  3. Once inside the directory, go to the Ubuntu title bar and select Bookmarks/Add Bookmark (Note that if you are not inside the directory, it will not work!)


  4. The directory will appear in the sidebar of the file manager, granting fast access from now on to the files within that directory.

    Remove Bookmark


    If you want to remove the bookmark from the sidebar right-click it and select remove.

    Saturday, August 10, 2013

    Configuring Mobile Broadband in Ubuntu

    Mobile internet dongles are used in places where stable, wired internet connection is not present due to a range of reasons or it isn't required on a daily basis. Examples are weekend houses, vacations, field trips and many more.

    Internet dongles are usually USB devices with a SIM card in them that use the mobile network to connect to the internet. Based on the type of the modem and the available telecommunication network (speed, signal strength etc.), the speed of the internet access can vary on a very broad range from a few kb/s up to tens of Mb/s. These USB dongles are usually pre-loaded with software that prompts for installation when plugged in to a Windows machine. But what happens in Ubuntu? It's much simpler. Most of the settings required for setting up a mobile broadband are built into the operating system, hence there is no need to download or install any new software.

    The below guide will be based on my experiences in Hungary (EU) with T-mobile. However, Ubuntu is very versatile and contains appropriate settings for almost all countries, hence setting up your own mobile broadband will be very similar.

    1. Put the SIM card into the USB modem and plug it into your computer. If the SIM is PIN code protected, you will be prompted to unlock the SIM card by typing in the PIN.


    2. Go to Networking/Edit Connections/Mobile Broadband and click "Add"


    3. This will prompt you to input a range of information, specific to your provider, country and more. Completing the steps is simple and requires no deep knowledge about computing or telecommunications. The below screenshots are from my setup process.
      (Note: Mobile Broadband device is automatically recognized)





    4. Finally, clicking on the "Apply" button will add the new mobile broadband connection to your Network Connections.

    5. To connect, click on your network icon and select the newly created entry. You should get a pop-up message saying that you are connected. to the internet.

    Depending on you country and provider you are using the steps shown in point 3. can differ, but everything should be self explanatory and straightforward.

    Wednesday, July 31, 2013

    How to Mount a Windows Partition in Ubuntu Using fstab

    If you have dual-boot on your computer or in a range of other events, a partition might be mounted in nautilus automatically, but not using fstab.

    This was my scenario as well, I needed to create a symlink from my Ubuntu system to a folder on the same hard drive, but under Windows 7 (different partition). Nautilus has mounted the Windows 7 NTFS file system on each boot, but the symlink became broken every single time. Talking to some friends on IRC I was told to set up a mount point in fstab as this will be more reliable.

    I will use my own example where I wanted to add a mount point for the device /dev/sda2 to /mnt/windows. (Simply put /dev/sda2 is my Windows 7 partition and I want this to be readable and writeable under the location /mnt/windows)

    1. First off check the list of devices (partitions) with
    sudo blkid

    This will output something like:

    /dev/sda2: UUID="E88450A5845077D0" TYPE="ntfs"
    /dev/sda6: UUID="3ce77abd-dcf9-43f3-a94a-1369855d16b2" TYPE="ext4"
    /dev/sdb1: LABEL="Mass Storage" UUID="4E84E9E384E9CE11" TYPE="ntfs"
    /dev/mapper/cryptswap1: UUID="444536d6-705b-4626-b0a5-382107c3ec96" TYPE="swap"

    What this tells, are the unique identifiers of devices on the computer. 
    For example I know now that /dev/sda2 is my Windows partition based on the fact that it has ntfs file system. This information will be useful in the next steps.

    2. Create the location where you want to mount your partition. This directory must be created first, so go ahead and create a directory in /media or /mnt. In my case this was:

    sudo mkdir /mnt/windows

    3. Edit fstab with

    sudo gedit /etc/fstab

    After inspecting the file, on the top you will see lines of already mounted devices, these will be different depending on your system and configuration. Just to shown an example here are my first 2 lines.

    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    nodev,noexec,nosuid 0       0

    This is mostly self-explanatory.
    <file system>, the first tag of the line is the device, hence the /dev/sda2 in my case if I wanted my external Win7 partition.

    <mount point> is the point where you want this partition to be mounted at. This can be in /media or /mnt or wherever you like it. As explained above, in my case this is /mnt/windows

    <type> defines the type of the partition, that is ext3, ext4, ntfs and so on. This information was also obtained in step 1, ntfs.

    <options> provides extra settings for permission and such. I used "default", but more advanced options can be read in the manual:

    man fstab

    4. Add  a new line for the partition or device you want to mount. In my case again, I wanted to mount the partition at /dev/sda2 to the location /mnt/windows

    Add the following  line to fstab:

    #Windows mount point
    /dev/sda2 /mnt/windows    ntfs    defaults    0    0  

    Save the changes.

    5. After this you can mount all partitions with

    sudo mount -a
     
    Or you can reboot your system and it will be booted automatically.

    Using the above steps I could successfully create a mount point in /mnt/windows to my /dev/sda2 device and this mounting also allows (permanent) symlinks and is persistent even after a reboot.

    Saturday, July 27, 2013

    How Install Flash Games on PirateBox

    Although it was not designed for this, PirateBox can support browser games as well. It's main purpose is to allow anonymous file sharing and chat between the connected users, but hey, it doesn't hurt to have a little fun while sharing files right?
    My TP-LINK MR3020 is loaded with a custom UI and I was experimenting to see if I can get some flash games running sort of "out of the box".

    It turned out, it is simpler than I have imagined, flash games can be used on the PirateBox by simply copying them over and embedding them with <embed media>.

    Here is a screenshot of the flash games running on my box:

    Guide to Install a Game:


    1. Your PirateBox has to be version 0.5.1 or above, that is use lighttpd.
    2. Find the flash game you want on your box. Search on the internet what you like, e.g. mario, sonic and so on. After you found the game, download it on your computer. This should be an ".swf" file.
    3. Take your USB drive from the PirateBox and plug it in your computer. The file USB/PirateBox/pbIMG_ws.img has to be edited. This is an img file container mounted when the PirateBox starts and contains the UI files among others.
      This pbIMG_ws.img is 20 Mb by default so if you have a custom UI and 1-2 game you might need to create a bigger file container.

      To mount this file do:

      sudo mkdir -p /tmp/tmp_mount/ && sudo mount -o loop,rw,sync /media/[$usb]/PirateBox/pbIMG_ws.img /tmp/tmp_mount
      sudo chmod -R 777 /tmp/tmp_mount

      (Where [$usb] is the name of your USB drive)
    4. The file will be mounted at /tmp/tmp_mount/
      Navigate here and open the html file from the www folder you want to add the flash game to.
      Or create a new html page with the game in it. Don't forget to link this to the landing page, so itt will be easily available for users.
    5. Use the following code to embed the flash game into your site:

      <embed src="path/to/flash-game.swf"  type="application/x-shockwave-flash" name="obj1" width="600" height="450">

      src - path to the file within the www directory. Hence if you have a "games" folder in www then the route should be games/yourgame.swf
      width - width of the flash game (advised to keep original)
      height - height of the flash gem (advised to keep original)
    6. After finished, unmount the img container before ejecting the USB drive with:

      sudo umount /media/[$usb]/PirateBox/pbIMG_ws.img

    7. Eject your USB drive, plug in into your PirateBox and boot it.

    NOTE:
    The easiest way to quickly mount and unmount this
    /media/[$usb]/PirateBox/pbIMG_ws.img
    is to create a script that does this for you. 

    Here is the script I wrote to make things easier for myself.

    CAUTION: Flash games load by default in the browser. Therefore, many games on the same page (especially landing page) will most likely create an unnecessarily high load for the PirateBox. I would advise that you create separate html pages for games.



      pbIMG_ws.img mounter script

      People are often having issues with changing and mostly finding the UI/html files on the piratebox. These are located in an img file container located at
      USB/PirateBox/pbIMG_ws.img

      To access the files inside this .img container, you have to mount this file. See guide here.

      The best way to do this mounting is to use a script so you don't need to type the command all the time. The script I am using to quickly mount and unmount the pbIMG_ws.img file from your USB drive that contains the www foler (UI files) is shown below. Feel free to take a copy.

      1. Copy the code below into a text file (starting from the line "#!/bin/bash")
      2. Give it execute permissions either by "properties/allow execution as program" or
      sudo chmod +X file.name
      2. Replace "TOSHIBA" in the configuration part with the name of your USB stick
      3. Run it in the terminal
      _________________________________________________________________________________

      #!/bin/bash

      #Script to mount & unmount pbIMG_ws.img

      ############## CONFIGURE #######################
      #Change this to the name of your USB drive
      usb=TOSHIBA

      ################################################

      echo "What do you want to do?"
      PS3='Select an option:'
      select main in "Mount PirateBox Image" "Unmount PirateBox image"
      do
      case $main in

      "Mount PirateBox Image")
      sudo mkdir -p /tmp/tmp_mount/ && sudo mount -o loop,rw,sync /media/$usb/PirateBox/pbIMG_ws.img /tmp/tmp_mount
      sudo chmod -R 777 /tmp/tmp_mount
      echo ""
      echo "Image was successfully mounted at /tmp/tmp_mount"
      echo "
      1) Mount PirateBox Image
      2) Unmount PirateBox image"
      ;;

      "Unmount PirateBox image")
      sudo chmod -R 777 /tmp/tmp_mount
      sudo umount /media/$usb/PirateBox/pbIMG_ws.img
      echo ""
      echo "PirateBox image was successfully unmounted!"
      echo "
      1) Mount PirateBox Image
      2) Unmount PirateBox image"
      ;;
      *) echo PEBKAC;;
      esac
      done

      Saturday, June 1, 2013

      PirateBox Camp 2013, Berlin

      Hello everyone!

      The PirateBox development team has officially announced today a PirateBox Camp.

      Location: Berlin, Germany 
      Date: 20th & 21th of July, 2013
      Entry: Free for everyone





      The event is free to attend and it is going to be fun for al those  who are interested in the project or would like to contribute to it.

      Talks will take place explaining the the ideas behind the project project, future development, techniques behind it, a DIY section for building PirateBoxes and much more.

      Go check out the details at http://camp.piratebox.de !

      Friday, April 12, 2013

      Installing Litecoin Client and Mining Software in Ubuntu

      Following the success of Bitcoin many different peer-to-peer currencies have appeared on the internet. One of these was Litecoin. And even though it was designed by following the basic principles behind Bitcoin, it has some major differences.

      This guide will show a likeliness to Bitcoin Basics and Ubuntu 12.04 simply because the similarities in the client and mining software and the currency in general.

      Contents of this Article:

      • About Litecoin
      • Installing the Litecoin Client
      • Mining Software
      • Mining Hardware Comparison
      • Installing the Mining Software
      • Where to Mine
      • Sources


      About Litecoin

      Litecoin
      "Litecoin provides faster confirmations (targeted at every 2.5 minutes on average) and uses memory-hard, scrypt-based mining to target the CPUs and GPUs most people already have." [1]

      Generating new currency is done by investing computing power, hashing. The computer solves a puzzle and when it finds a block a reward is issued. he block reward is currently still 50 Litecoins (LTC), halving every ~4 years. The exchange rate at the time of writing this article, 1 LTC was worth ~ $1.5.

      Litecoin network uses the scrypt algorithm that was specially designed to take longer time to compute, hence hashing rates are lower than in the Bitcoin network. However, since a new block is generated - on average - every 2.5 minutes (compared to 10 minutes in the Bitcoin), there will be 4 times as much coins in existence, summing in 84 million.

      Another aim for Litecoin was to avoid concurrence to Bitcoin. While FPGAs and ASICs are providing the majority of the Bitcoin network's hashing power, these are not usable for Litecoin mining (or at least not yet). Litecoin mining is economically viable on available, consumer hardware. As the global hashing rate is slower, there will be no handful of individuals "dominating" the network with extremely powerful devices (to be seen in the future). However, there is still concurrence, as if one has a GPU, a decision has to be made whether to mine BTC or LTC.

      Installing the Litecoin Client


      Installing the client is simple and it can be done either  from the terminal or through GUI/Nautilus.

      It has to be noted that Litecoin has also 2 client versions, litecoind and litecoin-qt. Litecoind is the "litecoin daemon, a terminal version, whereas litecoin-qt is the qt4, GUI version of the client software. Unless you know what you are doing, it is recommended to use the GUI version of the client, litecoin-qt.

      Before Installation

      Package dependencies have to be satisfied. Run the following command to install necessary packages,

      sudo apt-get install libqtgui4
      If you have the Bitcoin client installed, you probably already have all packages.

      GUI
      • Download the latest client software
      • Unpack the downloaded file to anywhere on your computer
      • Navigate to the unpacked directory/bin/##
      • Launch the executable file "litecoin-qt"

      Where ## is either 32 or 64 depending on what system you have (32 or 64 bit).
      This will launch the Litecoin client.


      Terminal

      Run the following commands in a terminal window to install the client,
      • wget https://github.com/downloads/litecoin-project/litecoin/litecoin-0.6.3c-linux.tar.gz
      • tar xzvf litecoin-0.6.3c-linux.tar.gz  
      • cd litecoin-0.6.3c-linux/## 
      • ./litecoin-qt

      Where ## is either 32 or 64 depending on what system you have (32 or 64 bit).
      This will launch the Litecoin client.





      After running the executable file, a directory ".litecoin" will be created in your home directory.
      /Home/$USER/.litecoin contains your blockchain and wallet.dat file. (You can press Ctrl+H to view hidden files)




      The Litecoin client is nicely integrated into the Ubuntu menu bar, originally an issue with older Bitcoin clients.




      Mining Software


      The generation of new blocks is done by "mining" that is the investing of computational power. As the Litecoin was designed to be unfavourable for specific mining hardware (FPGA & ASIC), mining is currently only done using CPUs, but mainly GPUs.

      There are back end software, actually doing the mining and there is a GUI front end, that allows quick and easy configuration.
      The 3 software for Litecoin mining currently available are,
      1. cgminer --scrypt
      2. reaper miner
      3. pooler cpumineer

      GUIminer -scrypt  serves as a front end and has reaper miner, cgminer and even stratum built in! Hence is a truly useful tool for beginners.

      Cgminer is the same miner that is used for mining Bitcoins, but with the argument "--scrypt" it can be used for mining Litecoins. Uses GPU and requires AMD APP SDK on ATI/AMD cards to be installed. Cgminer comes with stratum proxy included, hence it can be used to mine through both getwork and stratum.

      Reaper miner is an OpenCL miner for both nVidia and ATI/AMD GPUs, however it is more efficient on ATI cards. If pool requires stratum, stratum proxy has to be running.

      Pooler cpuminer (or "minerd" ) is a miner for CPUs that was integrated into the Litecoin-qt client as well. If pool requires stratum, stratum proxy has to be running.


      Stratum Mining Protocol (or Stratum Proxy) is a protocol written by slush originally for Bitcoin mining to improve pool-miner communications. This protocol was adopted by a range of other pools and by many of the Litecoin pools as well.


      Mining Hardware Comparison


      Of course there are differences in hardware hashing powers. Due to the architecture of ATI/AMD and nVidia graphics cards, ATI/AMD cards perform better here as well.
      And while one would get 200MH/s+ from a decent GPU in the Bitcoin network, using the scrypt algorithm and mining Litecoin, this value is in the range of a few hundred kH/s.
      CPUs only do a few 10kH/s and hence are (once again) ineffective and probably economically not viable for mining purposes.



      Installing the Mining Software

       

      GUIminer -scrypt

       

      The installation procedure is the same as in the case of GUIminer for Bitcoin. Please refer to Bitcoin Basics and Ubuntu 12.04

      Get the latest release of GUIminer -scrypt from git repository https://github.com/theRealTacoTime/poclbm

      Stratum Proxy


      Stratum protocol is using python. If you do not have python-dev installed, run the following command,
      sudo apt-get install python-dev

      Download the tarball from https://github.com/slush0/stratum-mining-proxy/tarball/master

      Extract it

      Open up a terminal window (Ctrl+Alt+T) and navigate to the newly created directory and run the command to install,
      sudo python setup.py install

      When installation is finished, you may start the proxy with
      ./mining_proxy.py
      However, as stratum tries to connect to slush's Bitcoin mining pool by default, extra arguments need to be used.
      ./mining_proxy.py -o coinotron.com -p 3334
      Would connect to coinotron.com pool on port number 3334. For a list of arguments that can be used, type
      ./mining_proxy.py --help


      Note: If you are getting an error during install, it is likely that you don't have the necessary python-dev installed.
      Also, all this can be done form a terminal window as well,
      wget https://github.com/slush0/stratum-mining-proxy/tarball/master
      tar xf slush0-stratum-mining-proxy-7b5c080.tar.gz
      cd slush0-stratum-mining-proxy-7b5c080/sudo apt-get install python-dev
      sudo python setup.py install

      ./mining_proxy.py -o coinotron.com -p 3334


      Pooler cpuminer


      Download latest source tarball from https://github.com/pooler/cpuminer/downloads
      (I had problems when trying to clone git repository, so use the above link)



      Extract it to anywhere on your computer



      Open a new terminal window and navigate to the newly created directory and compile from source
      ./configure
      make

      After making it the executable file minerd will be created in the directory. You can start using miner (pooler cpuminer) to mine right away. Using the credentials from your pool. Remember, if your pool only uses stratum for mining, you have to have stratum running.

      In this case you have to connect to,
      host: localhost (or 127.0.0.1)
      port: 8332


      Watch out whether or not you have to use stratum and your pool's login credentials. Once again, installation can e done purely from the terminal as well,
      wget https://github.com/downloads/pooler/cpuminer/pooler-cpuminer-2.2.3.tar.gz
      tar xzvf pooler-cpuminer-2.2.3.tar.gz
      cd pooler-cpuminer-2.2.3
      ./configure && make
      ./minerd -o URL:PORT -u USER - p PASSWORD

      Important that minerd can be used through the libcoin-qt as well. To do this copy the minerd executable file into the folder where libcoin-qt is. After this you can start CPU mining directly from your client software! Credentials still have to be provided of course.


      Pooler cpuminer is similar to cgminer and uses the same syntax. When launching from the terminal you can use the following arguments,
      • -o URL of your pool
      • -u workername
      • -p woerkerpass
       So when stratum proxy is running and connected to a pool, it can be run as
      ./minerd -o localhost:8332 -u USER -p PASSWORD


      As with any miners, to get some help,
      ./minerd --help

      Cgminer


      Unfortunately, as my laptop is rather old, it doesn't have a good enough video card to support any type of mining. However, the installation process is the following.


      Cgminer has to be started with the argument "--scrypt" in order to start mining Litecoins with the scrypt algorithm. If you have cgminer on your system and can mine Bitcoins, there is nothing more to do. A sample setup would look like,

      cgminer --scrypt -o stratum+tcp://coinotron.com:3334 -u workername -p workerpass

      Where
      • -o URL of your pool
      • -u workername
      • -p woerkerpass


      Reaper Miner



      Extract the archive

      Open a terminal window and navigate to the directory and issue the following commands,

      mkdir build
      cd build

      cmake -D CMAKE_BUILD_TYPE=Release ..
      make
      You need the 2 dots [..] at the end!
      After this the reaper binary, executable file will be generated. You can run it as
      ./reaper
      If you want to, you can move this executable to any other folder, but also move the files,
      • reaper.cl
      • reaper.conf
      • litecoin.conf
      As these are used by the miner and have to be in the same directory.

      Reaper miner uses config files for mining, in this case 2 config files are of interest, namely reaper.conf and litecoin.conf.

      First open reaper.conf with any text editor and remove the lines
      mine solidcoin
      mine bitcoin
      from the end of the file. It should look like this,


      Then open litecoin.conf (DO NOT mix this up with home/$USER/.litecoin/litecoin.conf as the two are NOT the same !) and fill out the 
      • host localhost 
      • port 8332 
      • user username
      • pass password
      with the proper credentials for your pool. Note that there will be a difference when mining through stratum proxy. The config file should look similar,


      After these configurations have been made, make sure that the reaper executable file is in the same directory as the config files. Run reaper with
      ./reaper


      If you have managed to start reaper miner, you can start experimenting with the configuration files to get better hashing speeds.

      Note that reaper miner also uses OpenCL, hence make sure you have the necessary AMD APP SDK installed.

      Where to Mine


      Just like with Bitcoin, there are two options for mining: solo and pooled mining.

      Solo mining is when you are running the client in server mode and connect to it with your mining software. If you find a block, the whole 50LTC reward goes to you (~70$ currently). If, however, you do not find a block, there is no reward. This is a high risk high gain mining technique and it is not advised unless you have considerable hashing power.

      Pooled mining is when a group of miners unite and mine as a team. Shares are given to each miner based on the amount of work (hashes solved) and when a block is found by any of the miners, the block reward is split among the miners, based on the amount of shares received. This allows a steadier, but smaller amount of payments and hence reduces the risk of never finding a block and never receiving anything.

      Configure Solo Mining

      Solo mining requires to start the client software in server mode, have proper configuration and connect the mining software to the running client.

      1. Firstly a litecoin.conf file has to be created in /Home/$USER/.litecoin
      This file has to contain the following lines:

      rpcuser=username
      rpcpassword=password
      rpcallowip=127.0.0.1
      rpcport=9332
      daemon=1
      server=1
      gen=0
      Make sure you change username and password to something unique.

      2. Kill the running litecoind or litecoin-qt if any of them are running. You can do this by right-clicking it in the top bar and choose "exit" or sudo killall litecoin-qt.

      3. The client has to be launched in server mode in order for you to connect to it and mine in solo mode. To do this navigate to the unpacked folder and run litecoin-qt with the -server option.


      4. Connecting to the server with any mining software is using the credentials given in the litecoin.conf file as created above.

      host: 127.0.0.1 (or localhost)
      port: 9332
      username: your unique username
      password: your unique passowrd

      Note: You will not see any shares being accepted when mining in solo. If a share is accepted, that means you have found a block. Also if you get a connection error, double-check the credentials to see if you have mistyped something.

      Configure Pooled Mining


      A list of mining pools is available HERE. After signing up for a pool, you will need some credentials,

      • worker name
      • worker password
      • pool mining address
      • port number

      Workers are simply put the devices that will mine Litecoins for you. For example if you have 2 GPUs and a decent CPU, you would need to create 3 separate workers.

      To connect to the pool, simply substitute the above credentials when connecting with any of the mining software.

      Here is a list of mining pools, compared.

      Remember

      • Some pools require stratum and do not work over standard http/getwork.
      • If you are running stratum, use the host "localhost" or "127.0.0.1" and the port "8332"
      • In order to mine with GPUs you have to have either AMD APP SDK for AMD/ATI cards or the CUDA toolkit for nVidia cards. Dont forget about appropriate drivers either. (There are some useful ATI driver links in the blog sidebar)
      If you need any help, or something wasn't clear, please leave a comment and I will get back to you and reply as soon as I can.
      Happy mining!

      (Also, if you have some Litecoins already and want to have some fun, you can check out litecoinkamikaze.com. Here you can use your Litecoins to make bets, play and maybe even win the jackpot.)

      Sources


      Thursday, April 4, 2013

      Create Symbolic Links in Ubuntu

      The 2 types of links are hard links and soft links .

      A hard link is essentially a file with multiple names, there are multiple copies of the file. So that if one of the hard links is deleted, the file persists to exist.

      A soft link (also called symlink or symbolic link) is a file system entry that points to the file name and location. Deleting the symbolic link does not remove the original file. If, however, the file to which the soft link points is removed, the soft link stops working, it is broken.

      Symbolic links can be created both from the terminal and from nautilus (file manager, GUI). 
       

      Terminal

       

      The syntax for creating a symbolic link is,
      ln -s target source
      where,
      • target - The existing file/directory you would like to link TO.
      • source - The file/folder to be created, copying the contents of the target. The LINK itself.
      For more help see ln --help

      Example:
      ln -s /home/nargren/Pictures /home/nargren/Pictures_Backup
      This would create a symbolic link directory called "Pictures_Backup" to my "Pictures" directory. All the content in either of the 2 directories would appear in the other one as well.

      GUI

       

      You can easily create a symbolic link to a folder or file by middle clicking on the folder with the mouse and dragging it to its new location, while holding the middle mouse button.

      Remove Symbolic Links

       

      To remove a symbolic link, be it a file or directory, simply remove the created link. This can be done either through nautilus (GUI) or using the rm and rm -f commands in the terminal.

      Use of Symbolic Links

       

      Symbolic links are especially useful on computers with dual-boot, running for example Windows and Linux. As symbolic links can be created across partitions and file systems, windows folders can be linked to appropriate Ubuntu folders.

      I will bring my own example of using Mozilla Thunderbird as e-mail client. I would like to have my emails and profiles available, including all my downloaded emails on both operating systems. This could be done either by downloading all new e-mails when I start the software on any of the two operating systems, or via symbolic links. As I had problems downloading new emails with multiple clients, I have chosen to make a symbolic link.

      I have linked my Windows
      [USER]\AppData\Roaming\Thunderbird
       folder to the Ubuntu directory
       home/.thunderbird
      This allowed me to download my emails only once and have them available on both Windows and Linux while keeping my entire profile.